#ifndef protcol_h
#define protcol_h
// #include "sSource.h"
#include "misc.h"

extern const unsigned char OP_GLOBSERVSTATREQ;

#define CO_RANG_RES		0x60	// C-E-TCP (Client Emule)	<RANG 2>
#define CO_COMMENT 		0x61	// C-E-TCP (0xC5 file comment)
#define CO_LOGIN                0x64	// G-C	(GUI-CORE)
#define CO_STOP                 0x65	// G-C
#define CO_CMD                  0x66	// G-C
// UDP-SERVER {
extern const unsigned char OP_GLOBSERVSTATREQ;	// C-S-UDP      // Ping Request
extern const unsigned char OP_GLOBSERVSTATRES;	// C-S-UDP	// Ping Answer
// }

extern char 		*client_name;
extern unsigned char 	client_hash[16];
// extern sFile *file_list;
extern char *incoming;

/* unique numbers for download status */
enum {
	STATUS_HASHING=0,
	STATUS_QUEUED=1,
	STATUS_LOOKING,
	STATUS_DOWNLOADING,
	STATUS_PAUSED,
	STATUS_IDS,
	STATUS_NOSRCS,
	STATUS_DONE,
	STATUS_HASHING2,
	STATUS_ERRLOADING,
	STATUS_COMPLETING,
	STATUS_COMPLETE,
	STATUS_CORRUPTED,
	STATUS_ERRHASHING,
	STATUS_TRANSFERRING,
	STATUS_RESUMING,
	STATUS_PAUSING
	} ;
/*
SEARCH   ::= 	0x00 <OPERATOR> <SEARCH> <SEARCH>
	   	0x01 <STRING> <META_TAG_NAME>
	   	0x02 <META_TAG>
	   	0x03 <DWORD> <MINMAX> <META_TAG>
OPERATOR ::=	0x00 // AND
		0x01 // OR
		0x02 // NOT AND
MINMAX   ::=	0x01 // MIN
		0x02 // MAX
*/

/*
bool     UDP_req_server_list    (void);
bool     UDP_next_ping	    	(					);// (0x96)
bool     UDP_search4gui         (const sGui *gui   );
bool     UDP_req_sources        (in_addr ip,uint16_t port, const unsigned char *HASH);// (0x9A)
int      UDP_Parse       	(unsigned char *data, int len,struct sockaddr_in *addr);
*/
class cSocket;
bool     logSend	(char prefix, const cSocket *sock, unsigned short cmd, bool own_info);
bool	 split_link	(const char *Link);

class sTag *parseTag 		(class sPacket *packet);

#endif
// vim:fdm=marker
	
