📄 cms_wsp2wtp.c
字号:
/******************************************************************************
C M O D U L E F I L E
(c) Copyright MobileSoft Technology (NanJing) Co., LTD. 2001-2002
ALL RIGHTS RESERVED
*******************************************************************************
Project Name: WAP STACK Ver1.20
Written By : MobileSoft Technology
File Name : Cms_Malloc.c
Last Modify : 06/22/2002
******************************************************************************/
#include "Cms_WTP.h"
#include "Cms_WSP2WTP.h"
#include "Cms_WSP.h"
#include "Cms_WAPGWLIB.h"
CMS_VOID octstr_append_uint8(Octstr *os, CMS_U32 uintdata)
{
CMS_U8 c;
c = (CMS_U8) uintdata;
octstr_insert_data(os, octstr_len(os), (P_CMS_U8)&c, 1);
}
CMS_VOID octstr_append_uintvar(Octstr *pdu, CMS_S64 n)
{
CMS_S64 bytes[5];
CMS_U64 u;
CMS_S32 i;
u = n;
for (i = 4; i >= 0; --i)
{
bytes[i] = u & 0x7F;
u >>= 7;
}
for (i = 0; i < 4 && bytes[i] == 0; ++i)
{
continue;
}
for (; i < 4; ++i)
{
octstr_append_uint8(pdu, (CMS_U32)(0x80 | bytes[i]));
}
octstr_append_uint8(pdu, (CMS_U32)bytes[4]);
}
/*从浏览器得到的事件*/
WSPEvent * WSPCreateSConnectRequest(CMS_VOID)
{
WSPEvent * event;
event = wsp_event_create(SConnectRequest);
return event ;
}
WSPEvent * WSPCreateSMethodInvokeRequest(CMS_S32 method_type, P_CMS_U8 url, HTTPHeader *headers, P_CMS_U8 content_type, P_CMS_U8 data, CMS_U32 dataLen)
{
WSPEvent * event;
event = wsp_event_create(SMethodInvokeRequest);
event->SMethodInvokeRequest.method_type = method_type;
event->SMethodInvokeRequest.url = octstr_create(url);
if (method_type > 0x41)
{
/* event->SMethodInvokeRequest.content_type = octstr_create((P_CMS_U8)"Content-Type: application/x-www-form-urlencoded"); */
if (content_type)
{
event->SMethodInvokeRequest.content_type = octstr_create_from_data((P_CMS_U8)content_type,1);
}
event->SMethodInvokeRequest.data = octstr_create_empty();
event->SMethodInvokeRequest.data->data = data;
event->SMethodInvokeRequest.data->len = dataLen;
}
return event;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -