跳至內容

用戶:Antigng-bot/network.h

維基百科,自由的百科全書
#define BUFFERMAX (32668-sizeof(struct bucket *))
#define BUCKMAX 500000
#define TIMEOUT 120
#ifndef HOSTNAME
#define DEFAULTHOSTNAME "zh.wikipedia.org"
#endif
#ifndef bucket
struct bucket
{
	struct bucket *next;
	char content[BUFFERMAX+10];
};
#endif
#ifndef BUCKET
typedef struct bucket* BUCKET;
#endif
#ifndef http
struct http
{
	int buffnum;
	int buff;
	int error;
	int flag;
	BUCKET cur;
	BUCKET tail;
	BUCKET buffer;
	char *curtxt;
	char *curlast;
	char *tailtxt;
	char *last;
};
#endif
#ifndef HTTP
typedef struct http* HTTP;
#endif
int get(const char *url,unsigned short port,int lg,struct http *res);
int post(const char *url,const char *content,unsigned short port,int lg,struct http *res);
int smartpost(const char *url,struct http *content,const char *aft,unsigned short port,int lg,struct http *res);
int FORWARD (struct http *f);
char READ (struct http *f);
int hgets(char *buffer,int size,struct http *f);
struct http *hopen();
int WRITE(char c,struct http *f);
int hputs(const char *content,int length,struct http *f);
int hclose(struct http *f);
int hrewind(struct http *f);
int hlen(struct http *f);
int skipresponseheader(HTTP f,int enable);
int buckini(int count);
char SEQREAD(struct http *f);
int buckdestroy();
extern char cookie[];
extern char session[];
extern int sessionlength;
extern int cookielength;
#define hgetc(a) SEQREAD(a)
#define heof(f) f->error
#define hputc(a) WRITE(a)