cscg24-guacamole

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

object.h (2728B)


      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_OBJECT_H
     21#define GUAC_OBJECT_H
     22
     23/**
     24 * Provides functions and structures required for allocating and using objects.
     25 *
     26 * @file object.h
     27 */
     28
     29#include "object-types.h"
     30#include "user-fntypes.h"
     31
     32struct guac_object {
     33
     34    /**
     35     * The index of this object.
     36     */
     37    int index;
     38
     39    /**
     40     * Arbitrary data associated with this object.
     41     */
     42    void* data;
     43
     44    /**
     45     * Handler for get events sent by the Guacamole web-client.
     46     *
     47     * The handler takes a guac_object, containing the object index which will
     48     * persist through the duration of the transfer, and the name of the stream
     49     * being requested. It is up to the get handler to create the required body
     50     * stream.
     51     *
     52     * Example:
     53     * @code
     54     *     int get_handler(guac_user* user, guac_object* object,
     55     *             char* name);
     56     *
     57     *     int some_function(guac_user* user) {
     58     *
     59     *         guac_object* object = guac_user_alloc_object(user);
     60     *         object->get_handler = get_handler;
     61     *
     62     *     }
     63     * @endcode
     64     */
     65    guac_user_get_handler* get_handler;
     66
     67    /**
     68     * Handler for put events sent by the Guacamole web-client.
     69     *
     70     * The handler takes a guac_object and guac_stream, which each contain their
     71     * respective indices which will persist through the duration of the
     72     * transfer, the mimetype of the data being transferred, and the name of
     73     * the stream within the object being written to.
     74     *
     75     * Example:
     76     * @code
     77     *     int put_handler(guac_user* user, guac_object* object,
     78     *             guac_stream* stream, char* mimetype, char* name);
     79     *
     80     *     int some_function(guac_user* user) {
     81     *
     82     *         guac_object* object = guac_user_alloc_object(user);
     83     *         object->put_handler = put_handler;
     84     *
     85     *     }
     86     * @endcode
     87     */
     88    guac_user_put_handler* put_handler;
     89
     90};
     91
     92#endif
     93