Back to index

lightdm  1.3.2
xdmcp-protocol.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2010-2011 Robert Ancell.
00003  * Author: Robert Ancell <robert.ancell@canonical.com>
00004  * 
00005  * This program is free software: you can redistribute it and/or modify it under
00006  * the terms of the GNU General Public License as published by the Free Software
00007  * Foundation, either version 3 of the License, or (at your option) any later
00008  * version. See http://www.gnu.org/copyleft/gpl.html the full text of the
00009  * license.
00010  */
00011 
00012 #ifndef _XDMCP_PROTOCOL_H_
00013 #define _XDMCP_PROTOCOL_H_
00014 
00015 #include <glib.h>
00016 
00017 #define XDMCP_VERSION 1
00018 
00019 typedef enum
00020 {
00021     XDMCP_BroadcastQuery = 1,
00022     XDMCP_Query          = 2,
00023     XDMCP_IndirectQuery  = 3,
00024     XDMCP_ForwardQuery   = 4,
00025     XDMCP_Willing        = 5,
00026     XDMCP_Unwilling      = 6,
00027     XDMCP_Request        = 7,
00028     XDMCP_Accept         = 8,
00029     XDMCP_Decline        = 9,
00030     XDMCP_Manage         = 10,
00031     XDMCP_Refuse         = 11,
00032     XDMCP_Failed         = 12,
00033     XDMCP_KeepAlive      = 13,
00034     XDMCP_Alive          = 14
00035 } XDMCPOpcode;
00036 
00037 typedef struct
00038 {
00039     guint16 length;
00040     guchar *data;
00041 } XDMCPData;
00042 
00043 typedef struct
00044 {
00045     guint16 type;
00046     XDMCPData address;
00047 } XDMCPConnection;
00048 
00049 typedef struct
00050 {
00051     XDMCPOpcode opcode;
00052   
00053     union
00054     {
00055         struct
00056         {
00057             gchar **authentication_names;
00058         } Query;
00059 
00060         struct
00061         {
00062             gchar *client_address;
00063             gchar *client_port;
00064             gchar **authentication_names;
00065         } ForwardQuery;
00066 
00067         struct
00068         {
00069             gchar *authentication_name;
00070             gchar *hostname;
00071             gchar *status;
00072         } Willing;
00073 
00074         struct
00075         {
00076             gchar *hostname;
00077             gchar *status;
00078         } Unwilling;
00079 
00080         struct
00081         {
00082             guint16 display_number;
00083             guint8 n_connections;
00084             XDMCPConnection *connections;
00085             gchar *authentication_name;
00086             XDMCPData authentication_data;
00087             gchar **authorization_names;
00088             gchar *manufacturer_display_id;
00089         } Request;
00090 
00091         struct
00092         {
00093             guint32 session_id;
00094             gchar *authentication_name;
00095             XDMCPData authentication_data;
00096             gchar *authorization_name;
00097             XDMCPData authorization_data;
00098         } Accept;
00099 
00100         struct
00101         {
00102             gchar *status;
00103             gchar *authentication_name;
00104             XDMCPData authentication_data;
00105         } Decline;
00106 
00107         struct
00108         {
00109             guint32 session_id;
00110             guint16 display_number;
00111             gchar *display_class;
00112         } Manage;
00113 
00114         struct
00115         {
00116             guint32 session_id;
00117         } Refuse;
00118 
00119         struct
00120         {
00121             guint32 session_id;
00122             gchar *status;
00123         } Failed;
00124 
00125         struct
00126         {
00127             guint16 display_number;
00128             guint32 session_id;
00129         } KeepAlive;
00130 
00131         struct
00132         {
00133             gboolean session_running;
00134             guint32 session_id;
00135         } Alive;
00136     };
00137 } XDMCPPacket;
00138 
00139 XDMCPPacket *xdmcp_packet_alloc (XDMCPOpcode opcode);
00140 
00141 XDMCPPacket *xdmcp_packet_decode (const guchar *data, gsize length);
00142 
00143 gssize xdmcp_packet_encode (XDMCPPacket *packet, guchar *data, gsize length);
00144 
00145 gchar *xdmcp_packet_tostring (XDMCPPacket *packet);
00146 
00147 void xdmcp_packet_free (XDMCPPacket *packet);
00148 
00149 #endif /* _XDMCP_PROTOCOL_H_ */