📄 wspp.h
字号:
#ifndef _WSPP_H#define _WSPP_H/* $Id: wspp.h,v 1.21 2004/09/08 09:33:56 jombart Exp $ */#include <stdlib.h>#include <stdio.h>#include <sys/types.h>#include <unistd.h>/*#define DEBUG*/#define WSPP_VERSION "0.2"/* WSP constants */#define ACCEPT 0x80#define ACCEPT_TOUT 0x00#define WSP_METHOD 0x01#define PDU_REPLY 0x04#define WSP_OK 0x20#define WSP_GET 0x40#define WSP_HEAD 0x42#define WSP_TRACE 0x44#define WSP_DELETE 0x43#define WSP_POST 0x60#define WSP_PUT 0x61#define WSP_OPTIONS 0x41#define USER_AGENT 0xA9#define HEADER_VIA "Via: WSP (WSPP proxy) v" WSPP_VERSION#define WSP_HEADER_LEN 3 /* should be ok */#define DEFAULT_UA "Nokia3650/1.0 SymbianOS/6.1 Series60/1.2 Profile/MIDP-1.0 Configuration/CLDC-1.0"/*Nokia7110Nokia6210Nokia6210/1.0 (03.04)Nokia9110Nokia9110/1.0Nokia-WAP-Toolkit/1.3betaNokia-WAP-Toolkit/2.1Nokia7110 (DeckIt/1.0)Nokia 6210 v0.13 (compatible; YOSPACE SmartPhone Emulator 1.2)EricssonT20EricssonT20/R2A*//* HTTP constants */#define MIME_TYPE_WAP "Content-Type: text/vnd.wap.wml\n\n"#define HTTP_ERROR_CODE 500#define HTTP_INTERNAL_ERROR "HTTP/1.0 500 Internal Server Error\n"#define INTERNAL_ERROR_BODY "\n<html><head><title>Internal Server Error</title></head>\n<body><br>\nAn error occured on the WSPP proxy.<br>\nThis can be a non implemented function.<br><br>Error code received by gateway was %d.<br>\n</body></html>\n"/* WSPP constants */#define BACKLOG 6#define LOCALHOST "localhost"#define INITIAL_BUF_SIZE 512#define WRTRDL 1024#define DEFAULT_GW_PORT 9200#define DEFAULT_LISTEN_PORT 8000#define MAX_RESPONSE 64000#define HEADER_LEN 1024#define MAX_URI_LEN 1024#define PARSE_OK 0xFF#define PARSE_ERROR -1#define PARSE_TODO 0#define PARSE_POST_TODO 2#define PARSE_OKTOCLOSE 3#define PARSE_POST_DATA 4#define PARSE_HEADER_TODO 5typedef struct { int status; int header_length; int contenttype; char *contenttype_string; int charset; char *headers; char *data; int data_length;} wsp_reply;typedef struct { int code; char status[32]; char *headers; char *data; int data_length;} http;typedef struct { int parse_state; char method; char *uri; char *headers; char *data; int content_length; int data_length;} request;/* prototypes */void usage();int from_uintvar (char *, int, int);int uintvar(char *, int);int uintvar_len(int);char * dgetln(int, ssize_t *);void wsp_packet(char *, char *, char);char * wsp(request *, int *);int parse_req(request *, char *);int do_wap(const char *, char *, int, char *, int);int parse_wsp (wsp_reply *, unsigned char *, int);void wsp_to_http (http *, const wsp_reply *);char * contentt(int);char from_ctype(char *);char * header(int);char headercode(const char *);char * restrcat(char *, const char *);void error500(http *, int);char * extime(char *, int);int http_code(char);char * expand_http_code(int);#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && \ !defined(__bsdi__) && !defined(__APPLE__)size_t strlcpy(char *, const char *, size_t);#endif#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -