diff options
author | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2016-02-16 11:53:28 +0100 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2016-02-16 11:53:28 +0100 |
commit | f431158ae2412ed23bd4d2336af00d2b5c170d31 (patch) | |
tree | 52c5fbbc7ba26f7444edbe7d0e8d80ed67796384 /uca-net-protocol.h | |
download | uca-net-f431158ae2412ed23bd4d2336af00d2b5c170d31.tar.gz uca-net-f431158ae2412ed23bd4d2336af00d2b5c170d31.tar.bz2 uca-net-f431158ae2412ed23bd4d2336af00d2b5c170d31.tar.xz uca-net-f431158ae2412ed23bd4d2336af00d2b5c170d31.zip |
Initial commit
Diffstat (limited to 'uca-net-protocol.h')
-rw-r--r-- | uca-net-protocol.h | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/uca-net-protocol.h b/uca-net-protocol.h new file mode 100644 index 0000000..3df8c37 --- /dev/null +++ b/uca-net-protocol.h @@ -0,0 +1,85 @@ +#ifndef PROTOCOL_H +#define PROTOCOL_H + +#include <gio/gio.h> + +typedef enum { + UCA_NET_MESSAGE_GET_PROPERTY = 0, + UCA_NET_MESSAGE_SET_PROPERTY, + UCA_NET_MESSAGE_START_RECORDING, + UCA_NET_MESSAGE_STOP_RECORDING, + UCA_NET_MESSAGE_GRAB, + UCA_NET_MESSAGE_CLOSE_CONNECTION, +} UcaNetMessageType; + +typedef struct { + gboolean occurred; + gchar domain[64]; + gint code; + gchar message[512]; +} UcaNetErrorReply; + +typedef struct { + UcaNetMessageType type; + UcaNetErrorReply error; +} UcaNetDefaultReply; + +typedef struct { + UcaNetMessageType type; +} UcaNetMessageDefault; + +typedef struct { + UcaNetMessageType type; + gchar property_name[128]; +} UcaNetMessageGetPropertyRequest; + +typedef struct { + UcaNetMessageType type; + gchar property_value[128]; +} UcaNetMessageGetPropertyReply; + +typedef struct { + UcaNetMessageType type; + gchar property_name[128]; + gchar property_value[128]; +} UcaNetMessageSetPropertyRequest; + +typedef struct { + UcaNetMessageType type; + gsize size; +} UcaNetMessageGrabRequest; + + +typedef struct { + gpointer user_data; + + void (*get_property) (gpointer user_data, const gchar *name, gchar *value); + void (*set_property) (gpointer user_data, const gchar *name, const gchar *value, GError **error); + void (*start_recording) (gpointer user_data, GError **error); + void (*stop_recording) (gpointer user_data, GError **error); + gboolean (*grab) (gpointer data, gpointer user_data, GError **error); +} UcaNetHandlers; + +gboolean uca_net_client_get_property (GSocketConnection *connection, + const gchar *name, + GValue *value, + GError **error); +gboolean uca_net_client_set_property (GSocketConnection *connection, + const gchar *name, + const GValue *value, + GError **error); +void uca_net_client_start_recording (GSocketConnection *connection, + GError **error); +void uca_net_client_stop_recording (GSocketConnection *connection, + GError **error); +gboolean uca_net_client_grab (GSocketConnection *connection, + gpointer data, + gsize size, + GError **error); +gboolean uca_net_client_close (GSocketConnection *connection, + GError **error); + +void uca_net_server_register_handlers (UcaNetHandlers *handlers); +void uca_net_server_handle (GSocketConnection *connection); + +#endif |