Back to index

lightdm  1.3.2
Classes | Defines | Enumerations | Functions
xdmcp-protocol.h File Reference
#include <glib.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  XDMCPData
struct  XDMCPConnection
struct  XDMCPPacket
union  XDMCPPacket.__unnamed__
struct  XDMCPPacket.__unnamed__.Query
struct  XDMCPPacket.__unnamed__.ForwardQuery
struct  XDMCPPacket.__unnamed__.Willing
struct  XDMCPPacket.__unnamed__.Unwilling
struct  XDMCPPacket.__unnamed__.Request
struct  XDMCPPacket.__unnamed__.Accept
struct  XDMCPPacket.__unnamed__.Decline
struct  XDMCPPacket.__unnamed__.Manage
struct  XDMCPPacket.__unnamed__.Refuse
struct  XDMCPPacket.__unnamed__.Failed
struct  XDMCPPacket.__unnamed__.KeepAlive
struct  XDMCPPacket.__unnamed__.Alive

Defines

#define XDMCP_VERSION   1

Enumerations

enum  XDMCPOpcode {
  XDMCP_BroadcastQuery = 1, XDMCP_Query = 2, XDMCP_IndirectQuery = 3, XDMCP_ForwardQuery = 4,
  XDMCP_Willing = 5, XDMCP_Unwilling = 6, XDMCP_Request = 7, XDMCP_Accept = 8,
  XDMCP_Decline = 9, XDMCP_Manage = 10, XDMCP_Refuse = 11, XDMCP_Failed = 12,
  XDMCP_KeepAlive = 13, XDMCP_Alive = 14, XDMCP_BroadcastQuery = 1, XDMCP_Query = 2,
  XDMCP_IndirectQuery = 3, XDMCP_ForwardQuery = 4, XDMCP_Willing = 5, XDMCP_Unwilling = 6,
  XDMCP_Request = 7, XDMCP_Accept = 8, XDMCP_Decline = 9, XDMCP_Manage = 10,
  XDMCP_Refuse = 11, XDMCP_Failed = 12, XDMCP_KeepAlive = 13, XDMCP_Alive = 14
}

Functions

XDMCPPacketxdmcp_packet_alloc (XDMCPOpcode opcode)
XDMCPPacketxdmcp_packet_decode (const guchar *data, gsize length)
gssize xdmcp_packet_encode (XDMCPPacket *packet, guchar *data, gsize length)
gchar * xdmcp_packet_tostring (XDMCPPacket *packet)
void xdmcp_packet_free (XDMCPPacket *packet)

Class Documentation

struct XDMCPData

Definition at line 37 of file xdmcp-protocol.h.

Class Members
guchar * data
guint16 length
struct XDMCPConnection

Definition at line 43 of file xdmcp-protocol.h.

Collaboration diagram for XDMCPConnection:
Class Members
XDMCPData address
guint16 type
struct XDMCPPacket

Definition at line 49 of file xdmcp-protocol.h.

Class Members
union XDMCPPacket __unnamed__
XDMCPOpcode opcode
union XDMCPPacket.__unnamed__

Definition at line 53 of file xdmcp-protocol.h.

Class Members
__unnamed__ Accept
__unnamed__ Alive
__unnamed__ Decline
__unnamed__ Failed
__unnamed__ ForwardQuery
__unnamed__ KeepAlive
__unnamed__ Manage
__unnamed__ Query
__unnamed__ Refuse
__unnamed__ Request
__unnamed__ Unwilling
__unnamed__ Willing
struct XDMCPPacket.__unnamed__.Query

Definition at line 55 of file xdmcp-protocol.h.

Class Members
gchar ** authentication_names
struct XDMCPPacket.__unnamed__.ForwardQuery

Definition at line 60 of file xdmcp-protocol.h.

Class Members
gchar ** authentication_names
gchar * client_address
gchar * client_port
struct XDMCPPacket.__unnamed__.Willing

Definition at line 67 of file xdmcp-protocol.h.

Class Members
gchar * authentication_name
gchar * hostname
gchar * status
struct XDMCPPacket.__unnamed__.Unwilling

Definition at line 74 of file xdmcp-protocol.h.

Class Members
gchar * hostname
gchar * status
struct XDMCPPacket.__unnamed__.Request

Definition at line 80 of file xdmcp-protocol.h.

Class Members
XDMCPData authentication_data
gchar * authentication_name
gchar ** authorization_names
XDMCPConnection * connections
guint16 display_number
gchar * manufacturer_display_id
guint8 n_connections
struct XDMCPPacket.__unnamed__.Accept

Definition at line 91 of file xdmcp-protocol.h.

Class Members
XDMCPData authentication_data
gchar * authentication_name
XDMCPData authorization_data
gchar * authorization_name
guint32 session_id
struct XDMCPPacket.__unnamed__.Decline

Definition at line 100 of file xdmcp-protocol.h.

Class Members
XDMCPData authentication_data
gchar * authentication_name
gchar * status
struct XDMCPPacket.__unnamed__.Manage

Definition at line 107 of file xdmcp-protocol.h.

Class Members
gchar * display_class
guint16 display_number
guint32 session_id
struct XDMCPPacket.__unnamed__.Refuse

Definition at line 114 of file xdmcp-protocol.h.

Class Members
guint32 session_id
struct XDMCPPacket.__unnamed__.Failed

Definition at line 119 of file xdmcp-protocol.h.

Class Members
guint32 session_id
gchar * status
struct XDMCPPacket.__unnamed__.KeepAlive

Definition at line 125 of file xdmcp-protocol.h.

Class Members
guint16 display_number
guint32 session_id
struct XDMCPPacket.__unnamed__.Alive

Definition at line 131 of file xdmcp-protocol.h.

Class Members
guint32 session_id
gboolean session_running

Define Documentation

#define XDMCP_VERSION   1

Definition at line 17 of file xdmcp-protocol.h.


Enumeration Type Documentation

Enumerator:
XDMCP_BroadcastQuery 
XDMCP_Query 
XDMCP_IndirectQuery 
XDMCP_ForwardQuery 
XDMCP_Willing 
XDMCP_Unwilling 
XDMCP_Request 
XDMCP_Accept 
XDMCP_Decline 
XDMCP_Manage 
XDMCP_Refuse 
XDMCP_Failed 
XDMCP_KeepAlive 
XDMCP_Alive 
XDMCP_BroadcastQuery 
XDMCP_Query 
XDMCP_IndirectQuery 
XDMCP_ForwardQuery 
XDMCP_Willing 
XDMCP_Unwilling 
XDMCP_Request 
XDMCP_Accept 
XDMCP_Decline 
XDMCP_Manage 
XDMCP_Refuse 
XDMCP_Failed 
XDMCP_KeepAlive 
XDMCP_Alive 

Definition at line 19 of file xdmcp-protocol.h.


Function Documentation

Definition at line 162 of file xdmcp-protocol.c.

{
    XDMCPPacket *packet;

    packet = g_malloc0 (sizeof (XDMCPPacket));
    packet->opcode = opcode;

    return packet;
}

Here is the caller graph for this function:

XDMCPPacket* xdmcp_packet_decode ( const guchar *  data,
gsize  length 
)
gssize xdmcp_packet_encode ( XDMCPPacket packet,
guchar *  data,
gsize  length 
)
void xdmcp_packet_free ( XDMCPPacket packet)

Definition at line 533 of file xdmcp-protocol.c.

{
    gint i;

    if (packet == NULL)
        return;

    switch (packet->opcode)
    {
    case XDMCP_BroadcastQuery:
    case XDMCP_Query:
    case XDMCP_IndirectQuery:
        g_strfreev (packet->Query.authentication_names);
        break;
    case XDMCP_ForwardQuery:
        g_free (packet->ForwardQuery.client_address);
        g_free (packet->ForwardQuery.client_port);
        g_strfreev (packet->ForwardQuery.authentication_names);
        break;
    case XDMCP_Willing:
        g_free (packet->Willing.authentication_name);
        g_free (packet->Willing.hostname);
        g_free (packet->Willing.status);
        break;
    case XDMCP_Unwilling:
        g_free (packet->Unwilling.hostname);
        g_free (packet->Unwilling.status);
        break;
    case XDMCP_Request:
        for (i = 0; i < packet->Request.n_connections; i++)
            g_free (packet->Request.connections[i].address.data);
        g_free (packet->Request.connections);
        g_free (packet->Request.authentication_name);
        g_free (packet->Request.authentication_data.data);
        g_strfreev (packet->Request.authorization_names);
        g_free (packet->Request.manufacturer_display_id);
        break;
    case XDMCP_Accept:
        g_free (packet->Accept.authentication_name);
        g_free (packet->Accept.authentication_data.data);
        g_free (packet->Accept.authorization_name);
        g_free (packet->Accept.authorization_data.data);
        break;
    case XDMCP_Decline:
        g_free (packet->Decline.status);
        g_free (packet->Decline.authentication_name);
        g_free (packet->Decline.authentication_data.data);
        break;
    case XDMCP_Manage:
        g_free (packet->Manage.display_class);
        break;
    case XDMCP_Refuse:
        break;
    case XDMCP_Failed:
        g_free (packet->Failed.status);
        break;
    case XDMCP_KeepAlive:
        break;
    case XDMCP_Alive:
        break;
    }
    g_free (packet);
}

Here is the caller graph for this function:

gchar* xdmcp_packet_tostring ( XDMCPPacket packet)

Definition at line 443 of file xdmcp-protocol.c.

{
    gchar *string, *t, *t2;
    gint i;
    GString *t3;

    switch (packet->opcode)
    {
    case XDMCP_BroadcastQuery:
        t = string_list_tostring (packet->Query.authentication_names);
        string = g_strdup_printf ("BroadcastQuery(authentication_names=[%s])", t);
        g_free (t);
        return string;
    case XDMCP_Query:
        t = string_list_tostring (packet->Query.authentication_names);
        string = g_strdup_printf ("Query(authentication_names=[%s])", t);
        g_free (t);
        return string;
    case XDMCP_IndirectQuery:
        t = string_list_tostring (packet->Query.authentication_names);
        string = g_strdup_printf ("IndirectQuery(authentication_names=[%s])", t);
        g_free (t);
        return string;
    case XDMCP_ForwardQuery:
        t = string_list_tostring (packet->ForwardQuery.authentication_names);
        string = g_strdup_printf ("ForwardQuery(client_address='%s' client_port='%s' authentication_names=[%s])",
                                  packet->ForwardQuery.client_address, packet->ForwardQuery.client_port, t);
        g_free (t);
        return string;
    case XDMCP_Willing:
        return g_strdup_printf ("Willing(authentication_name='%s' hostname='%s' status='%s')",
                                packet->Willing.authentication_name, packet->Willing.hostname, packet->Willing.status);
    case XDMCP_Unwilling:
        return g_strdup_printf ("Unwilling(hostname='%s' status='%s')",
                                packet->Unwilling.hostname, packet->Unwilling.status);      
    case XDMCP_Request:
        t = string_list_tostring (packet->Request.authorization_names);
        t2 = data_tostring (&packet->Request.authentication_data);
        t3 = g_string_new ("");
        for (i = 0; i < packet->Request.n_connections; i++)
        {
            gchar *t4;

            if (i != 0)
               g_string_append (t3, " ");
            t4 = data_tostring (&packet->Request.connections[i].address);
            g_string_append_printf (t3, "(%d, %s)", packet->Request.connections[i].type, t4);
            g_free (t4);
        }
        string = g_strdup_printf ("Request(display_number=%d connections=[%s] authentication_name='%s' authentication_data=%s authorization_names=[%s] manufacturer_display_id='%s')",
                                  packet->Request.display_number, t3->str, packet->Request.authentication_name, t2,
                                  t, packet->Request.manufacturer_display_id);
        g_free (t);
        g_free (t2);
        g_string_free (t3, TRUE);
        return string;
    case XDMCP_Accept:
        t = data_tostring (&packet->Accept.authentication_data);
        t2 = data_tostring (&packet->Accept.authorization_data);
        string =  g_strdup_printf ("Accept(session_id=%d authentication_name='%s' authentication_data=%s authorization_name='%s' authorization_data=%s)",
                                   packet->Accept.session_id, packet->Accept.authentication_name, t,
                                   packet->Accept.authorization_name, t2);
        g_free (t);
        g_free (t2);
        return string;
    case XDMCP_Decline:
        t = data_tostring (&packet->Decline.authentication_data);
        string = g_strdup_printf ("Decline(status='%s' authentication_name='%s' authentication_data=%s)",
                                  packet->Decline.status, packet->Decline.authentication_name, t);
        g_free (t);
        return string;
    case XDMCP_Manage:
        return g_strdup_printf ("Manage(session_id=%d display_number=%d display_class='%s')",
                                packet->Manage.session_id, packet->Manage.display_number, packet->Manage.display_class);
    case XDMCP_Refuse:
        return g_strdup_printf ("Refuse(session_id=%d)", packet->Refuse.session_id);
    case XDMCP_Failed:
        return g_strdup_printf ("Failed(session_id=%d status='%s')", packet->Failed.session_id, packet->Failed.status);
    case XDMCP_KeepAlive:
        return g_strdup_printf ("KeepAlive(display_number=%d session_id=%d)",
                                packet->KeepAlive.display_number, packet->KeepAlive.session_id);
    case XDMCP_Alive:
        return g_strdup_printf ("Alive(session_running=%s session_id=%d)",
                                packet->Alive.session_running ? "true" : "false", packet->Alive.session_id);
    default:
        return g_strdup_printf ("XDMCPPacket(opcode=%d)", packet->opcode);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function: