Chinaunix首页 | 论坛 | 博客
  • 博客访问: 270500
  • 博文数量: 105
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 382
  • 用 户 组: 普通用户
  • 注册时间: 2014-11-07 17:00
个人简介

技术源于折腾,精于积累!

文章分类

全部博文(105)

文章存档

2018年(2)

2016年(3)

2015年(92)

2014年(8)

我的朋友

分类: 嵌入式

2015-01-08 16:57:00


点击(此处)折叠或打开

  1. typedef struct {
  2.     char            host[64];                /* Host name */
  3.     ringq_t            inBuf;                    /* Input ring queue */
  4.     ringq_t            outBuf;                    /* Output ring queue */
  5.     ringq_t            lineBuf;                /* Line ring queue */
  6.     socketAccept_t    accept;                    /* Accept handler */
  7.     socketHandler_t    handler;                /* User I/O handler */
  8.     int                handler_data;            /* User handler data */
  9.     int                handlerMask;            /* Handler events of interest */
  10.     int                sid;                    /* Index into socket[] */
  11.     int                port;                    /* Port to listen on */
  12.     int                flags;                    /* Current state flags */
  13.     int                sock;                    /* Actual socket handle */
  14.     int                fileHandle;                /* ID of the file handler */
  15.     int                interestEvents;            /* Mask of events to watch for */
  16.     int                currentEvents;            /* Mask of ready events (FD_xx) */
  17.     int                selectEvents;            /* Events being selected */
  18.     int                saveMask;                /* saved Mask for socketFlush */
  19.     int                error;                    /* Last error */
  20. } socket_t;


typedef void (*socketHandler_t)(int sid, int mask, int data);
typedef int (*socketAccept_t)(int sid, char *ipaddr, int port, 
int listenSid);

socket_t结构体链表用于保存从sock层接收的数据!


点击(此处)折叠或打开

  1. typedef struct websRec {
  2.     ringq_t            header;                /* Header dynamic string */
  3.     time_t            since;                /* Parsed if-modified-since time */
  4.     sym_fd_t        cgiVars;            /* CGI standard variables */
  5.     sym_fd_t        cgiQuery;            /* CGI decoded query string */
  6.     time_t            timestamp;            /* Last transaction with browser */
  7.     int                timeout;            /* Timeout handle */
  8.     char_t            ipaddr[32];            /* Connecting ipaddress */
  9.     char_t            ifaddr[32];            /* Local interface ipaddress */
  10.     char_t            type[64];            /* Mime type */
  11.     char_t            *dir;                /* Directory containing the page */
  12.     char_t            *path;                /* Path name without query */
  13.     char_t            *url;                /* Full request url */
  14.     char_t            *host;                /* Requested host */
  15.     char_t            *lpath;                /* Cache local path name */
  16.     char_t            *query;                /* Request query */
  17.     char_t            *decodedQuery;        /* Decoded request query */
  18.     char_t            *authType;            /* Authorization type (Basic/DAA) */
  19.     char_t            *password;            /* Authorization password */
  20.     char_t            *userName;            /* Authorization username */
  21.     char_t            *cookie;            /* Cookie string */
  22.     char_t            *userAgent;            /* User agent (browser) */
  23.     char_t            *protocol;            /* Protocol (normally HTTP) */
  24.     char_t            *protoVersion;        /* Protocol version */
  25.     int                sid;                /* Socket id (handler) */
  26.     int                listenSid;            /* Listen Socket id */
  27.     int                port;                /* Request port number */
  28.     int                state;                /* Current state */
  29.     int                flags;                /* Current flags -- see above */
  30.     int                code;                /* Request result code */
  31.     int                clen;                /* Content length */
  32.     int                wid;                /* Index into webs */
  33.     char_t            *cgiStdin;            /* filename for CGI stdin */
  34.     int                docfd;                /* Document file descriptor */
  35.     int                numbytes;            /* Bytes to transfer to browser */
  36.     int                written;            /* Bytes actually transferred */
  37.     int                has_firmware_upload_clean; /* flag for firmware upload */
  38.     void            (*writeSocket)(struct websRec *wp);
  39. #ifdef DIGEST_ACCESS_SUPPORT
  40.     char_t            *realm;        /* usually the same as "host" from websRec */
  41.     char_t            *nonce;        /* opaque-to-client string sent by server */
  42.     char_t            *digest;    /* digest form of user password */
  43.     char_t            *uri;        /* URI found in DAA header */
  44.     char_t            *opaque;    /* opaque value passed from server */
  45.     char_t            *nc;        /* nonce count */
  46.     char_t            *cnonce;    /* check nonce */
  47.     char_t            *qop;        /* quality operator */
  48. #endif
  49. #ifdef WEBS_SSL_SUPPORT
  50.     websSSL_t        *wsp;        /* SSL data structure */
  51. #endif
  52. } websRec;

  53. typedef websRec    *webs_t;
  54. typedef websRec websType;
webs_t web层数据结构!



/*
 * Ring queue buffer structure
 */
typedef struct {
unsigned char *buf; /* Holding buffer for data */
unsigned char *servp; /* Pointer to start of data */
unsigned char *endp; /* Pointer to end of data */
unsigned char *endbuf; /* Pointer to end of buffer */
int buflen; /* Length of ring queue */
int maxsize; /* Maximum size */
int increment; /* Growth increment */
} ringq_t;

阅读(1585) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~