//#include <winsock2.h>

typedef  unsigned int    uint;
typedef  unsigned long   ulong;
#define  TKNAME(a,b,c,d) (((d)<<24)|((c)<<16)|((b)<<8)|(a))
#include "sloppidef.h"

#define  BUFFER_SIZE 102400

typedef	struct
  {
    char    Name[50];
    char    Type[50];
    char    Help[1024];
    char    Tabs[50];
    int	    Size;
    char    NVRamContent[200];
    BOOL    New;
  } MODE;


typedef enum
{
   NOTAB,              
   INFORMATION,           
   CONTROL,               
   ADVANCEDCONTROL,      
   INTERNAL,
   TEXT,                  
   CLOCK,                 
   BARCODERESPONSE,      
   TOUCHSCREEN,           
   PERIPHERAL,            
   ADVANCEDPERIPHERAL,   
   PIPCONTROL,           
   ADVANCEDPIPCONTROL,
   UNITNETWORKSETUP,    
   PIPSERVERSETUP,      
   IMAGESERVERSETUP,    
   WIRELESS,              
}GROUPS;

typedef enum
{
    SR_NONE,
    SR_TRUE,
    SR_FALSE
}SENDRESPONSE;

extern   SLPACKET   *pkt;
extern   MODE       mode[];

extern   int	    NumberOfModes;
extern   BOOL	    SendError;
extern   BOOL	    SendResponse;


BOOL    RecvPacket( SLPACKET *pkt );
BOOL    SendPacket( SLPACKET *pkt, char *ModeName );
short   InitModeArray ( void );
int     GetNameIndex( LPCTSTR name );
void    ClearTrailingWhiteSpace( char *content );
int     enumVal( char *TrueFalse );

short   PushBuffer( LPCTSTR IPAddress, char *Buffer, char *TargetFileName );
short   PushFile( LPCTSTR IPAddress, LPCTSTR File, LPCTSTR TargetFileName );
short   connectUnit( LPCTSTR IPAddress );
BOOL    disconnectUnit( void );
BOOL    getMode( LPCTSTR ModeName, LPTSTR Buffer, long Buffer_size );
BOOL    getModeType( LPCTSTR ModeName, LPTSTR Buffer, long Buffer_size );
BOOL    getFirstModeName( LPTSTR Buffer, long Buffer_size );
BOOL    getNextModeName( LPTSTR Buffer, long Buffer_size );
BOOL    getNVRamMode( LPCTSTR ModeName, LPTSTR Buffer, long Buffer_size );
BOOL    getModeHelp( LPCTSTR ModeName, LPTSTR Buffer, long Buffer_size );
BOOL    sendPacket( char *pkt, size_t size );

