Commit f9d615c2 authored by Thijs Vermeir's avatar Thijs Vermeir

gst/librfb/rfbdecoder.*: Added some documentation about security handling...

gst/librfb/rfbdecoder.*: Added some documentation about security handling start implementing security handling for rf...

Original commit message from CVS:
* gst/librfb/rfbdecoder.c:
* gst/librfb/rfbdecoder.h:
Added some documentation about security handling
start implementing security handling for rfb 3.3
parent c364c7d6
2007-09-18 Thijs Vermeir <thijsvermeir@gmail.com>
* gst/librfb/rfbdecoder.c:
* gst/librfb/rfbdecoder.h:
Added some documentation about security handling
start implementing security handling for rfb 3.3
2007-09-18 Stefan Kost <ensonic@users.sf.net>
* gst/spectrum/demo-audiotest.c:
......
......@@ -253,21 +253,55 @@ rfb_decoder_state_wait_for_protocol_version (RfbDecoder * decoder)
return TRUE;
}
/**
* a string describing the reason (where a string is specified as a length followed
* by that many ASCII characters)
**/
static gboolean
rfb_decoder_state_reason (RfbDecoder * decoder)
{
/* \TODO Read the reason from the server why he quits */
return TRUE;
}
static gboolean
rfb_decoder_state_wait_for_security (RfbDecoder * decoder)
{
RfbBuffer *buffer;
gint ret;
ret = rfb_bytestream_read (decoder->bytestream, &buffer, 4);
if (ret < 4)
return FALSE;
decoder->security_type = RFB_GET_UINT32 (buffer->data);
// g_print ("security = %d\n", decoder->security_type);
rfb_buffer_free (buffer);
/**
* Version 3.3 The server decides the security type and sends a single word
*
* The security-type may only take the value 0, 1 or 2. A value of 0 means that the
* connection has failed and is followed by a string giving the reason, as described
* above.
*/
if (decoder->protocol_major == 3 && decoder->protocol_minor == 3) {
ret = rfb_bytestream_read (decoder->bytestream, &buffer, 4);
if (ret < 4)
return FALSE;
decoder->security_type = RFB_GET_UINT32 (buffer->data);
GST_DEBUG ("security = %d", decoder->security_type);
g_return_val_if_fail (decoder->security_type < 3, FALSE);
g_return_val_if_fail (decoder->security_type != SECURITY_FAIL,
rfb_decoder_state_reason (decoder));
rfb_buffer_free (buffer);
}
switch (decoder->security_type) {
case SECURITY_NONE:
GST_DEBUG ("Security type is None");
break;
case SECURITY_VNC:
GST_DEBUG ("Security type is VNC Authentication");
/* \TODO Check if for the correct password */
break;
default:
break;
}
decoder->state = rfb_decoder_state_send_client_initialisation;
return TRUE;
}
......
......@@ -6,6 +6,12 @@
G_BEGIN_DECLS
enum {
SECURITY_FAIL = 0,
SECURITY_NONE,
SECURITY_VNC,
};
typedef struct _RfbDecoder RfbDecoder;
struct _RfbDecoder
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment