/**************************/
/*		  ITP v1.1        */
/*	   made by iserdo     */
/*	  iserdo@gmail.com    */
/**************************/

typedef struct _data_s
{
	char			*ptr;		/* pointer to allocated memory */
	unsigned short	len;		/* message len in memory */
} data_s;

typedef struct _indata_s
{
	data_s			memd;		/* memory for data */
	unsigned short	d_len;		/* total data len that has to be received */
	char			b_len[2];	/* buffer for saving incomplete stream telling data len */
	int				b_len_len;	/* len of data in b_len */
	TIMEVAL			*tv;
} indata_s;




#define IPROTO_DEAD		-1
#define IPROTO_AVAIL	1
#define IPROTO_NN		0

/* 
this function return is:
IPROTO_DEAD = connection dropped
IPROTO_NN = nothing new
IPROTO_AVAIL = new data avaliable to be parsed
*/
int  iproto_recv(indata_s *data, SOCKET sock);

void iproto_data_reset(indata_s *data);

void iproto_send(char *data, unsigned short len, char code, SOCKET sock);





