⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 httplib.h

📁 Http library for Palm, HTTP full implimentation include GET, POst,
💻 H
字号:
//---------------------------------------------------------------------//// http_lib - Http data exchanges mini library.//// USAGE:// UInt16 ret;// /* First load HTTPLib library */// Err err = HTTPLibNetOpen(...);// if (err == errNone)// {//   HTTPLibReqOpen(..., &ret, ...);//   /* Test return code (HTTP codes & network errors)//   if (ret == 200)//   {//     /* Loop on read *///     HTTPLibReqRead(...)////     HTTPLibReqClose(...);//   }//   HTTPLibNetClose(...);// }////---------------------------------------------------------------------// Library name for use with SysLibFind()#define HTTPLibName	   "Pat HTTP Library"// Values for use with SysLibLoad()#define HTTPLibCreator 'HttP'#define HTTPLibVersion 1//-----------------------------// HTTP return codes//-----------------------------#define HTTP_OK              200     // request completed#define HTTP_CREATED         201     // object created, reason = new URI#define HTTP_ACCEPTED        202     // async completion (TBS)#define HTTP_PARTIAL         203     // partial completion#define HTTP_NO_CONTENT      204     // no info to return#define HTTP_AMBIGUOUS       300     // server couldn't decide what to return#define HTTP_MOVED           301     // object permanently moved#define HTTP_REDIRECT        302     // object temporarily moved#define HTTP_REDIRECT_METHOD 303     // redirection w/ new access method#define HTTP_NOT_MODIFIED    304     // if-modified-since was not modified#define HTTP_BAD_REQUEST     400     // invalid syntax#define HTTP_DENIED          401     // access denied#define HTTP_PAYMENT_REQ     402     // payment required#define HTTP_FORBIDDEN       403     // request forbidden#define HTTP_NOT_FOUND       404     // object not found#define HTTP_BAD_METHOD      405     // method is not allowed#define HTTP_NONE_ACCEPTABLE 406     // no response acceptable to client found#define HTTP_PROXY_AUTH_REQ  407     // proxy authentication required#define HTTP_REQUEST_TIMEOUT 408     // server timed out waiting for request#define HTTP_CONFLICT        409     // user should resubmit with more info#define HTTP_GONE            410     // the resource is no longer available#define HTTP_AUTH_REFUSED    411     // couldn't authorize client#define HTTP_SERVER_ERROR    500     // internal server error#define HTTP_NOT_SUPPORTED   501     // required not supported#define HTTP_BAD_GATEWAY     502     // error response received from gateway#define HTTP_SERVICE_UNAVAIL 503     // temporarily overloaded#define HTTP_GATEWAY_TIMEOUT 504     // timed out waiting for gateway//-----------------------------// Socket & network errors//-----------------------------#define NET_HOST_NOT_FOUND    -1#define NET_SOCKET_CREATE     -2#define NET_SOCKET_CONNECT    -3#define NET_WRITE_HEADER      -4#define NET_WRITE_DATA        -5#define NET_READ_HEADER       -6#define NET_INVALID_ANSWER    -7#define NET_INVALID_LENGTH    -8#define NET_ALLOC_MEMORY      -9#define NET_READ_DATA        -10//-----------------------------// Library control functions//-----------------------------Err HTTPLibOpen(UInt16 refNum)                    SYS_TRAP(sysLibTrapOpen);Err HTTPLibClose(UInt16 refNum, UInt16 *numappsP) SYS_TRAP(sysLibTrapClose);Err HTTPLibSleep(UInt16 refNum)                   SYS_TRAP(sysLibTrapSleep);Err HTTPLibWake(UInt16 refNum)                    SYS_TRAP(sysLibTrapWake);//-----------------------------// Public functions prototypes//-----------------------------// Open the net libraryErr HTTPLibNetOpen(UInt16 refnum)    SYS_TRAP(sysLibTrapCustom);// Close the net libraryErr HTTPLibNetClose(UInt16 refnum)    SYS_TRAP(sysLibTrapCustom+1);// Send an HTTP Get Request and get resultsErr HTTPLibGet(UInt16 refnum, int *code, char *url, char **pdata, Int32 *plength, char *typebuf)    SYS_TRAP(sysLibTrapCustom+2);// Send an HTTP Get Request leave socket open for further access to contentErr HTTPLibReqOpen(UInt16 refnum, int *code, NetSocketRef *psr, char *url, Int32 *plength, char *typebuf)    SYS_TRAP(sysLibTrapCustom+3);// Read content from an open requestErr HTTPLibReqRead(UInt16 refnum, NetSocketRef *psr, char *pdata, Int32 *plength)    SYS_TRAP(sysLibTrapCustom+4);// Close socketErr HTTPLibReqClose(UInt16 refnum, NetSocketRef *psr)    SYS_TRAP(sysLibTrapCustom+5);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -