cscg24-guacamole

CSCG 2024 Challenge 'Guacamole Mashup'
git clone https://git.sinitax.com/sinitax/cscg24-guacamole
Log | Files | Refs | sfeed.txt

stream.h (3312B)


      1/*
      2 * Licensed to the Apache Software Foundation (ASF) under one
      3 * or more contributor license agreements.  See the NOTICE file
      4 * distributed with this work for additional information
      5 * regarding copyright ownership.  The ASF licenses this file
      6 * to you under the Apache License, Version 2.0 (the
      7 * "License"); you may not use this file except in compliance
      8 * with the License.  You may obtain a copy of the License at
      9 *
     10 *   http://www.apache.org/licenses/LICENSE-2.0
     11 *
     12 * Unless required by applicable law or agreed to in writing,
     13 * software distributed under the License is distributed on an
     14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     15 * KIND, either express or implied.  See the License for the
     16 * specific language governing permissions and limitations
     17 * under the License.
     18 */
     19
     20#ifndef _GUAC_STREAM_H
     21#define _GUAC_STREAM_H
     22
     23/**
     24 * Provides functions and structures required for allocating and using streams.
     25 *
     26 * @file stream.h
     27 */
     28
     29#include "user-fntypes.h"
     30#include "stream-types.h"
     31
     32struct guac_stream {
     33
     34    /**
     35     * The index of this stream.
     36     */
     37    int index;
     38
     39    /**
     40     * Arbitrary data associated with this stream.
     41     */
     42    void* data;
     43
     44    /**
     45     * Handler for ack events sent by the Guacamole web-client.
     46     *
     47     * The handler takes a guac_stream which contains the stream index and
     48     * will persist through the duration of the transfer, a string containing
     49     * the error or status message, and a status code.
     50     *
     51     * Example:
     52     * @code
     53     *     int ack_handler(guac_user* user, guac_stream* stream,
     54     *             char* error, guac_protocol_status status);
     55     *
     56     *     int some_function(guac_user* user) {
     57     *
     58     *         guac_stream* stream = guac_user_alloc_stream(user);
     59     *         stream->ack_handler = ack_handler;
     60     *
     61     *         guac_protocol_send_clipboard(user->socket,
     62     *             stream, "text/plain");
     63     *
     64     *     }
     65     * @endcode
     66     */
     67    guac_user_ack_handler* ack_handler;
     68
     69    /**
     70     * Handler for blob events sent by the Guacamole web-client.
     71     *
     72     * The handler takes a guac_stream which contains the stream index and
     73     * will persist through the duration of the transfer, an arbitrary buffer
     74     * containing the blob, and the length of the blob.
     75     *
     76     * Example:
     77     * @code
     78     *     int blob_handler(guac_user* user, guac_stream* stream,
     79     *             void* data, int length);
     80     *
     81     *     int my_clipboard_handler(guac_user* user, guac_stream* stream,
     82     *             char* mimetype) {
     83     *         stream->blob_handler = blob_handler;
     84     *     }
     85     * @endcode
     86     */
     87    guac_user_blob_handler* blob_handler;
     88
     89    /**
     90     * Handler for stream end events sent by the Guacamole web-client.
     91     *
     92     * The handler takes only a guac_stream which contains the stream index.
     93     * This guac_stream will be disposed of immediately after this event is
     94     * finished.
     95     *
     96     * Example:
     97     * @code
     98     *     int end_handler(guac_user* user, guac_stream* stream);
     99     *
    100     *     int my_clipboard_handler(guac_user* user, guac_stream* stream,
    101     *             char* mimetype) {
    102     *         stream->end_handler = end_handler;
    103     *     }
    104     * @endcode
    105     */
    106    guac_user_end_handler* end_handler;
    107
    108};
    109
    110#endif
    111