RT1050 GUI demo using emWin library

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers GUI_VNC.h Source File

GUI_VNC.h

00001 /*********************************************************************
00002 *                SEGGER Microcontroller GmbH & Co. KG                *
00003 *        Solutions for real time microcontroller applications        *
00004 **********************************************************************
00005 *                                                                    *
00006 *        (c) 1996 - 2016  SEGGER Microcontroller GmbH & Co. KG       *
00007 *                                                                    *
00008 *        Internet: www.segger.com    Support:  support@segger.com    *
00009 *                                                                    *
00010 **********************************************************************
00011 
00012 ** emWin V5.38 - Graphical user interface for embedded applications **
00013 All  Intellectual Property rights  in the Software belongs to  SEGGER.
00014 emWin is protected by  international copyright laws.  Knowledge of the
00015 source code may not be used to write a similar product.  This file may
00016 only be used in accordance with the following terms:
00017 
00018 The software has been licensed to  NXP Semiconductors USA, Inc.  whose
00019 registered  office  is  situated  at 411 E. Plumeria Drive, San  Jose,
00020 CA 95134, USA  solely for  the  purposes  of  creating  libraries  for
00021 NXPs M0, M3/M4 and  ARM7/9 processor-based  devices,  sublicensed  and
00022 distributed under the terms and conditions of the NXP End User License
00023 Agreement.
00024 Full source code is available at: www.segger.com
00025 
00026 We appreciate your understanding and fairness.
00027 ----------------------------------------------------------------------
00028 Licensing information
00029 
00030 Licensor:                 SEGGER Microcontroller Systems LLC
00031 Licensed to:              NXP Semiconductors, 1109 McKay Dr, M/S 76, San Jose, CA 95131, USA
00032 Licensed SEGGER software: emWin
00033 License number:           GUI-00186
00034 License model:            emWin License Agreement, dated August 20th 2011
00035 Licensed product:         -
00036 Licensed platform:        NXP's ARM 7/9, Cortex-M0,M3,M4
00037 Licensed number of seats: -
00038 ----------------------------------------------------------------------
00039 File        : GUI_VNC.h
00040 Purpose     : Publics for the VNC server
00041 ---------------------------END-OF-HEADER------------------------------
00042 
00043 Attention : Do not modify this file ! If you do, you will not
00044             be able do update to a later GUI version !
00045 
00046 */
00047 
00048 #ifndef  GUI_VNC_H
00049 #define  GUI_VNC_H
00050 
00051 #include "GUI_Private.h"
00052 #include "GUI_Type.h"
00053 #include "IP_FS.h"
00054 
00055 #if defined(__cplusplus)
00056 extern "C" {     /* Make sure we have C-declarations in C++ programs */
00057 #endif
00058 
00059 /*********************************************************************
00060 *
00061 *       Defines
00062 *
00063 **********************************************************************
00064 */
00065 #define GUI_VNC_NO_ERROR            0
00066 #define GUI_VNC_ERROR_MISC          1
00067 #define GUI_VNC_ERROR_WRONGFORMAT   2
00068 
00069 #define GUI_DES_ENCRYPT 0
00070 #define GUI_DES_DECRYPT 1
00071 
00072 //
00073 // File transfer
00074 //
00075 #define GUI_VNC_SUPPORT_FILETRANSFER 0x10
00076 
00077 //
00078 // Extension message (used for file transfer)
00079 //
00080 #define RFB_EXTENSION 0xFCul
00081 
00082 //
00083 // File transfer protocol
00084 //
00085 #define RFBX_FILE_LIST_REQUEST      (0x000102ul | (RFB_EXTENSION << 24))
00086 #define RFBX_FILE_LIST_REPLY        (0x000103ul | (RFB_EXTENSION << 24))
00087 #define RFBX_UPLOAD_START_REQUEST   (0x000106ul | (RFB_EXTENSION << 24))
00088 #define RFBX_UPLOAD_START_REPLY     (0x000107ul | (RFB_EXTENSION << 24))
00089 #define RFBX_UPLOAD_DATA_REQUEST    (0x000108ul | (RFB_EXTENSION << 24))
00090 #define RFBX_UPLOAD_DATA_REPLY      (0x000109ul | (RFB_EXTENSION << 24))
00091 #define RFBX_UPLOAD_END_REQUEST     (0x00010Aul | (RFB_EXTENSION << 24))
00092 #define RFBX_UPLOAD_END_REPLY       (0x00010Bul | (RFB_EXTENSION << 24))
00093 
00094 #define RFBX_DOWNLOAD_START_REQUEST (0x00010Cul | (RFB_EXTENSION << 24))
00095 #define RFBX_DOWNLOAD_START_REPLY   (0x00010Dul | (RFB_EXTENSION << 24))
00096 #define RFBX_DOWNLOAD_DATA_REQUEST  (0x00010Eul | (RFB_EXTENSION << 24))
00097 #define RFBX_DOWNLOAD_DATA_REPLY    (0x00010Ful | (RFB_EXTENSION << 24))
00098 #define RFBX_DOWNLOAD_END_REPLY     (0x000110ul | (RFB_EXTENSION << 24))
00099 #define RFBX_MKDIR_REQUEST          (0x000111ul | (RFB_EXTENSION << 24))
00100 #define RFBX_MKDIR_REPLY            (0x000112ul | (RFB_EXTENSION << 24))
00101 #define RFBX_REMOVE_REQUEST         (0x000113ul | (RFB_EXTENSION << 24))
00102 #define RFBX_REMOVE_REPLY           (0x000114ul | (RFB_EXTENSION << 24))
00103 #define RFBX_RENAME_REQUEST         (0x000115ul | (RFB_EXTENSION << 24))
00104 #define RFBX_RENAME_REPLY           (0x000116ul | (RFB_EXTENSION << 24))
00105 
00106   /*********************************************************************
00107 *
00108 *       Types
00109 *
00110 **********************************************************************
00111 */
00112 typedef struct {
00113   U8 * pBuffer;
00114   int  BufferSize;
00115   int  NumBytesInBuffer;
00116 } BUFFER_CB;
00117 
00118 typedef struct GUI_VNC_CONTEXT {
00119   GUI_DEVICE * pDevice;
00120   struct GUI_VNC_CONTEXT * pNext;
00121   int LayerIndex;
00122   int BytesPerPixel;
00123   int BitsPerPixel;  // Note, that from within the VNC server the function LCD_GetBitsBerPixel() can not be used because the VNC server runs in a separate thread and the device chain can change during the function call
00124   //
00125   // Connection related data
00126   //
00127   GUI_tSend    pfSend;
00128   GUI_tRecv    pfReceive;
00129   void       * pConnectInfo;
00130   U16          ServerIndex;
00131   //
00132   // Display related info
00133   //
00134   int x0Dirty, y0Dirty, x1Dirty, y1Dirty;
00135   int xSize, ySize;
00136   int xOrg, yOrg, xOrgNew, yOrgNew;
00137   //
00138   // Status
00139   //
00140   char ClientSupportsHextile;
00141   char IsBigEndian;
00142   char OrgLock;
00143   char BkFlag;
00144   //
00145   // Pointer to buffer
00146   //
00147   U8 * pBuffer;
00148   unsigned SizeOfBuffer;
00149   int (* pfStoreU8)  (struct GUI_VNC_CONTEXT * pContext, BUFFER_CB * pBCB, U8 Data);
00150   int (* pfStoreU16) (struct GUI_VNC_CONTEXT * pContext, BUFFER_CB * pBCB, U16 Data);
00151   int (* pfStoreU32) (struct GUI_VNC_CONTEXT * pContext, BUFFER_CB * pBCB, U32 Data);
00152   int (* pfStoreData)(struct GUI_VNC_CONTEXT * pContext, BUFFER_CB * pBCB, const U8 * pData, int NumBytes);
00153   int (* pfFlush)    (struct GUI_VNC_CONTEXT * pContext, BUFFER_CB * pBCB);
00154   int (* pfRead)     (struct GUI_VNC_CONTEXT * pContext, U8 * pBuffer, int Len);
00155 } GUI_VNC_CONTEXT;
00156 
00157 typedef struct {
00158   void (* pfGetChallenge)(U8 * pChallenge);
00159   void (* pfGetResponse )(U8 * pResponse );
00160 } GUI_VNC_AUTHENTICATION;
00161 
00162 /*********************************************************************
00163 *
00164 *       Private Functions
00165 *
00166 **********************************************************************
00167 */
00168 void GUI_VNC_SetDESKey(U8 * pKey, int Mode);
00169 void GUI_VNC_DoDES    (U8 * pInblock, U8 * pOutblock);
00170 
00171 /*********************************************************************
00172 *
00173 *       Public Functions
00174 *
00175 **********************************************************************
00176 */
00177 void GUI_VNC_AttachToLayer      (GUI_VNC_CONTEXT * pContext, int LayerIndex);
00178 void GUI_VNC_EnableKeyboardInput(int OnOff);
00179 void GUI_VNC_EnableMouseInput   (int OnOff);
00180 void GUI_VNC_EnableFileTransfer (unsigned OnOff);
00181 int  GUI_VNC_GetNumConnections  (void);
00182 int  GUI_VNC_Process            (GUI_VNC_CONTEXT * pContext, GUI_tSend pfSend, GUI_tRecv pfReceive, void * pConnectInfo);
00183 void GUI_VNC_RingBell           (void);
00184 void GUI_VNC_SetAuthentication  (GUI_VNC_AUTHENTICATION * pAuthentication);
00185 void GUI_VNC_SetPassword        (U8 * sPassword);
00186 void GUI_VNC_SetProgName        (const char * sProgName);
00187 void GUI_VNC_SetSize            (unsigned xSize, unsigned ySize);
00188 void GUI_VNC_SetLockFrame       (unsigned OnOff);
00189 void GUI_VNC_SetRetryCount      (unsigned Cnt);
00190 void GUI_VNC_SetFS_API          (const IP_FS_API * pFS_API);
00191 
00192 //
00193 // Private function for setting file transfer handler
00194 //
00195 void GUI_VNC__SetRFBExtensionHandler(int (* pFunc)(U32, GUI_VNC_CONTEXT *, BUFFER_CB *));
00196 
00197 //
00198 // External routine to link the server to the system ... USER defined !
00199 //
00200 int  GUI_VNC_X_StartServer  (int LayerIndex, int ServerIndex);
00201 int  GUI_VNC_X_StartServerFT(int LayerIndex, int ServerIndex);
00202 void GUI_VNC_X_getpeername  (U32 * Addr);
00203 
00204 #if defined(__cplusplus)
00205   }
00206 #endif
00207 
00208 #endif   /* Avoid multiple inclusion */
00209 
00210 /*************************** End of file ****************************/