VNC: First few lines of initialization code
This commit is contained in:
parent
e793ee2be5
commit
9b42bf65f0
@ -49,4 +49,8 @@ config VNCSERVER_KBDENCODE
|
|||||||
Use a special encoding of keyboard characters as defined in
|
Use a special encoding of keyboard characters as defined in
|
||||||
include/nuttx/input/kbd_coded.h.
|
include/nuttx/input/kbd_coded.h.
|
||||||
|
|
||||||
|
config VNCSERVER_IOBUFFER_SIZE
|
||||||
|
int "I/O buffer size
|
||||||
|
default 80
|
||||||
|
|
||||||
endif # VNCSERVER
|
endif # VNCSERVER
|
||||||
|
@ -47,6 +47,16 @@
|
|||||||
|
|
||||||
#include "vnc_server.h"
|
#include "vnc_server.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#if defined(CONFIG_VNCSERVER_PROTO3p3)
|
||||||
|
static const char g_vncproto[] = RFB_PROTOCOL_VERSION_3p3;
|
||||||
|
#elif defined(CONFIG_VNCSERVER_PROTO3p8)
|
||||||
|
static const char g_vncproto[] = RFB_PROTOCOL_VERSION_3p8;
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -93,13 +103,60 @@ static void nvc_xyz(FAR struct vnc_session_s *session)
|
|||||||
#ifdef CONFIG_VNCSERVER_PROTO3p3
|
#ifdef CONFIG_VNCSERVER_PROTO3p3
|
||||||
int vnc_negotiate(FAR struct vnc_session_s *session)
|
int vnc_negotiate(FAR struct vnc_session_s *session)
|
||||||
{
|
{
|
||||||
|
ssize_t nrecvd;
|
||||||
|
size_t len;
|
||||||
|
int errcode;
|
||||||
|
|
||||||
|
/* Inform the client of the VNC protocol */
|
||||||
|
|
||||||
|
len = strlen(g_vncproto);
|
||||||
|
nrecvd = psock_send(&session->connect, g_vncproto, len, 0);
|
||||||
|
if (nrecvd < 0)
|
||||||
|
{
|
||||||
|
goto errout_with_errno;
|
||||||
|
}
|
||||||
|
|
||||||
|
nrecvd = psock_recv(&session->connect, session->iobuf, len, 0);
|
||||||
|
if (nrecvd <= 0)
|
||||||
|
{
|
||||||
|
goto errout_with_errno;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Tell the client that we won't use any stinkin' security */
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
|
|
||||||
|
errout_with_errno:
|
||||||
|
errcode = get_errno();
|
||||||
|
|
||||||
|
errout_with_errcode:
|
||||||
|
DEBUGASSERT(errcode > 0);
|
||||||
|
return -errcode;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_VNCSERVER_PROTO3p8
|
#ifdef CONFIG_VNCSERVER_PROTO3p8
|
||||||
int vnc_negotiate(FAR struct vnc_session_s *session)
|
int vnc_negotiate(FAR struct vnc_session_s *session)
|
||||||
{
|
{
|
||||||
|
ssize_t nbytes;
|
||||||
|
|
||||||
|
/* Inform the client of the VNC protocol */
|
||||||
|
|
||||||
|
len = strlen(g_vncproto);
|
||||||
|
nrecvd = psock_send(&session->connect, g_vncproto, len, 0);
|
||||||
|
if (nrecvd < 0)
|
||||||
|
{
|
||||||
|
goto errout_with_errno;
|
||||||
|
}
|
||||||
|
|
||||||
|
nrecvd = psock_recv(&session->connect, session->iobuf, len, 0);
|
||||||
|
if (nrecvd <= 0)
|
||||||
|
{
|
||||||
|
goto errout_with_errno;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Offer the client a choice of security -- where None is the only option. */
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -75,12 +75,26 @@
|
|||||||
# define CONFIG_VNCSERVER_STACKSIZE 2048
|
# define CONFIG_VNCSERVER_STACKSIZE 2048
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_VNCSERVER_IOBUFFER_SIZE
|
||||||
|
# define CONFIG_VNCSERVER_IOBUFFER_SIZE 80
|
||||||
|
#endif
|
||||||
|
|
||||||
/* RFB Port Number */
|
/* RFB Port Number */
|
||||||
|
|
||||||
#define RFB_PORT_BASE 5900
|
#define RFB_PORT_BASE 5900
|
||||||
#define RFB_MAX_DISPLAYS CONFIG_VNCSERVER_NDISPLAYS
|
#define RFB_MAX_DISPLAYS CONFIG_VNCSERVER_NDISPLAYS
|
||||||
#define RFB_DISPLAY_PORT(d) (RFB_PORT_BASE + (d))
|
#define RFB_DISPLAY_PORT(d) (RFB_PORT_BASE + (d))
|
||||||
|
|
||||||
|
/* Miscellaneous */
|
||||||
|
|
||||||
|
#ifndef MIN
|
||||||
|
# define MIN(a,b) (((a) < (b)) ? (a) : (b))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef MAX
|
||||||
|
# define MAX(a,b) (((a) > (b)) ? (a) : (b))
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Types
|
* Public Types
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -115,6 +129,10 @@ struct vnc_session_s
|
|||||||
uint8_t bpp; /* Bits per pixel */
|
uint8_t bpp; /* Bits per pixel */
|
||||||
struct nxgl_size_s screen; /* Size of the screen in pixels x rows */
|
struct nxgl_size_s screen; /* Size of the screen in pixels x rows */
|
||||||
FAR uint8_t *fb; /* Allocated local frame buffer */
|
FAR uint8_t *fb; /* Allocated local frame buffer */
|
||||||
|
|
||||||
|
/* I/O buffer for misc network send/receive */
|
||||||
|
|
||||||
|
uint8_t iobuf[CONFIG_VNCSERVER_IOBUFFER_SIZE];
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
Loading…
Reference in New Issue
Block a user