Back to index

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

Go to the source code of this file.

Classes

struct  XDMCPWilling
struct  XDMCPAccept
struct  XDMCPDecline
struct  XDMCPFailed
struct  XDMCPClient
struct  XDMCPClientClass

Defines

#define XDMCP_VERSION   1
#define XDMCP_PORT   177

Typedefs

typedef struct XDMCPClientPrivate

Functions

GType xdmcp_client_get_type (void)
XDMCPClientxdmcp_client_new (void)
void xdmcp_client_set_hostname (XDMCPClient *client, const gchar *hostname)
void xdmcp_client_set_port (XDMCPClient *client, guint16 port)
gboolean xdmcp_client_start (XDMCPClient *client)
GInetAddress * xdmcp_client_get_local_address (XDMCPClient *client)
void xdmcp_client_send_query (XDMCPClient *client)
void xdmcp_client_send_request (XDMCPClient *client, guint16 display_number, GInetAddress **addresses, const gchar *authentication_name, const guint8 *authentication_data, guint16 authentication_data_length, gchar **authorization_names, const gchar *mfid)
void xdmcp_client_send_manage (XDMCPClient *client, guint32 session_id, guint16 display_number, gchar *display_class)

Class Documentation

struct XDMCPWilling

Definition at line 10 of file xdmcp-client.h.

Class Members
gchar * authentication_name
gchar * hostname
gchar * status
struct XDMCPAccept

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

Class Members
gchar * authentication_name
guint8 * authorization_data
guint16 authorization_data_length
gchar * authorization_name
guint32 session_id
struct XDMCPDecline

Definition at line 26 of file xdmcp-client.h.

Class Members
gchar * authentication_name
gchar * status
struct XDMCPFailed

Definition at line 32 of file xdmcp-client.h.

Class Members
guint32 session_id
gchar * status
struct XDMCPClient

Definition at line 40 of file xdmcp-client.h.

Collaboration diagram for XDMCPClient:
Class Members
GObject parent_instance
XDMCPClientPrivate * priv

Define Documentation

#define XDMCP_PORT   177

Definition at line 8 of file xdmcp-client.h.

#define XDMCP_VERSION   1

Definition at line 7 of file xdmcp-client.h.


Typedef Documentation

typedef struct XDMCPClientPrivate

Definition at line 38 of file xdmcp-client.h.


Function Documentation

GInetAddress* xdmcp_client_get_local_address ( XDMCPClient client)

Definition at line 288 of file xdmcp-client.c.

{
    GSocketAddress *socket_address;
  
    if (!client->priv->socket)
        return NULL;

    socket_address = g_socket_get_local_address (client->priv->socket, NULL);
    return g_inet_socket_address_get_address (G_INET_SOCKET_ADDRESS (socket_address));
}

Here is the caller graph for this function:

GType xdmcp_client_get_type ( void  )

Here is the caller graph for this function:

Definition at line 243 of file xdmcp-client.c.

{
    return g_object_new (xdmcp_client_get_type (), NULL);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void xdmcp_client_send_manage ( XDMCPClient client,
guint32  session_id,
guint16  display_number,
gchar *  display_class 
)

Definition at line 382 of file xdmcp-client.c.

{
    guint8 buffer[MAXIMUM_REQUEST_LENGTH];
    gsize offset = 0;

    write_card16 (buffer, MAXIMUM_REQUEST_LENGTH, X_BYTE_ORDER_MSB, XDMCP_VERSION, &offset);
    write_card16 (buffer, MAXIMUM_REQUEST_LENGTH, X_BYTE_ORDER_MSB, XDMCP_Manage, &offset);
    write_card16 (buffer, MAXIMUM_REQUEST_LENGTH, X_BYTE_ORDER_MSB, 8 + strlen (display_class), &offset);

    write_card32 (buffer, MAXIMUM_REQUEST_LENGTH, X_BYTE_ORDER_MSB, session_id, &offset);
    write_card16 (buffer, MAXIMUM_REQUEST_LENGTH, X_BYTE_ORDER_MSB, display_number, &offset);
    write_card16 (buffer, MAXIMUM_REQUEST_LENGTH, X_BYTE_ORDER_MSB, strlen (display_class), &offset);
    write_string (buffer, MAXIMUM_REQUEST_LENGTH, display_class, &offset);

    xdmcp_write (client, buffer, offset); 
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 307 of file xdmcp-client.c.

{
    guint8 buffer[MAXIMUM_REQUEST_LENGTH];
    gsize offset = 0;

    write_card16 (buffer, MAXIMUM_REQUEST_LENGTH, X_BYTE_ORDER_MSB, XDMCP_VERSION, &offset);
    write_card16 (buffer, MAXIMUM_REQUEST_LENGTH, X_BYTE_ORDER_MSB, XDMCP_Query, &offset);
    write_card16 (buffer, MAXIMUM_REQUEST_LENGTH, X_BYTE_ORDER_MSB, 1, &offset);
    write_card8 (buffer, MAXIMUM_REQUEST_LENGTH, 0, &offset);

    xdmcp_write (client, buffer, offset);   
}

Here is the call graph for this function:

Here is the caller graph for this function:

void xdmcp_client_send_request ( XDMCPClient client,
guint16  display_number,
GInetAddress **  addresses,
const gchar *  authentication_name,
const guint8 *  authentication_data,
guint16  authentication_data_length,
gchar **  authorization_names,
const gchar *  mfid 
)

Definition at line 321 of file xdmcp-client.c.

{
    guint8 buffer[MAXIMUM_REQUEST_LENGTH];
    gsize length = 0, offset = 0, n_addresses = 0, n_names = 0;
    GInetAddress **address;
    gchar **name;

    length = 11 + strlen (authentication_name) + authentication_data_length + strlen (mfid);
    for (address = addresses; *address; address++)
    {
        gssize native_address_length = g_inet_address_get_native_size (*address);
        length += 4 + native_address_length;
        n_addresses++;
    }
    for (name = authorization_names; *name; name++)
    {
        length += 2 + strlen (*name);
        n_names++;
    }

    write_card16 (buffer, MAXIMUM_REQUEST_LENGTH, X_BYTE_ORDER_MSB, XDMCP_VERSION, &offset);
    write_card16 (buffer, MAXIMUM_REQUEST_LENGTH, X_BYTE_ORDER_MSB, XDMCP_Request, &offset);
    write_card16 (buffer, MAXIMUM_REQUEST_LENGTH, X_BYTE_ORDER_MSB, length, &offset);

    write_card16 (buffer, MAXIMUM_REQUEST_LENGTH, X_BYTE_ORDER_MSB, display_number, &offset);
    write_card8 (buffer, MAXIMUM_REQUEST_LENGTH, n_addresses, &offset);
    for (address = addresses; *address; address++)
        write_card16 (buffer, MAXIMUM_REQUEST_LENGTH, X_BYTE_ORDER_MSB, 0, &offset); /* FamilyInternet */
    write_card8 (buffer, MAXIMUM_REQUEST_LENGTH, n_addresses, &offset);
    for (address = addresses; *address; address++)
    {
        gssize native_address_length;
        const guint8 *native_address;

        native_address_length = g_inet_address_get_native_size (*address);
        native_address = g_inet_address_to_bytes (*address);
        write_card16 (buffer, MAXIMUM_REQUEST_LENGTH, X_BYTE_ORDER_MSB, native_address_length, &offset);
        write_string8 (buffer, MAXIMUM_REQUEST_LENGTH, native_address, native_address_length, &offset);
    }
    write_card16 (buffer, MAXIMUM_REQUEST_LENGTH, X_BYTE_ORDER_MSB, strlen (authentication_name), &offset);
    write_string (buffer, MAXIMUM_REQUEST_LENGTH, authentication_name, &offset);
    write_card16 (buffer, MAXIMUM_REQUEST_LENGTH, X_BYTE_ORDER_MSB, authentication_data_length, &offset);
    write_string8 (buffer, MAXIMUM_REQUEST_LENGTH, authentication_data, authentication_data_length, &offset);
    write_card8 (buffer, MAXIMUM_REQUEST_LENGTH, n_names, &offset);
    for (name = authorization_names; *name; name++)
    {
        write_card16 (buffer, MAXIMUM_REQUEST_LENGTH, X_BYTE_ORDER_MSB, strlen (*name), &offset);
        write_string (buffer, MAXIMUM_REQUEST_LENGTH, *name, &offset);
    }
    write_card16 (buffer, MAXIMUM_REQUEST_LENGTH, X_BYTE_ORDER_MSB, strlen (mfid), &offset);
    write_string (buffer, MAXIMUM_REQUEST_LENGTH, mfid, &offset);

    xdmcp_write (client, buffer, offset);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void xdmcp_client_set_hostname ( XDMCPClient client,
const gchar *  hostname 
)

Definition at line 249 of file xdmcp-client.c.

{
    g_free (client->priv->host);
    client->priv->host = g_strdup (hostname);
}

Here is the caller graph for this function:

void xdmcp_client_set_port ( XDMCPClient client,
guint16  port 
)

Definition at line 256 of file xdmcp-client.c.

{
    client->priv->port = port;
}

Here is the caller graph for this function:

gboolean xdmcp_client_start ( XDMCPClient client)

Definition at line 262 of file xdmcp-client.c.

{
    GSocketConnectable *address;
    GSocketAddress *socket_address;
    GError *error = NULL;

    client->priv->socket = g_socket_new (G_SOCKET_FAMILY_IPV4, G_SOCKET_TYPE_DATAGRAM, G_SOCKET_PROTOCOL_UDP, &error);

    address = g_network_address_new (client->priv->host, client->priv->port);
    socket_address = g_socket_address_enumerator_next (g_socket_connectable_enumerate (address), NULL, NULL);
  
    if (!client->priv->socket ||
        !g_socket_connect (client->priv->socket, socket_address, NULL, &error) ||
        !g_io_add_watch (g_io_channel_unix_new (g_socket_get_fd (client->priv->socket)), G_IO_IN, xdmcp_data_cb, client))
    {
        g_warning ("Error creating XDMCP socket: %s", error->message);
        return FALSE;
    }

    client->priv->query_timer = g_timeout_add (2000, xdmcp_query_cb, client);
    xdmcp_query_cb (client); 

    return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function: