APIs
[HTTP Library]


Helper APIs

AlpHttpString alp_http_authinfo_pass (AlpHttpAuthInfoHandle self)
 Return the password stored in the authentication structure as AlpHttpString in the return value. The obtained AlpHttpString of the password should not be released on the calling side.
AlpHttpString alp_http_authinfo_realm (AlpHttpAuthInfoHandle self)
 Return the realm stored in the authentication structure as AlpHttpString in the return value.The obtained HTTPLibString of the realm should not be released on the calling side.
void alp_http_authinfo_tidy (AlpHttpAuthInfoHandle self, int in_new)
 Initializes/ends the authentication information structure.
AlpHttpString alp_http_authinfo_user (AlpHttpAuthInfoHandle self)
 Return the username stored in the authentication structure as AlpHttpString in the return value. The obtained AlpHttpString of the username should not be released on the calling side.
void alp_http_cert_delete (AlpHttpCertPtr in_cert)
 Delete the Cert instance.
AlpHttpCertPtr alp_http_cert_new (void)
 Create a new Cert instance.
int alp_http_cert_peek_issuer_rdn (AlpHttpCertPtr in_cert, int in_attr, char *out_str, int in_len)
 Get attribute of cert's isser DN.
int alp_http_cert_peek_rsapublickeybits (AlpHttpCertPtr in_cert)
 Get cert's public key bits.
int alp_http_cert_peek_serialnumber (AlpHttpCertPtr in_cert, char **out_str)
 Get cert's serial number.
int alp_http_cert_peek_signalgo (AlpHttpCertPtr in_cert, char *out_buf, int in_len)
 Get cert's sign algorithm.
int alp_http_cert_peek_subject_rdn (AlpHttpCertPtr in_cert, int in_attr, char *out_str, int in_len)
 Get attribute of cert's subject DN.
int alp_http_cert_peek_validityend (AlpHttpCertPtr in_cert, AlpHttpDate *out_time)
 Get cert's validity end date.
int alp_http_cert_peek_validitystart (AlpHttpCertPtr in_cert, AlpHttpDate *out_time)
 Get cert's validity start date.
int alp_http_cert_peek_version (AlpHttpCertPtr in_cert)
 Get cert's version.
int alp_http_certlist_begindecode (AlpHttpCertList self, int in_index, AlpHttpCertPtr *out_cert)
 Start decoding the certificate of the specified element number. It must call alp_http_certlist_enddecode when decoding ends.
AlpHttpCertList alp_http_certlist_clone (AlpHttpCertList self)
 Copy a AlpHttpCertList instance and returns its handle.
void alp_http_certlist_delete (AlpHttpCertList self)
 Delete AlpHttpCertList instance.
void alp_http_certlist_enddecode (AlpHttpCertList self, AlpHttpCertPtr in_cert)
 End the decoding of the certificate started by alp_http_certlist_begindecode().
int alp_http_certlist_importcert (AlpHttpCertList self, void *in_info, int in_over_write)
 Register a certificate in the certificate DB.
int alp_http_certlist_length (AlpHttpCertList self)
 Return the length of AlpHttpCertList.
void * alp_http_certlist_lock (AlpHttpCertList self)
 Lock the handle and returns the pointer to AlpHttpCertList instance.
AlpHttpCertList alp_http_certlist_new (int in_type)
 Create a AlpHttpCertList instance and returns its handle. It should be empty certificate list immediately after creation.
int alp_http_certlist_remove (AlpHttpCertList self, int in_index)
 Remove a cert in cert list.
int alp_http_certlist_type (AlpHttpCertList self)
 Return the type of certificate list.
void alp_http_certlist_unlock (AlpHttpCertList self)
 Unlocks the handle.
AlpHttpClientCertList alp_http_clientcertlist_clone (AlpHttpClientCertList in_list)
 Copy a AlpHttpClientCertList instance and returns the handle.
void alp_http_clientcertlist_delete (AlpHttpClientCertList in_list)
 Delete a AlpHttpClientCertList instance.
int alp_http_clientcertlist_length (AlpHttpClientCertList in_list)
 Return the number of elements in the specified client certificate list AlpHttpClientCertList.
int alp_http_clientcertlist_verificationresults (AlpHttpClientCertList in_list, int in_index)
 Return the result of the specified client certificate authentication.
void alp_http_fixedstr_delete (AlpHttpFixedStr in_str)
 Delete AlpHttpFixedStr instance.
int alp_http_fixedstr_length (AlpHttpFixedStr in_str)
 Return the length of AlpHttpFixedStr.
void * alp_http_fixedstr_lock (AlpHttpFixedStr in_str)
 Lock the AlpHttpFixedStr instance, and returns its pointer.
AlpHttpFixedStr alp_http_fixedstr_new (char *in_str, int in_len)
 Create a AlpHttpFixedStr instance, and returns its handle.
void alp_http_fixedstr_unlock (AlpHttpFixedStr in_str)
 Unlock AlpHttpFixedStr instance.
alp_status_t alp_http_get_alp_status_code_from_http_status_code (int in_code)
 Convert AlpHttpErrorEnum and AlpHTTPStatusCodeEnum to alp_status_t value.
void alp_http_string_delete (AlpHttpString in_str)
 Delete the AlpHttpString instance.
int alp_http_string_length (AlpHttpString in_str)
 Return the length of AlpHttpString.
void * alp_http_string_lock (AlpHttpString in_str)
 Lock AlpHttpString instance, and return its pointer.
AlpHttpString alp_http_string_new (char *in_str, int in_len)
 Create a AlpHttpString, and returns its handle.
void alp_http_string_unlock (AlpHttpString in_str)
 Unlock AlpHttpString.
void alp_http_urlstr_delete (AlpHttpURLStr in_str)
 Delete AlpHttpURLStr instance.
int alp_http_urlstr_length (AlpHttpURLStr in_str)
 Return length of AlpHttpURLStr.
void * alp_http_urlstr_lock (AlpHttpURLStr in_str)
 Lock AlpHttpURLStr instance, and returns its pointer.
AlpHttpURLStr alp_http_urlstr_new (char *in_str, int in_len)
 Create a AlpHttpURLStr instance, and returns its handle.
void alp_http_urlstr_unlock (AlpHttpURLStr in_str)
 Unlock AlpHttpURLStr instance¡¯s handle.
int alp_http_util_read_netaddr (char *in_s, int in_len, AlpHttpIPAddr *out_addr)
 Convert ip address string to AlpHttpIPAddr.
void alp_http_vhandle_delete (AlpHttpVHandle in_vhandle)
 Delete HTTPLibVData.
int alp_http_vhandle_length (AlpHttpVHandle in_vhandle)
 Return the length of HTTPLibVData.
void * alp_http_vhandle_lock (AlpHttpVHandle in_vhandle)
 Lock HTTPLibVData, and returns its pointer.
void alp_http_vhandle_unlock (AlpHttpVHandle in_vhandle)
 Unlock HTTPLibVData.

HTTP stream class APIs

int alp_http_class_add_cookie (AlpHttpClassHandle classH, AlpHttpURLStr in_url, char *in_str, int in_len)
 Accept the Cookie specified in in_str and in_len.
void alp_http_class_clear_authcache (AlpHttpClassHandle classH)
 Clear the authentication information cache. This function must not be called during HTTP/HTTPS communication.
void alp_http_class_clear_dnscache (AlpHttpClassHandle classH)
 Clear the DNS information cache.
void alp_http_class_clear_sslsessioncache (AlpHttpClassHandle classH)
 Clear the SSL session cache.
void alp_http_class_close_allkeepalive (AlpHttpClassHandle classH)
 Close TCP/SSL under Keep-Alive. Sockets that are in use are not closed.
void alp_http_class_empty_cookies (AlpHttpClassHandle classH)
 Make current cookies cache empty.
int alp_http_class_is_http11overproxy (AlpHttpClassHandle classH)
 Send back a return value indicating whether the use of HTTP/1.1 through a proxy is allowed or not.
int alp_http_class_is_useproxy (AlpHttpClassHandle classH)
 Send back a return value indicating whether a proxy is used or not.
int alp_http_class_keepalivetimeout (AlpHttpClassHandle classH)
 Confirm the TCP connection under Keep-Alive.
int alp_http_class_load_cookies (AlpHttpClassHandle classH, char *in_s, int in_slen)
 Load cookeis according to in_s.
int alp_http_class_make_authinfo (AlpHttpClassHandle classH, int in_target, char *in_url, int in_url_len, char *in_proxy_host, int in_proxy_host_len, int in_proxy_port, AlpHttpStrSplit *in_realm_ss, AlpHttpAuthInfoHandle authInfoH)
 Return the authentication information to out_info as THTTPAuthInfo.
AlpHttpString alp_http_class_make_cookiesstring (AlpHttpClassHandle classH, char *in_url, int in_url_len, int in_secure, int *out_len)
 Make a cookie string according in_url value.
void alp_http_class_make_proxy (AlpHttpClassHandle classH, AlpHttpFixedStr *out_proxy_host, int *out_proxy_http_port, int *out_proxy_https_port, AlpHttpString *out_no_proxy_hosts)
 Returns proxy information to out_proxy_host, out_proxy_http_port, out_proxy_https_port, and out_no_proxy_hosts.
AlpHttpStreamHandle alp_http_class_new (AlpHttpClassHandle classH)
 Creates a THTTPStream instance. At the point the instance is created, the TCP/SSL socket has not been opened.
int alp_http_class_open_connection (AlpHttpClassHandle classH, char *in_profile_name)
 Open a cnc connection and set DNS server address.
AlpHttpString alp_http_class_save_cookies (AlpHttpClassHandle classH, int *out_len)
 Save current cookies cache to AlpHttpString.
void alp_http_class_select_cnc_channel (AlpHttpClassHandle classH, int in_channel_id)
 Select open cnc channel. When open a cnc connection, this API need to called.
void alp_http_class_set_connecttimeout (AlpHttpClassHandle classH, int in_msec)
 Set the time limit for establishing the TCP connection.
void alp_http_class_set_cookiemax (AlpHttpClassHandle classH, int in_max_total_cookies, int in_max_cookies_per_domain, int in_max_len_per_cookie)
 Set maximum of total cookies, total cookies per domain and length per cookie.
void alp_http_class_set_cookiemode (AlpHttpClassHandle classH, int in_cookie_mode, alp_http_cookie_confirmproc in_cb, AlpHttpOpaque in_cookie_aux)
 Customize the Cookie acceptance process.
int alp_http_class_set_defaultheaders (AlpHttpClassHandle classH, char *in_default_headers, int in_default_headers_len)
 Set the default header.
void alp_http_class_set_dnsmaxretry (AlpHttpClassHandle classH, int in_retry)
 Set DNS maximum retry time.
int alp_http_class_set_dnsmode (AlpHttpClassHandle classH, int in_mode)
 Set DNS mode.
void alp_http_class_set_dnsport (AlpHttpClassHandle classH, int in_port)
 Set the DNS port. Default setting value immediately after calling HTTPLib_CreateStreamClass() is 53.
void alp_http_class_set_dnsretryinterval (AlpHttpClassHandle classH, int in_interval)
 Set DNS retry interval(ms).
void alp_http_class_set_dnsserver (AlpHttpClassHandle classH, AlpHttpIPAddr *in_prim_svr, AlpHttpIPAddr *in_sec_svr)
 Set the IP address of DNS server.
void alp_http_class_set_http11overproxy (AlpHttpClassHandle classH, int in_bool)
 Set the usage allowance for HTTP/1.1 through a proxy.
void alp_http_class_set_httpport (AlpHttpClassHandle classH, int in_port)
 Set the HTTP default port number.If the scheme of a request URL is HTTP and the port number is not specified, the TCP connection is made to the port number set by this function.
void alp_http_class_set_httpsport (AlpHttpClassHandle classH, int in_port)
 Set the HTTP default port number. If the scheme of a request URL is HTTPS and the port number is not specified, the TCP connection is made to the port number set by this function.
void alp_http_class_set_max100continue (AlpHttpClassHandle classH, int in_max)
 Set the maximum receiving count of response of the status code 100.
void alp_http_class_set_maxkeepalivetimeout (AlpHttpClassHandle classH, int in_max)
 Set the maximum Keep-Alive time.
void alp_http_class_set_maxrequestbody (AlpHttpClassHandle classH, int in_size)
 Set the maximum size of request body.
void alp_http_class_set_maxrequestheader (AlpHttpClassHandle classH, int in_size)
 Set the maximum size of request line.
void alp_http_class_set_maxtcpstreams (AlpHttpClassHandle classH, int in_max_streams)
 Set the maximum number of TCP connections that can be opened at one time.
void alp_http_class_set_notifystateproc (AlpHttpClassHandle classH, alp_http_class_notifystateproc in_proc, AlpHttpOpaque in_opaque)
 Set the callback function to get the notification of AlpHttpStream state change.
int alp_http_class_set_proxy (AlpHttpClassHandle classH, char *in_proxy_host, int in_proxy_host_len, int in_proxy_http_port, int in_proxy_https_port, char *in_no_proxy_hosts, int in_no_proxy_hosts_len)
 Set the specified proxy information.
void alp_http_class_set_reqtimeout (AlpHttpClassHandle classH, int in_msec)
 Set the time limit for sending a request.
void alp_http_class_set_rsptimeout (AlpHttpClassHandle classH, int in_msec)
 Set the time limit for receiving a response.
void alp_http_class_set_sslclientcertselect_proc (AlpHttpClassHandle classH, alp_http_client_certconfirmproc in_cb, AlpHttpOpaque in_opaque)
 Register both a callback function, to provide notification regarding the selection result of client certificate, and its argument.
void alp_http_class_set_sslservercertconfirm_proc (AlpHttpClassHandle classH, alp_http_server_certconfirmproc in_cb, AlpHttpOpaque in_opaque)
 Register both a callback function, to provide notification regarding the confirmation result of server certificate acceptance, and its argument.
void alp_http_class_set_sslverifylocation (AlpHttpClassHandle classH, char *in_ca_file, char *in_ca_path)
 Set default locations for trusted CA's certificates.
void alp_http_class_set_sslversionflag (AlpHttpClassHandle classH, int in_flag, int in_on)
 Set SSL version flag.
void alp_http_class_set_useproxy (AlpHttpClassHandle classH, int in_bool)
 Set whether or not to use a proxy.
int alp_http_class_set_useragent (AlpHttpClassHandle classH, char *in_user_agent, int in_user_agent_len)
 Set the User-Agent name.
int alp_http_class_set_userpass (AlpHttpClassHandle classH, int in_type, int in_target, AlpHttpStrSplit *in_challenge_ss, AlpHttpStrSplit *in_realm_ss, char *in_user, int in_user_len, char *in_pass, int in_pass_len, char *in_url, int in_url_len, char *in_host, int in_host_len, int in_port)
 Set the authentication information.
void alp_http_class_ssl_clientcertselect (AlpHttpSSL sslH, int in_index)
 Provide notification of the result of client certificate selection.
void alp_http_class_ssl_servercertconfirm (AlpHttpSSL sslH, int in_verify_result, int in_confirm)
 Provide notification confirming server certificate acceptance.
AlpHttpSSLClassHandle alp_http_class_sslclass (AlpHttpClassHandle classH)
 Return the handle of SSL class used in HTTPStreamClass instance.

HTTP Library APIs

void alp_http_close_lib (void)
 Close HTTP library.
void alp_http_delete_streamclass (AlpHttpClassHandle classH)
 Delete the instance of HTTPStreamClass instance.
AlpHttpClassHandle alp_http_new_streamclass (void)
 Create a new HTTPStreamClass instance.
int alp_http_open_lib (void)
 Open HTTP library.

HTTP stream instance APIs

int alp_http_stream_add_header (AlpHttpStreamHandle streamH, int in_type, char *in_str, int in_len)
 Add a request header with a header and a header value (substring) corresponding to the specified header ID.
int alp_http_stream_add_headerline (AlpHttpStreamHandle streamH, char *in_str, int in_len)
 Add a request header specified by substring.
void alp_http_stream_close (AlpHttpStreamHandle streamH)
 Close THTTPStream. TCP/SSL under Keep-Alive is not closed.
int alp_http_stream_create_request (AlpHttpStreamHandle streamH, int in_method, char *in_url, int in_url_len, char *in_header, int in_header_len, char *in_referer, int in_referer_len, int in_version, int in_no_cache, int in_pipeline, int in_ssl_flag)
 Create a request with the specified contents.
void alp_http_stream_delete (AlpHttpStreamHandle streamH)
 Delete THTTPStream instance.
int alp_http_stream_get_contentlength (AlpHttpStreamHandle streamH)
 Return respose content length.
int alp_http_stream_get_entitylength (AlpHttpStreamHandle streamH)
 Return the actual size of the received body (content) as a return value.
int alp_http_stream_get_header (AlpHttpStreamHandle streamH, int in_type, int *out_ofs, int *out_len)
 Return the offset to the header value of the specified header ID to out_ofs, and its size to out_len.
AlpHttpVHandle alp_http_stream_get_responseheader (AlpHttpStreamHandle streamH)
 Return the handle of a response header in a return value. The obtained handle of the response header should not be released on the calling side.
int alp_http_stream_get_responseheaderlength (AlpHttpStreamHandle streamH)
 Return the size of a response header in a return value.
int alp_http_stream_get_scheme (AlpHttpStreamHandle streamH)
 Return the URL scheme passed in the argument in_url when calling alp_http_stream_create_request().
int alp_http_stream_get_state (AlpHttpStreamHandle streamH)
 Return the HTTPStream state.
int alp_http_stream_get_statuscode (AlpHttpStreamHandle streamH)
 Return the status code in a return value.
int alp_http_stream_is_headerreceived (AlpHttpStreamHandle streamH)
 Send back a return value indicating whether the header has been received or not.
AlpHttpCertList alp_http_stream_make_certlist (AlpHttpStreamHandle streamH)
 Return the server certificate chain used in the SSL communication as TCertList in the return value.
int alp_http_stream_receive_response (AlpHttpStreamHandle streamH, char *out_buf, int in_len, int *out_len, int *out_sleep)
 Receives a response.
void alp_http_stream_resume_timer (AlpHttpStreamHandle streamH)
 Resume a suspended HTTP timer.
int alp_http_stream_send_request (AlpHttpStreamHandle streamH, int *out_sleep)
 Send a request.
int alp_http_stream_send_requestwithpostdata (AlpHttpStreamHandle streamH, char *in_buf, int in_len, int *out_len, int *out_sleep)
 Send a POST request.
int alp_http_stream_set_postdata (AlpHttpStreamHandle streamH, int in_encoding, char *in_data, int in_len)
 Set the POST data.
void alp_http_stream_suspend_timer (AlpHttpStreamHandle streamH)
 Suspend an HTTP timer if an HTTP timer has been activated.


Function Documentation

AlpHttpString alp_http_authinfo_pass AlpHttpAuthInfoHandle  self  ) 
 

Return the password stored in the authentication structure as AlpHttpString in the return value. The obtained AlpHttpString of the password should not be released on the calling side.

Parameters:
[in] self Handle of authentication information structure
Returns:
!=0 Password

AlpHttpString alp_http_authinfo_realm AlpHttpAuthInfoHandle  self  ) 
 

Return the realm stored in the authentication structure as AlpHttpString in the return value.The obtained HTTPLibString of the realm should not be released on the calling side.

Parameters:
[in] self Handle of authentication information structure
Returns:
!=0 Realm

void alp_http_authinfo_tidy AlpHttpAuthInfoHandle  self,
int  in_new
 

Initializes/ends the authentication information structure.

Parameters:
[in] self Handle of authentication information structure
[in] in_new Initializes member variables (!0) Initializes after the memory of member variables has been released (0)
Returns:
None
Remarks:
Call this function by setting slim_true to in_new before using the authentication information structure HTTPAuthInfo.Call this function by setting slim_false to in_new after using the authentication information structure HTTPAuthInfo.

AlpHttpString alp_http_authinfo_user AlpHttpAuthInfoHandle  self  ) 
 

Return the username stored in the authentication structure as AlpHttpString in the return value. The obtained AlpHttpString of the username should not be released on the calling side.

Parameters:
[in] self Handle of authentication information structure
Returns:
!=0 Username

void alp_http_cert_delete AlpHttpCertPtr  in_cert  ) 
 

Delete the Cert instance.

Parameters:
[in] in_cert Handle of cert instance
Returns:
None

AlpHttpCertPtr alp_http_cert_new void   ) 
 

Create a new Cert instance.

Returns:
Handle of instance

int alp_http_cert_peek_issuer_rdn AlpHttpCertPtr  in_cert,
int  in_attr,
char *  out_str,
int  in_len
 

Get attribute of cert's isser DN.

Parameters:
[in] in_cert Handle of cert instance
[in] in_attr Attribute to get
httpCertDNCountryName Country Name
httpCertDNStateOrProvinceName State or Province Name
httpCertDNLocalityName Locality Name
httpCertDNStreetAddress Street Address
httpCertDNOrganizationName Organization Name
httpCertDNOrganizationUnitName Organization Unit Name
httpCertDNCommonName Common Name
httpCertDNEmailAddress Email Address
[out] out_str String pointer
[out] in_len Size of out_str
Returns:
>0 Length of attribute
<=0 Failed to getting

int alp_http_cert_peek_rsapublickeybits AlpHttpCertPtr  in_cert  ) 
 

Get cert's public key bits.

Parameters:
[in] in_cert Handle of cert instance
Returns:
Bits value

int alp_http_cert_peek_serialnumber AlpHttpCertPtr  in_cert,
char **  out_str
 

Get cert's serial number.

Parameters:
[in] in_cert Handle of cert instance
[out] out_str Binary data of serial number
Returns:
Length of out_str

int alp_http_cert_peek_signalgo AlpHttpCertPtr  in_cert,
char *  out_buf,
int  in_len
 

Get cert's sign algorithm.

Parameters:
[in] in_cert Handle of cert instance
[out] out_buf String pointer
[in] Size of out_buf
Returns:
Length of string in out_buf

int alp_http_cert_peek_subject_rdn AlpHttpCertPtr  in_cert,
int  in_attr,
char *  out_str,
int  in_len
 

Get attribute of cert's subject DN.

Parameters:
[in] in_cert Handle of cert instance
[in] in_attr Attribute to get
httpCertDNCountryName Country Name
httpCertDNStateOrProvinceName State or Province Name
httpCertDNLocalityName Locality Name
httpCertDNStreetAddress Street Address
httpCertDNOrganizationName Organization Name
httpCertDNOrganizationUnitName Organization Unit Name
httpCertDNCommonName Common Name
httpCertDNEmailAddress Email Address
[out] out_str String pointer
[out] in_len Size of out_str
Returns:
>0 Length of attribute
<=0 Failed to getting

int alp_http_cert_peek_validityend AlpHttpCertPtr  in_cert,
AlpHttpDate out_time
 

Get cert's validity end date.

Parameters:
[in] in_cert Handle of cert instance
[out] out_date Date value
Returns:
==HTTP_FALSE Failed in getting.
!=HTTP_FALSE Succeed in getting.

int alp_http_cert_peek_validitystart AlpHttpCertPtr  in_cert,
AlpHttpDate out_time
 

Get cert's validity start date.

Parameters:
[in] in_cert Handle of cert instance
[out] out_date Date value
Returns:
==HTTP_FALSE Failed in getting.
!=HTTP_FALSE Succeed in getting.

int alp_http_cert_peek_version AlpHttpCertPtr  in_cert  ) 
 

Get cert's version.

Parameters:
[in] in_cert Handle of cert instance
Returns:
>0 X.509 Certificate's version number(1 or 2 or 3).
==0 Error.
Example:
A sample code to get cert's information
...
AlpHttpCertPtr cert;
int version;
int number;
char buf[256];
AlpHttpDate date;
...
alp_http_certlist_begindecode(certList,index,&cert);
version = alp_http_cert_peek_version(cert);
number = alp_http_cert_peek_serialnumber(cert,&buf);
number = alp_http_cert_peek_signalgo(cert,buf,256);
alp_http_cert_peek_validitystart(cert,&date);
alp_http_cert_peek_validityend(cert,&date);
number = alp_http_cert_peek_rsapublickeybits(cert);
alp_http_cert_peek_subject_rdn(cert,httpCertDNCountryName,buf,256);
alp_http_cert_peek_issuer_rdn(cert,httpCertDNCountryName,buf,256);
alp_http_certlist_enddecode(self->fCertList,cert);
...

int alp_http_certlist_begindecode AlpHttpCertList  self,
int  in_index,
AlpHttpCertPtr out_cert
 

Start decoding the certificate of the specified element number. It must call alp_http_certlist_enddecode when decoding ends.

Parameters:
[in] self Handle of AlpHttpCertList instance
[in] in_index Index of cert list
[out] out_cert Decoded certificate
Returns:
HTTP_CERT_E_OK Successful
HTTP_CERT_E_NOMEM Insufficient memory
HTTP_CERT_E_DECODE Cannot decode

AlpHttpCertList alp_http_certlist_clone AlpHttpCertList  self  ) 
 

Copy a AlpHttpCertList instance and returns its handle.

Parameters:
[in] self Handle of AlpHttpCertList instance
Returns:
Handle to cloned AlpHttpCertList instance.

void alp_http_certlist_delete AlpHttpCertList  self  ) 
 

Delete AlpHttpCertList instance.

Parameters:
[in] self Handle of AlpHttpCertList instance
Returns:
None

void alp_http_certlist_enddecode AlpHttpCertList  self,
AlpHttpCertPtr  in_cert
 

End the decoding of the certificate started by alp_http_certlist_begindecode().

Parameters:
[in] self Handle of AlpHttpCertList instance
[in] in_cert Pointer to cert
Returns:
None

int alp_http_certlist_importcert AlpHttpCertList  self,
void *  in_info,
int  in_over_write
 

Register a certificate in the certificate DB.

Parameters:
[in] self Handle of AlpHttpCertList instance
[in] in_info Registration information of certificate
[in] in_over_write If the same certificate exists, overwrite it(!0), not do (0)
Returns:
>=0 The element number in registered position
httpCertListENoMem Insufficient memory
httpCertListEDecode Cannot decode certificate
httpCertListEFull No empty space in the certificate DB
httpCertListESame The same data is already registered
httpCertListEGeneric Other errors
Remarks:
If the same certificate is already registered and in_over_write is specified as !0(overwriten), it overwrites the data and returns its element number. If it is 0(not overwriten), it returns httpCertListESame.

int alp_http_certlist_length AlpHttpCertList  self  ) 
 

Return the length of AlpHttpCertList.

Parameters:
[in] self Handle of AlpHttpCertList instance
Returns:
Length of AlpHttpCertList

void* alp_http_certlist_lock AlpHttpCertList  self  ) 
 

Lock the handle and returns the pointer to AlpHttpCertList instance.

Parameters:
[in] self Handle of AlpHttpCertList instance
Returns:
Pointer to AlpHttpCertList instance

AlpHttpCertList alp_http_certlist_new int  in_type  ) 
 

Create a AlpHttpCertList instance and returns its handle. It should be empty certificate list immediately after creation.

Parameters:
[in] in_type Certificate list type
httpCetListTypeServer Server certificate chain
httpCetListTypeClient Client certificate chain
httpCetListTypeBrowser The certificate list register in the certificate DB
Returns:
Handle to AlpHttpCertList

int alp_http_certlist_remove AlpHttpCertList  self,
int  in_index
 

Remove a cert in cert list.

Parameters:
[in] self Handle of AlpHttpCertList instance
[in] in_index Index of List to remove
Returns:
== HTTP_FALSE Failed in remove
!= HTTP_FALSE Succeed in remove

int alp_http_certlist_type AlpHttpCertList  self  ) 
 

Return the type of certificate list.

Parameters:
[in] self Handle of AlpHttpCertList instance
Returns:
httpCetListTypeServer Server certificate chain
httpCetListTypeClient Client certificate chain
httpCetListTypeBrowser The certificate list register in the certificate DB

void alp_http_certlist_unlock AlpHttpCertList  self  ) 
 

Unlocks the handle.

Parameters:
[in] self Handle of AlpHttpCertList instance
Returns:
None

int alp_http_class_add_cookie AlpHttpClassHandle  classH,
AlpHttpURLStr  in_url,
char *  in_str,
int  in_len
 

Accept the Cookie specified in in_str and in_len.

Parameters:
[in] classH Handle to HTTPStreamClass
[in] in_url Request URL
[in] in_str String(substring) specified for Set-Cookie header
[in] in_len Size of in_str(bytes)
Returns:
httpErrorOK Normal termination
httpErrorNoMem Insufficient memory
httpErrorInval Cannot accept because Cookie is invalid

void alp_http_class_clear_authcache AlpHttpClassHandle  classH  ) 
 

Clear the authentication information cache. This function must not be called during HTTP/HTTPS communication.

Parameters:
[in] classH Handle to HTTPStreamClass
Returns:
None

void alp_http_class_clear_dnscache AlpHttpClassHandle  classH  ) 
 

Clear the DNS information cache.

Parameters:
[in] classH Handle to HTTPStreamClass
Returns:
None

void alp_http_class_clear_sslsessioncache AlpHttpClassHandle  classH  ) 
 

Clear the SSL session cache.

Parameters:
[in] classH Handle of HTTPStreamClass
Returns:
None
Remarks:
It does not clear the cache currently in use. This function must not be called during HTTP/HTTPS communication.

void alp_http_class_close_allkeepalive AlpHttpClassHandle  classH  ) 
 

Close TCP/SSL under Keep-Alive. Sockets that are in use are not closed.

Parameters:
[in] classH Handle of HTTPStreamClass
Returns:
None

void alp_http_class_empty_cookies AlpHttpClassHandle  classH  ) 
 

Make current cookies cache empty.

Parameters:
[in] classH Handle to HTTPStreamClass
Returns:
None

int alp_http_class_is_http11overproxy AlpHttpClassHandle  classH  ) 
 

Send back a return value indicating whether the use of HTTP/1.1 through a proxy is allowed or not.

Parameters:
[in] classH Handle of HTTPStreamClass
Returns:
== HTTP_FALSE HTTP/1.1 is not allowed.
!= HTTP_FALSE HTTP/1.1 is allowed.

int alp_http_class_is_useproxy AlpHttpClassHandle  classH  ) 
 

Send back a return value indicating whether a proxy is used or not.

Parameters:
[in] classH Handle of HTTPStreamClass
Returns:
== HTTP_FALSE Proxy is not used
!= HTTP_FALSE Porxy is used.

int alp_http_class_keepalivetimeout AlpHttpClassHandle  classH  ) 
 

Confirm the TCP connection under Keep-Alive.

Parameters:
[in] classH Handle of HTTPStreamClass
Returns:
Available sleep time(ms)
Remarks:
It confirms whether the maximum Keep-Alive time is exceeded and whether the TCP and SSL connections are not cut off. It returns the available sleep time as a return value. After the time returned in the return value elapses, this function must be called again.

int alp_http_class_load_cookies AlpHttpClassHandle  classH,
char *  in_s,
int  in_slen
 

Load cookeis according to in_s.

Parameters:
[in] classH Handle to HTTPStreamClass
[in] in_s String of cookies
[in] in_slen Length of in_s
Returns:
== HTTP_FALSE Failed in load cookies
!= HTTP_FALSE Succeeded in load cookies

int alp_http_class_make_authinfo AlpHttpClassHandle  classH,
int  in_target,
char *  in_url,
int  in_url_len,
char *  in_proxy_host,
int  in_proxy_host_len,
int  in_proxy_port,
AlpHttpStrSplit in_realm_ss,
AlpHttpAuthInfoHandle  authInfoH
 

Return the authentication information to out_info as THTTPAuthInfo.

Parameters:
[in] classH Handle to HTTPStreamClass
[in] in_target Authentication target:
httpAuthTargetPage Authentication information for page
httpAuthTargetProxy Authentication information for proxy
[in] in_url URL (used in HTTP_AUTH_TARGET_PAGE)
[in] in_url_len Size of in_url(bytes)
[in] in_proxy_host Proxy host name (used in HTTP_AUTH_TARGET_PROXY)
[in] in_proxy_host_len Size of in_proxy_host(bytes)
[in] in_proxy_port Proxy port number (used in HTTP_AUTH_TARGET_PROXY)
[in] in_realm_ss Realm
[out] out_infoH Handle to authentication information
Returns:
== HTTP_FALSE No authentication information is in cache, or insufficient memory
!= HTTP_FALSE Succeed in obtaining
Remarks:
HTTPAuthInfo must be initialized using alp_http_authinfo_tidy(out_info, !0) before calling the function. HTTPAuthInfo, the obtained authentication information, should be released using alp_http_authinfo_tidy(out_info, 0) on the calling side when it is no longer needed.

AlpHttpString alp_http_class_make_cookiesstring AlpHttpClassHandle  classH,
char *  in_url,
int  in_url_len,
int  in_secure,
int *  out_len
 

Make a cookie string according in_url value.

Parameters:
[in] classH Handle to HTTPStreamClass
[in] in_url URL to match the cookies cache
[in] in_url_len Length of in_url
[in] in_secure Not secure cookie(0)/ Secure cookie(1)
[out] out_len Length of cookie string
Returns:
String of Cookie

void alp_http_class_make_proxy AlpHttpClassHandle  classH,
AlpHttpFixedStr out_proxy_host,
int *  out_proxy_http_port,
int *  out_proxy_https_port,
AlpHttpString out_no_proxy_hosts
 

Returns proxy information to out_proxy_host, out_proxy_http_port, out_proxy_https_port, and out_no_proxy_hosts.

Parameters:
[in] classH Handle of HTTPStreamClass
[out] out_proxy_host Proxy host name
[out] out_proxy_http_port HTTP port number of proxy
[out] out_proxy_https_port HTTPS port number of proxy
[out] out_no_proxy_hosts List of the hosts to connect without proxy
Returns:
None
Remarks:
If out_proxy_host is 0, no value is set for *out_proxy_host, *out_proxy_http_port, or *out_proxy_https_port. If out_proxy_host is not 0, values other than 0 are set for out_proxy_http_port and out_proxy_https_port. Host names in out_no_proxy_hosts are saved in a list form separated by "," (0x2c in ASCII code hexadecimal). If out_no_proxy_hosts is 0, no value is set for *out_no_proxy_hosts. Duplicated AlpHttpFixedStr and AlpHttpString are set for out_proxy_host and out_no_proxy_hosts respectively. These should be released on the calling side when they are no longer needed. 0 is set if duplication fails.

AlpHttpStreamHandle alp_http_class_new AlpHttpClassHandle  classH  ) 
 

Creates a THTTPStream instance. At the point the instance is created, the TCP/SSL socket has not been opened.

Parameters:
[in] classH Handle of HTTPStreamClass
Returns:
== HTTP_FALSE Can not create HTTP stream instance
!= HTTP_FALSE Handle to created HTTP stream instance
Example:
A sample code
//Create a new HTTPStreamClass
AlpHTTPClassHandle gStreamClass;
alp_http_open_lib();
gStreamClass = alp_http_new_streamclass();

//Set some configurations
alp_http_class_set_httpport(gSteamClass, 80);
alp_http_class_set_reqtimeout(gClassHandle, -1);
alp_http_class_set_rsptimeout(gClassHandle, 10 * 1000);
...

//Create a new HTTPStream instance
AlpHttpStreamHandle gStreamInstance;
gStreamInstance = alp_http_class_new(gStreamClass);
...

int alp_http_class_open_connection AlpHttpClassHandle  classH,
char *  in_profile_name
 

Open a cnc connection and set DNS server address.

Parameters:
[in] classH Handle of HTTPStreamClass
[in] in_profile_name Profile name to connect.
Returns:
httpErrorOK Connect sucessful
httpErrorGeneric Connect failed.
Remarks:
If use this API, do not need to call alp_http_class_set_dnsserver() to set dns server.

AlpHttpString alp_http_class_save_cookies AlpHttpClassHandle  classH,
int *  out_len
 

Save current cookies cache to AlpHttpString.

Parameters:
[in] classH Handle to HTTPStreamClass
[out] out_len Length of return string
Returns:
String of saved cookies.

void alp_http_class_select_cnc_channel AlpHttpClassHandle  classH,
int  in_channel_id
 

Select open cnc channel. When open a cnc connection, this API need to called.

Parameters:
[in] classH Handle to HTTPStreamClass
[in] in_channel_id cnc channel ID
Returns:
None

void alp_http_class_set_connecttimeout AlpHttpClassHandle  classH,
int  in_msec
 

Set the time limit for establishing the TCP connection.

Parameters:
[in] classH Handle of HTTPStreamClass
[in] in_msec Time limit(ms).There is no limit when in_msec<0
Returns:
None
Remarks:
Timeout occurs when the time set for in_msec elapses between start and end of the TCP connection. If in_msec<0, there is no time limit (no timeout occurs).

void alp_http_class_set_cookiemax AlpHttpClassHandle  classH,
int  in_max_total_cookies,
int  in_max_cookies_per_domain,
int  in_max_len_per_cookie
 

Set maximum of total cookies, total cookies per domain and length per cookie.

Parameters:
[in] classH Handle to HTTPStreamClass
[in] in_max_total_cookies Maximum total cookies
[in] in_max_cookies_per_domain Maximum total cookies per domain
[in] in_max_len_per_cookie Maximum length per cookie
Returns:
None

void alp_http_class_set_cookiemode AlpHttpClassHandle  classH,
int  in_cookie_mode,
alp_http_cookie_confirmproc  in_cb,
AlpHttpOpaque  in_cookie_aux
 

Customize the Cookie acceptance process.

Parameters:
[in] classH Handle to HTTPStreamClass
[in] in_cookie_mode Cookie mode
httpCookieNotifyBeforeSet Calls callback function to customize behavior of accepting Cookies.
httpCookieAlwaysSet Always accepts Cookies
httpCookieNeverSet Never accepts Cookies
[in] in_cookie_callback Callback function to customize behavior of accepting Cookies Specifies when httpCookieNotifyBeforeSet is specified for in_cookie_mode.
[in] in_cookie_aux Auxiliary argument passed to callback function
Returns:
None
Remarks:
When httpCookieNotifyBeforeSet is specified for in_cookie_mode and 0 is specified for in_cookie_callback, the behavior is the same as when httpCookieNeverSet is specified for in_cookie_mode.

int alp_http_class_set_defaultheaders AlpHttpClassHandle  classH,
char *  in_default_headers,
int  in_default_headers_len
 

Set the default header.

Parameters:
[in] classH Handle of HTTPStreamClass
[in] in_default_headers Default headers
[in] in_default_headers_len Size of in_default_headers string(Bytes)
Returns:
== HTTP_FALSE Failed in setting
!= HTTP_FALSE Succeed in setting
Remarks:
The header set by this function is added to the request created by the alp_http_stream_create_request() function as a request header. If in_default_headers is slim_nil, deletes the default header set currently, and sets nothing. The headers included in in_default_headers must be closed with <CR><LF>.
Example:
A sample code
...
char defaultHeaders[]="Referer:www.mobilesoft.com.cn\r\nWarning: test use header\r\n";
alp_http_class_set_defaultheaders(m_streamClass, defaultHeaders, strlen(defaultHeaders));
...

void alp_http_class_set_dnsmaxretry AlpHttpClassHandle  classH,
int  in_retry
 

Set DNS maximum retry time.

Parameters:
[in] classH Handle to HTTPStreamClass
[in] in_retry Maximum number of retry times.
Returns:
None

int alp_http_class_set_dnsmode AlpHttpClassHandle  classH,
int  in_mode
 

Set DNS mode.

Parameters:
[in] classH Handle to HTTPStreamClass
[in] in_mode DNS mode
httpDNSModeIPv4Only IPV4 (Do not support IPV6 now)
Returns:
httpErrorOK Succeed in setting httpErrorGeneric Failed in setting

void alp_http_class_set_dnsport AlpHttpClassHandle  classH,
int  in_port
 

Set the DNS port. Default setting value immediately after calling HTTPLib_CreateStreamClass() is 53.

Parameters:
[in] classH Handle to HTTPStreamClass
[in] in_port DNS port number to be set
Returns:
None

void alp_http_class_set_dnsretryinterval AlpHttpClassHandle  classH,
int  in_interval
 

Set DNS retry interval(ms).

Parameters:
[in] classH Handle to HTTPStreamClass
[in] in_interval DNS retry interval(ms)
Returns:
None

void alp_http_class_set_dnsserver AlpHttpClassHandle  classH,
AlpHttpIPAddr in_prim_svr,
AlpHttpIPAddr in_sec_svr
 

Set the IP address of DNS server.

Parameters:
[in] classH Handle to HTTPStreamClass
[in] in_prim_svr IP address of primary DNS
[in] in_sec_svr IP address of secordary DNS
Returns:
None
Remarks:
If 0 is set for in_prim_svr or in_sec_svr, the previous setting is applied. Nothing is set as DNS server immediately after calling HTTPLib_CreateStreamClass().
Example:
A sample code
AlpHttpIPAddr DNSServer[2];
char *prim = "192.168.184.120";
char *sec  = "192.168.184.121";
...
alp_http_class_set_dnsmode(gClassHandle,httpDNSModeIPV4Only);
alp_http_util_read_netaddr(prim,strlen(prim),&DNSServer[0]);
alp_http_util_read_netaddr(sec,strlen(sec),&DNSServer[1]);
alp_http_class_set_dnsserver(gClassHandle, &DNSServer[0],&DNSServer[1]);
...

void alp_http_class_set_http11overproxy AlpHttpClassHandle  classH,
int  in_bool
 

Set the usage allowance for HTTP/1.1 through a proxy.

Parameters:
[in] classH Handle of HTTPStreamClass
[in] in_bool Do Not Allow(0)/ Allow(!0)
Returns:
None
Remarks:
If HTTP/1.1 is not allowed, HTTP/1.0 is used.

void alp_http_class_set_httpport AlpHttpClassHandle  classH,
int  in_port
 

Set the HTTP default port number.If the scheme of a request URL is HTTP and the port number is not specified, the TCP connection is made to the port number set by this function.

Parameters:
[in] classH Handle of HTTPStreamClass
[in] in_port Port number
Returns:
None

void alp_http_class_set_httpsport AlpHttpClassHandle  classH,
int  in_port
 

Set the HTTP default port number. If the scheme of a request URL is HTTPS and the port number is not specified, the TCP connection is made to the port number set by this function.

Parameters:
[in] classH Handle of HTTPStreamClass
[in] in_port Port number
Returns:
None

void alp_http_class_set_max100continue AlpHttpClassHandle  classH,
int  in_max
 

Set the maximum receiving count of response of the status code 100.

Parameters:
[in] classH Handle of HTTPStreamClass
[in] in_max Maximum receiving count
Returns:
None
Remarks:
When the consecutive receive count of the status code 100 exceeds the value set by this function, alp_http_stream_receive_response() returns httpErrorReqTooManyContinue.If -1 is specified for in_max, the maximum receiving count is unlimited. Also, the maximum receiving count immediately after calling alp_http_new_streamclass()becomes -1, in other words, it is unlimited.

void alp_http_class_set_maxkeepalivetimeout AlpHttpClassHandle  classH,
int  in_max
 

Set the maximum Keep-Alive time.

Parameters:
[in] classH Handle of HTTPStreamClass
[in] in_max Maximum value(ms)
Returns:
None
Remarks:
If a Keep-Alive time is not set for the HTTP response header or the specified Keep-Alive time exceeds in_max, the time specified for in_max is the maximum Keep-Alive time. If 0 or less is specified for in_max, Keep-Alive continues as long as the Keep-Alive time is not specified in the HTTP response header. The value specified by this function is not reflected in the TCP connection under Keep-Alive. -1 is set as the maximum Keep-Alive time immediately after calling HTTPLib_CreateStreamClass().

void alp_http_class_set_maxrequestbody AlpHttpClassHandle  classH,
int  in_size
 

Set the maximum size of request body.

Parameters:
[in] classH Handle of HTTPStreamClass
[in] in_size Maximum Size(Bytes). There is no limit when in_size<=0.
Returns:
None
Remarks:
There is no limit when in_size<0.

void alp_http_class_set_maxrequestheader AlpHttpClassHandle  classH,
int  in_size
 

Set the maximum size of request line.

Parameters:
[in] classH Handle of HTTPStreamClass
[in] in_size Maximum size(Bytes). There is no limit when in_size<=0.
Returns:
None
Remarks:
There is no limit when in_size<0. The size limit set by this function is only for the request line. Note that this is not a size limit for the entire request header. The accurate definitions of "request line" and "request header" in RFC2616 are as follows: Request-Line = Method SP Request-URI SP HTTP-Version CRLF Request-Line *( (general-header | request-header | entity-header) CRLF ) CRLF

void alp_http_class_set_maxtcpstreams AlpHttpClassHandle  classH,
int  in_max_streams
 

Set the maximum number of TCP connections that can be opened at one time.

Parameters:
[in] classH Handle of HTTPStreamClass
[in] in_max_streams Maximum number of TCP connections that can be opened at one time
Returns:
None
Remarks:
It is called only when all of the TCP connections used by HTTP library are closed.This function only changes the setting values. Even if the number of opened TCP connections exceeds the specified value, the closing process is not executed. Note that a TCP connection cannot be opened if a value of 0 or less is set for in_max_streams.

void alp_http_class_set_notifystateproc AlpHttpClassHandle  classH,
alp_http_class_notifystateproc  in_proc,
AlpHttpOpaque  in_opaque
 

Set the callback function to get the notification of AlpHttpStream state change.

Parameters:
[in] classH Handle of HTTPStreamClass
[in] in_proc Callback function to get notification
[in] in_opaque Arguments to callback function
Returns:
None
Remarks:
When you want to get notification of AlpHttpStream state change, call this function to set your callback function.
Example:
A sample code
//callback functions
static int test_notifystate_cb(AlpHttpStreamHandle streamH, AlpHttpURLStr in_url, int in_state, AlpHttpOpaque in_opaque)
{
        //Do what you want here
        ...
}
...
//Register the callback function
alp_http_class_set_notifystateproc(gClassHandle,test_notifystate_cb,(AlpHttpOpaque)gClassHandle);
...

int alp_http_class_set_proxy AlpHttpClassHandle  classH,
char *  in_proxy_host,
int  in_proxy_host_len,
int  in_proxy_http_port,
int  in_proxy_https_port,
char *  in_no_proxy_hosts,
int  in_no_proxy_hosts_len
 

Set the specified proxy information.

Parameters:
[in] classH Handle of HTTPStreamClass
[in] in_proxy_host Proxy host name
[in] in_proxy_host_len in_proxy_host string length
[in] in_proxy_http_port HTTP port number of proxy
[in] in_proxy_https_port HTTPS port number of proxy
[in] in_no_proxy_hosts List of hosts connect without proxy
[in] in_no_proxy_hosts_len in_no_proxy_hosts string len
Returns:
== HTTP_FALSE Failed in setting
!= HTTP_FALSE Succeed in setting
Remarks:
If in_proxy_host is 0, no value is set for *in_proxy_host, *in_proxy_http_port, or *in_proxy_https_port. If in_no_proxy_hosts is 0, no value is set for *in_no_proxy_hosts. Host names in in_no_proxy_hosts are saved in a list form separated by "," (0x2c in ASCII code hexadecimal). The host(s) name specified in in_no_proxy_hosts will connect the host without using proxy.
Example:
A sample code
char proxyHost[] = "125.240.1.131";
char noproxyHost[] = "www.yahoo.com,www.access.co.jp,127.0.0.1";
AlpHttpFixedStr host = NULL;
char *hostP;
int hostLen;
int http_port = 8080;
int https_port = 8080;
AlpHttpString no_hosts = NULL;
char *no_hostsP;
int no_hostsLen;

host = alp_http_fixedstr_new(proxyHost,strlen(proxyHost));
hostLen = alp_http_fixedstr_length(host);
hostP = (char *)alp_http_fixedstr_lock(host);

no_hosts = alp_http_string_new(noProxyHosts, strlen(noProxyHosts));
no_hostsLen = alp_http_string_length(no_hosts);
no_hostsP =(char *)alp_http_string_lock(no_hosts);

alp_http_class_set_proxy(m_streamClass,hostP,hostLen,http_port,https_port,no_hostsP, no_hostsLen);

void alp_http_class_set_reqtimeout AlpHttpClassHandle  classH,
int  in_msec
 

Set the time limit for sending a request.

Parameters:
[in] classH Handle of HTTPStreamClass
[in] in_msec Time limit(ms). There is no limit when m_msec<0
Returns:
None
Remarks:
Timeout occurs when the time specified for in_msec elapses between the start of sending a request and the start of receiving a response. If in_msec<0, there is no time limit (no timeout occurs).

void alp_http_class_set_rsptimeout AlpHttpClassHandle  classH,
int  in_msec
 

Set the time limit for receiving a response.

Parameters:
[in] classH Handle of HTTPStreamClass
[in] in_msec Time limit(ms).There is no limit when in_msec<0.
Returns:
None
Remarks:
Time out occurs when the time specified for in_msec elapses between the completion of receiving part of a response and the start of receiving the rest of the response. If in_msec<0, there is no time limit (no timeout occurs).

void alp_http_class_set_sslclientcertselect_proc AlpHttpClassHandle  classH,
alp_http_client_certconfirmproc  in_cb,
AlpHttpOpaque  in_opaque
 

Register both a callback function, to provide notification regarding the selection result of client certificate, and its argument.

Parameters:
[in] classH Handle to HTTPStreamClass
[in] in_cb Callback function to select a client certificate
[in] in_opaque Argument to callback function to select a client certificate
Returns:
None

void alp_http_class_set_sslservercertconfirm_proc AlpHttpClassHandle  classH,
alp_http_server_certconfirmproc  in_cb,
AlpHttpOpaque  in_opaque
 

Register both a callback function, to provide notification regarding the confirmation result of server certificate acceptance, and its argument.

Parameters:
[in] classH Handle to HTTPStreamClass
[in] in_cb Callback function to confirm server certificate acceptance
[in] in_opaque Argument to callback function to confirm server certificate acceptance
Returns:
None

void alp_http_class_set_sslverifylocation AlpHttpClassHandle  classH,
char *  in_ca_file,
char *  in_ca_path
 

Set default locations for trusted CA's certificates.

Parameters:
[in] classH Handle to HTTPStreamClass
[in] in_ca_file Pointer to a file of certificates in PEM format.
[in] in_ca_path Pointer to a directory containing CA certificats in PEM format. The file each contain one certificate.
Returns:
None

void alp_http_class_set_sslversionflag AlpHttpClassHandle  classH,
int  in_flag,
int  in_on
 

Set SSL version flag.

Parameters:
[in] classH Handle to HTTPStreamClass
[in] in_flag SSL version flags
httpSSLFlagConnV2 SSLv2.0 is available
httpSSLFlagConnV3 SSLv3.0 is available
httpSSLFlagConnTLS TLSv1.0 is available
httpSSLFlagConnV2V3 SSLv2.0 and SSLv3.0 are available
httpSSLFlagConnV2TLS SSLv2.0 and TLSv1.0 are available
httpSSLFlagConnV2TLS SSLv3.0 and TLSv1.0 are available
httpSSLFlagConnV2V3TLS All versions are available
[in] in_on Turn flag On(!0)/Off(0)
Returns:
None

void alp_http_class_set_useproxy AlpHttpClassHandle  classH,
int  in_bool
 

Set whether or not to use a proxy.

Parameters:
[in] classH Handle of HTTPStreamClass
[in] in_bool Do not use(0)/ Use(!0)
Returns:
None

int alp_http_class_set_useragent AlpHttpClassHandle  classH,
char *  in_user_agent,
int  in_user_agent_len
 

Set the User-Agent name.

Parameters:
[in] classH Handle of HTTPStreamClass
[in] in_user_agent User Agent Name(Browser Name)
[in] in_user_agent_len Size of in_user_agent string(Bytes)
Returns:
== HTTP_FALSE Failed in setting
!= HTTP_FALSE Succeed in setting
Remarks:
If in_user_agent is 0, deletes the User-Agent name set currently, and sets nothing.

int alp_http_class_set_userpass AlpHttpClassHandle  classH,
int  in_type,
int  in_target,
AlpHttpStrSplit in_challenge_ss,
AlpHttpStrSplit in_realm_ss,
char *  in_user,
int  in_user_len,
char *  in_pass,
int  in_pass_len,
char *  in_url,
int  in_url_len,
char *  in_host,
int  in_host_len,
int  in_port
 

Set the authentication information.

Parameters:
[in] classH Handle to HTTPStreamClass
[in] in_type Authentication type:
httpAuthTypeBasic Basic authentication
httpAuthTypeDigest Digest authentication
[in] in_target Authentication target:
httpAuthTargetPage Authentication information for page
httpAuthTargetProxy Authentication information for proxy
[in] in_challenge_ss Challenge, for example "nonce=adfif1t2etr34".
[in] in_realm_ss Realm
[in] in_user User ID
[in] in_user_len Size of in_user(bytes)
[in] in_pass Password
[in] in_pass_len Size of in_pass(bytes)
[in] in_url URL (used in HTTP_AUTH_TARGET_PAGE)
[in] in_url_len Size of in_url(bytes)
[in] in_host Proxy host name (used in HTTP_AUTH_TARGET_PROXY)
[in] in_host_len Size of in_host(bytes)
[in] in_port Proxy port number (used in HTTP_AUTH_TARGET_PROXY)
Returns:
== HTTP_FALSE Failed in setting( insufficient memory)
!= HTTP_FALSE Succeed in setting
Example:
A sample code
char *userP = "user";
char *passP = "password";
AlpHttpStrSplit challenge;
challenge.s = "nonce:adfetadfefe";
challenge.len = strlen(challenge.s);
AlpHttpStrSplit realm;
realm.s = "testrealm";
realm.len = strlen(realm.s);

alp_http_class_set_userpass(m_streamClass,httpAuthTypeDigest,httpAuthTargetPage,&challengeSS, &realmSS, userP,strlen(userP),passP,strlen(passP),authURL,strlen(authURL),0,0,0);

void alp_http_class_ssl_clientcertselect AlpHttpSSL  sslH,
int  in_index
 

Provide notification of the result of client certificate selection.

Parameters:
[in] sslH Handle to AlpHttpSSL instance
[in] in_index Index of selected client certificate
Returns:
None

void alp_http_class_ssl_servercertconfirm AlpHttpSSL  sslH,
int  in_verify_result,
int  in_confirm
 

Provide notification confirming server certificate acceptance.

Parameters:
[in] sslH Handle to AlpHttpSSL instance
[in] in_verify_result Result of server certificate authentication
[in] in_confirm Receives server's certificate(true)
Does not receive server's certificate(false)
Returns:
None

AlpHttpSSLClassHandle alp_http_class_sslclass AlpHttpClassHandle  classH  ) 
 

Return the handle of SSL class used in HTTPStreamClass instance.

Parameters:
[in] classH Handle of HTTPStreamClass
Returns:
Handle of SSL Class

AlpHttpClientCertList alp_http_clientcertlist_clone AlpHttpClientCertList  in_list  ) 
 

Copy a AlpHttpClientCertList instance and returns the handle.

Parameters:
[in] in_list Handle to a AlpHttpClientCertList instance
Returns:
== HTTP_FALSE Insufficient memory
!= HTTP_FALSE Handle to a copied AlpHttpClientCertList instance

void alp_http_clientcertlist_delete AlpHttpClientCertList  in_list  ) 
 

Delete a AlpHttpClientCertList instance.

Parameters:
[in] in_list Handle to a AlpHttpClientCertList instance
Returns:
None

int alp_http_clientcertlist_length AlpHttpClientCertList  in_list  ) 
 

Return the number of elements in the specified client certificate list AlpHttpClientCertList.

Parameters:
[in] in_list Handle to a AlpHttpClientCertList instance
Returns:
>=0 Number of elements in AlpHttpClientCertList.Return 0 if the client certificate list is empty.

int alp_http_clientcertlist_verificationresults AlpHttpClientCertList  in_list,
int  in_index
 

Return the result of the specified client certificate authentication.

Parameters:
[in] in_list Handle to a AlpHttpClientCertList instance
[in] in_index Element numbers of AlpHttpClientCertList
Returns:
Bitwise OR of the HTTP_CERT_E_XXX flag.

void alp_http_close_lib void   ) 
 

Close HTTP library.

Returns:
None
Remarks:
To close HTTP library, call this function. This function will decrease library¡¯s open reference count. And if there is no other application to use HTTP library, much of finalize work will be done in this function.

void alp_http_delete_streamclass AlpHttpClassHandle  classH  ) 
 

Delete the instance of HTTPStreamClass instance.

Parameters:
[in] classH Handle of HTTPStreamClass
Returns:
None

void alp_http_fixedstr_delete AlpHttpFixedStr  in_str  ) 
 

Delete AlpHttpFixedStr instance.

Parameters:
[in] in_str Handle of AlpHttpFixedStr instance.
Returns:
None

int alp_http_fixedstr_length AlpHttpFixedStr  in_str  ) 
 

Return the length of AlpHttpFixedStr.

Parameters:
[in] in_str Handle of AlpHttpFixedStr instance.
Returns:
Length of AlpHttpFixedStr

void* alp_http_fixedstr_lock AlpHttpFixedStr  in_str  ) 
 

Lock the AlpHttpFixedStr instance, and returns its pointer.

Parameters:
[in] in_str Handle of AlpHttpFixedStr instance.
Returns:
Pointer to AlpHttpFixedStr

AlpHttpFixedStr alp_http_fixedstr_new char *  in_str,
int  in_len
 

Create a AlpHttpFixedStr instance, and returns its handle.

Parameters:
[in] in_str Pointer to string
[in] in_len Length of string
Returns:
Handle of AlpHttpFixedStr

void alp_http_fixedstr_unlock AlpHttpFixedStr  in_str  ) 
 

Unlock AlpHttpFixedStr instance.

Parameters:
[in] in_str Handle of AlpHttpFixedStr instance.
Returns:
None

alp_status_t alp_http_get_alp_status_code_from_http_status_code int  in_code  ) 
 

Convert AlpHttpErrorEnum and AlpHTTPStatusCodeEnum to alp_status_t value.

Parameters:
[in] in_code AlpHttpErrorEnum or AlpHTTPStatusCodeEnum data
Returns:
Converted result.

AlpHttpClassHandle alp_http_new_streamclass void   ) 
 

Create a new HTTPStreamClass instance.

Returns:
Handle of HTTPStreamClass.
Remarks:
This function is a factory method to create HTTPStreamClass instance which is the factory to create HTTP stream instance. It will create an instance of HTTPStreamClass and initialize the instance.
Example:
A sample code used to create and delete a HTTPStreamClass instance
AlpHttpClassHandle gStreamClass;
...
alp_http_open_lib();
//Create a new HTTPStreamClass
gStreamClass = alp_http_new_streamclass();
...
//Delete the HTTPStreamClass
alp_http_delete_streamclass(gStreamClass);
alp_http_close_lib();
...

int alp_http_open_lib void   ) 
 

Open HTTP library.

Returns:
-1 Failed in open library. 0 Succeed in open library
Remarks:
This function should always be called firstly to use HTTP library. If this is the first time to open the library, much of initialize work will be done here. And library's open reference count will be increased. If the library have already opened in other application, this function only increase the open reference count.

int alp_http_stream_add_header AlpHttpStreamHandle  streamH,
int  in_type,
char *  in_str,
int  in_len
 

Add a request header with a header and a header value (substring) corresponding to the specified header ID.

Parameters:
[in] streamH Handle of HTTPStream instance
[in] in_type Header ID
HTTP_HeaderID_XXX
[in] in_str Pointer to header value (substring)
[in] in_len Size of header value (bytes)
Returns:
== HTTP_FALSE Failed in adding.
!= HTTP_FALSE Succeed in adding.
Remarks:
If there is a header of the same type, the older header is deleted and the new one is added.This function must not be called before alp_http_stream_create_request() is called.

int alp_http_stream_add_headerline AlpHttpStreamHandle  streamH,
char *  in_str,
int  in_len
 

Add a request header specified by substring.

Parameters:
[in] streamH Handle of HTTPStream instance
[in] in_str Pointer to header to add(substring)
[in] in_len Size of in_str(bytes)
Returns:
== HTTP_FALSE Failed in adding(Insufficient memory).
!= HTTP_FALSE Succeed in adding or not allowed to use this header.
Remarks:
If there is a header of the same type, the older header is deleted and the new one is added. This function must not be called before alp_http_stream_create_request() is called.
Example:
Usage sample code
...
char *str = "Warning: Sample add headerline";
alp_http_stream_add_headerline(m_stream,str, strlen(str));
...

void alp_http_stream_close AlpHttpStreamHandle  streamH  ) 
 

Close THTTPStream. TCP/SSL under Keep-Alive is not closed.

Parameters:
[in] streamH Handle of HTTPStream instance
Returns:
None

int alp_http_stream_create_request AlpHttpStreamHandle  streamH,
int  in_method,
char *  in_url,
int  in_url_len,
char *  in_header,
int  in_header_len,
char *  in_referer,
int  in_referer_len,
int  in_version,
int  in_no_cache,
int  in_pipeline,
int  in_ssl_flag
 

Create a request with the specified contents.

Parameters:
[in] streamH Handle of HTTPStream instance
[in] in_method HTTP method
httpMethodGET GET
httpMethodPOST POST
[in] in_url URL
[in] in_url_len Size of in_url(bytes)
[in] in_header Header to add(each header ends with <CR><LF>)
[in] in_header_len Size of in_header(bytes)
[in] in_referer Referer
[in] in_referer_len Size of in_referer(bytes)
[in] in_version HTTP version
httpVersion_0_9 HTTP/0.9
httpVersion_1_0 HTTP/1.0
httpVersion_1_1 HTTP/1.1
[in] in_no_cache Add (!0)/ Do not add(0) ¡°no-cache¡± to header
[in] in_pipeline Use(!0)/Do not use(0) pipeline process
[in] in_ssl_flag SSL version flag. See also alp_http_set_sslversionflag().
Returns:
httpErrorOK Normal termination
httpErrorNoMem Insufficient memory
httpErrorReqHeaderSizeOver Oversize request header
Remarks:
This executes the following processes.
1.Creates a CONNECT request message if SSL is used with a proxy.
2.Adds an authentication header if authentication information is cached.
3.Adds the default header or in_header.
httpErrorReqHeaderSizeOver is returned only if the size of a request line is limited using alp_http_class_set_maxrequestheader().
Example:
A sample code
// HTTP GET method 
...
char *url = "www.baidu.com";
alp_http_stream_create_request(m_streamInstance,httpMethodGET,url,strlen(url),"",0,"",0,httpVersion_1_1,0,0,0);
...
// HTTP POST method 
// Create Request
char *url = "www.google.com";
alp_http_stream_create_request(m_streamInstance,httpMethodPOST,url,strlen(url),"",0,"",0,httpVersion_1_1,0,0,0));
//Set Post Data
char *postP="My Post Data";
int postLen=strlen(postP);
alp_http_stream_set_postdata(m_streamInstance,httpPostPLAINTEXT,postP,postLen);
//Send Request
do{
        result = alp_http_stream_send_request(m_streamInstance,0);
        state = alp_http_stream_get_state(m_streamInstance);
}while(result != httpErrorOK);

void alp_http_stream_delete AlpHttpStreamHandle  streamH  ) 
 

Delete THTTPStream instance.

Parameters:
[in] streamH Handle of HTTPStream instance
Returns:
None
Remarks:
If this function is called without calling alp_http_stream_close(), Talp_http_stream_close() is called in this function to close HTTPStream. In this case, TCP/SSL under Keep-Alive is not closed.

int alp_http_stream_get_contentlength AlpHttpStreamHandle  streamH  ) 
 

Return respose content length.

If Content-Length header exists, the function returns its value; if not, returns the actual size of the received body (content).

Parameters:
[in] streamH Handle of HTTPStream instance
Returns:
== -1 Not received
>= 0 Content size (bytes)

int alp_http_stream_get_entitylength AlpHttpStreamHandle  streamH  ) 
 

Return the actual size of the received body (content) as a return value.

Parameters:
[in] streamH Handle of HTTPStream instance
Returns:
== -1 Not received
>= 0 Body size (bytes)

int alp_http_stream_get_header AlpHttpStreamHandle  streamH,
int  in_type,
int *  out_ofs,
int *  out_len
 

Return the offset to the header value of the specified header ID to out_ofs, and its size to out_len.

Parameters:
[in] streamH Handle of HTTPStream instance
[in] in_type Header ID
HTTP_HeaderID_XXX
[out] out_ofs Offset to header value
[out] out_len Size of header value (bytes)
Returns:
!= HTTP_FALSE Succeeded in obtaining
== HTTP_FALSE Specified header does not exist

AlpHttpVHandle alp_http_stream_get_responseheader AlpHttpStreamHandle  streamH  ) 
 

Return the handle of a response header in a return value. The obtained handle of the response header should not be released on the calling side.

Parameters:
[in] streamH Handle of HTTPStream instance
Returns:
== HTTP_FALSE Not received
!= HTTP_FALSE Handle of header

int alp_http_stream_get_responseheaderlength AlpHttpStreamHandle  streamH  ) 
 

Return the size of a response header in a return value.

Parameters:
[in] streamH Handle of HTTPStream instance
Returns:
==-1 Not received
>=0 Header size(bytes)

int alp_http_stream_get_scheme AlpHttpStreamHandle  streamH  ) 
 

Return the URL scheme passed in the argument in_url when calling alp_http_stream_create_request().

Parameters:
[in] streamH Handle of HTTPStream instance
Returns:
httpSchemeHTTP HTTP
httpSchemeHTTPS HTTPS

int alp_http_stream_get_state AlpHttpStreamHandle  streamH  ) 
 

Return the HTTPStream state.

Parameters:
[in] streamH Handle of HTTPStream instance
Returns:
httpStreamStateNew Instance was created
httpStreamStateDormant Currently in dormant state
httpStreamStateReqCreated Request was created
httpStreamStateReqResolve Started name resolution
httpStreamStateReqResolving Currently performing name resolution
httpStreamStateReqOpen Opened TCP/SSL
httpStreamStateReqConnect Started TCP connection to host
httpStreamStateReqConnecting Currently connecting to host via TCP
httpStreamStateReqProxyConnect Started Proxy Tunneling in SSL using proxy
httpStreamStateReqProxyConnecting Executing Proxy Tunneling in SSL using proxy
httpStreamStateReqSSLHandShaking Executing SSL Handshake
httpStreamStateReqSSLHandShaked SSL Handshake ended
httpStreamStateReqSending Sending request
httpStreamStateReqSent Request sending is completed
httpStreamStateRspHeaderWaiting Waiting for receiving response header
httpStreamStateRspContinue Waiting for completion of receiving response by receiving status code 100
httpStreamStateRspHeaderReceiving Receiving response header
httpStreamStateRspHeaderReceived Receiving response header is completed
httpStreamStateRspEntityReceiving Receiving response body
httpStreamStateRspEntityReceived Receiving response body is completed
httpStreamStateObsolete All processes are completed
httpStreamStateDelete Deleted
Remarks:
The status of HTTPStream can be obtained by calling this function after calling alp_http_stream_send_request() or alp_http_stream_receive_response(). In some cases, alp_http_stream_send_request(),alp_http_stream_send_requestwithpostdata(), and alp_http_stream_receive_response() can process multiple HTTP Stream States with one call. Therefore, the status returned by this function is not always contiguous.

int alp_http_stream_get_statuscode AlpHttpStreamHandle  streamH  ) 
 

Return the status code in a return value.

Parameters:
[in] streamH Handle of HTTPStream instance
Returns:
httpStatusCodeContinue 100
httpStatusCodeSwitchingProtocols 101
httpStatusCodeOK 200
httpStatusCodeCreated 201
httpStatusCodeAccepted 202
httpStatusCodeNonAuthoritativeInformation 203
httpStatusCodeNoContent 204
httpStatusCodeResetContent 205
httpStatusCodePartialContent 206
httpStatusCodeMultipleChoices 300
httpStatusCodeMovedPermanently 301
httpStatusCodeFound 302
httpStatusCodeSeeOther 303
httpStatusCodeNotModified 304
httpStatusCodeUseProxy 305
httpStatusCodeTemporaryRedirect 307
httpStatusCodeBadRequest 400
httpStatusCodeUnauthorized 401
httpStatusCodePaymentRequired 402
httpStatusCodeForbidden 403
httpStatusCodeNotFound 404
httpStatusCodeMethodNotAllowed 405
httpStatusCodeNotAcceptable 406
httpStatusCodeProxyAuthenticationRequired 407
httpStatusCodeRequestTimeout 408
httpStatusCodeConflict 409
httpStatusCodeGone 410
httpStatusCodeLengthRequired 411
httpStatusCodePreconditionFailed 412
httpStatusCodeRequestEntityTooLarge 413
httpStatusCodeRequestURITooLarge 414
httpStatusCodeUnsupportedMediaType 415
httpStatusCodeRequestedRangeNotSatisfiable 416
httpStatusCodeExpectationFailed 417
httpStatusCodeInternalServerError 500
httpStatusCodeNotImplemented 501
httpStatusCodeBadGateway 502
httpStatusCodeServiceUnavailable 503
httpStatusCodeGatewayTimeout 504
httpStatusCodeHTTPVersionNotSupported 505

int alp_http_stream_is_headerreceived AlpHttpStreamHandle  streamH  ) 
 

Send back a return value indicating whether the header has been received or not.

Parameters:
[in] streamH Handle of HTTPStream instance
Returns:
== HTTP_FALSE Not received or currently being received
!= HTTP_FALSE Receiving completed

AlpHttpCertList alp_http_stream_make_certlist AlpHttpStreamHandle  streamH  ) 
 

Return the server certificate chain used in the SSL communication as TCertList in the return value.

Parameters:
[in] streamH Handle of HTTPStream instance
Returns:
!= 0 Handle of server certificate chain
== 0 Server certificate chain does not exist or insufficient memory
Remarks:
Call the function after termination of httpStreamStateReqSSLHandShaked, before calling alp_http_stream_close(). The obtained TCertList of the server certificate chain should be released on the calling side when they are no longer needed.

int alp_http_stream_receive_response AlpHttpStreamHandle  streamH,
char *  out_buf,
int  in_len,
int *  out_len,
int *  out_sleep
 

Receives a response.

Parameters:
[in] streamH Handle of HTTPStream instance
[out] out_buf Pointer to receiving buffer
[in] in_len Size of receiving buffer (bytes)
[out] out_len Received size (bytes)
[out] out_sleep Available sleep time (ms)
Returns:
httpErrorOK Receiving completed
httpErrorWouldBlock Can be called continuously
httpErrorIOSleep Can sleep
httpErrorNoMem Insufficient memory
httpErrorTCPRead Cannot Read using TCP
httpErrorTCPWrite Cannot Write using TCP
httpErrorSSLRead Cannot Read using SSL
httpErrorSSLWrite Cannot Write using SSL
httpErrorTLSIntolerant Server does not support TLS v1.0
httpErrorReqTimedout Timeout during request
httpErrorRspTimedout Timeout during response
httpErrorAuthUnknown Unsupported authentication type
httpErrorAuthNoHeader Authentication is required without authentication header
httpErrorAuthFormat Invalid authentication header format
httpErrorRedirectFormat Invalid Redirect header format
httpErrorRedirectCanceled Redirect canceled by user
httpErrorReqHeaderSizeOver Oversized response header
httpErrorReqTooManyContinue Number of Continues exceeded the allowed value
Remarks:
Automatically retries when a request stalls if pipeline is enabled.Multiple HTTP Stream States can be processed by calling this function once. Therefore, the status returned by alp_http_stream_get_state() immediately after calling this function is not always contiguous.
Example:
A sample code
//Create Request
...
//Send Request
...
//Receive Response
char buffer[1024];
memset(buffer,0,1024);
do{
        result = alp_http_stream_receive_response(m_streamInstance,buffer,1024,&len,0);
        //Handle the result
        switch(result)
        {
                case httpErrorOK:
                        ...
                        break;
                case httpErrorWouldBlock:
                        ...
                        break;
                default:
                        break;  
        }
}while(result != httpErrorOK);
...  

void alp_http_stream_resume_timer AlpHttpStreamHandle  streamH  ) 
 

Resume a suspended HTTP timer.

Parameters:
[in] streamH Handle of HTTPStream instance
Returns:
None

int alp_http_stream_send_request AlpHttpStreamHandle  streamH,
int *  out_sleep
 

Send a request.

Parameters:
[in] streamH Handle of HTTPStream instance
[out] out_sleep Available sleep time(ms)
Returns:
httpErrorOK Sending completed
httpErrorWouldBlock Can be called continuously
httpErrorIOSleep Can sleep
httpErrorNoMem Insufficient memory
httpErrorDNSInval Invalid DNS message
httpErrorDNSNoServer No DNS server
httpErrorDNSTimedout Timeout during name resolution
httpErrorDNSNotFound Name not found
httpErrorTCPOpen Cannot Open using TCP
httpErrorTCPConncet Cannot Connect using TCP
httpErrorTCPRead Cannot Read using TCP
httpErrorTCPWrite Cannot Write using TCP
httpErrorSSLConnect Cannot execute Proxy Tunneling
httpErrorSSLHandshake Cannot Handshake using SSL
httpErrorSSLRead Cannot Read using SSL
httpErrorSSLWrite Cannot Write using SSL
httpErrorReqTimedout Timeout during request
httpErrorRspTimedout Timeout during Proxy Tunneling response (for SSL only)
Remarks:
Automatically retries when a request stalls if pipeline is enabled.Multiple HTTP Stream States can be processed by calling this function once. Therefore, the status returned by alp_http_stream_get_state() immediately after calling this function is not always contiguous.
Example:
A sample code
//Create Request
...
//Send Request
do{
      result = alp_http_stream_send_request(m_streamInstance,0);
      state = alp_http_stream_get_state(m_streamInstance);
}while(result != httpErrorOK);
...

int alp_http_stream_send_requestwithpostdata AlpHttpStreamHandle  streamH,
char *  in_buf,
int  in_len,
int *  out_len,
int *  out_sleep
 

Send a POST request.

Parameters:
[in] streamH Handle of HTTPStream instance
[in] in_buf Pointer to POST data
[in] in_len Size of POST data (bytes)
[out] out_len Size of sent POST data (bytes)
[out] out_sleep Available sleep time (ms)
Returns:
httpErrorOK Sending completed
httpErrorWouldBlock Can be called continuously
httpErrorIOSleep Can sleep
httpErrorNoMem Insufficient memory
httpErrorDNSInval Invalid DNS message
httpErrorDNSNoServer No DNS server
httpErrorDNSTimedout Timeout during name resolution
httpErrorDNSNotFound Name not found
httpErrorTCPOpen Cannot Open using TCP
httpErrorTCPConncet Cannot Connect using TCP
httpErrorTCPRead Cannot Read using TCP
httpErrorTCPWrite Cannot Write using TCP
httpErrorSSLConnect Cannot execute Proxy Tunneling
httpErrorSSLHandshake Cannot Handshake using SSL
httpErrorSSLRead Cannot Read using SSL
httpErrorSSLWrite Cannot Write using SSL
httpErrorReqTimedout Timeout during request
httpErrorRspTimedout Timeout during Proxy Tunneling response (for SSL only)
Remarks:
Automatically retries when a request stalls if pipeline is enabled.Multiple HTTP Stream States can be processed by calling this function once. Therefore, the status returned by alp_http_stream_get_state() immediately after calling this function is not always contiguous.
Example:
A sample code
//Create a Request
char *url = "www.palmsource.com";
alp_http_stream_create_request(m_streamInstance,httpMethodPOST,url,strlen(url),"",0,"",0,httpVersion_1_1,0,0,0);

//Set post data
char *postData="My Post Data";
int postedLen=0;
char *postP;
int writtenLen=0;
postP = postData;
int postLen=strlen(postP)+1;
alp_http_stream_set_postdata(m_streamInstance,httpPostURLENCODED,NULL,postLen);

//Send Request
do{
       result = alp_http_stream_send_requestwithpostdata(m_streamInstance,postP,postLen-postedLen,&writtenLen,NULL);                if(writtenLen>0)
       {
              postedLen += writtenLen;
              postP += writtenLen;
       }
       state = alp_http_stream_get_state(m_streamInstance);
}while(result != httpErrorOK);

int alp_http_stream_set_postdata AlpHttpStreamHandle  streamH,
int  in_encoding,
char *  in_data,
int  in_len
 

Set the POST data.

Parameters:
[in] streamH Handle of HTTPStream instance
[in] in_encoding Encoding type
httpPostURLENCODED URL encoding
httpPostPLAINTEXT Plain-Text(no encoding)
httpPostMULTIPART Multi-part encoding
[in] in_data Pointer to POST data
[in] in_len Size of POST data(bytes)
Returns:
httpErrorOK Normal termination
httpErrorNoMem Insufficient memory
httpErrorReqBodySizeOver Oversize request body
Remarks:
httpErrorReqBodySizeOver is returned only if the size of a request body is limited using alp_http_class_set_maxrequestbody().

void alp_http_stream_suspend_timer AlpHttpStreamHandle  streamH  ) 
 

Suspend an HTTP timer if an HTTP timer has been activated.

Parameters:
[in] streamH Handle of HTTPStream instance
Returns:
None

void alp_http_string_delete AlpHttpString  in_str  ) 
 

Delete the AlpHttpString instance.

Parameters:
[in] in_str Handle of AlpHttpString
Returns:
None

int alp_http_string_length AlpHttpString  in_str  ) 
 

Return the length of AlpHttpString.

Parameters:
[in] in_str Handle of AlpHttpString
Returns:
Length of AlpHttpString

void* alp_http_string_lock AlpHttpString  in_str  ) 
 

Lock AlpHttpString instance, and return its pointer.

Parameters:
[in] in_str Handle of AlpHttpString
Returns:
Pointer to AlpHttpString

AlpHttpString alp_http_string_new char *  in_str,
int  in_len
 

Create a AlpHttpString, and returns its handle.

Parameters:
[in] in_str String pointer
[in] in_len String length.
Returns:
Handle of created AlpHttpString

void alp_http_string_unlock AlpHttpString  in_str  ) 
 

Unlock AlpHttpString.

Parameters:
[in] in_str Handle of AlpHttpString
Returns:
None

void alp_http_urlstr_delete AlpHttpURLStr  in_str  ) 
 

Delete AlpHttpURLStr instance.

Parameters:
[in] in_str Handle of AlpHttpURLStr instance.
Returns:
None

int alp_http_urlstr_length AlpHttpURLStr  in_str  ) 
 

Return length of AlpHttpURLStr.

Parameters:
[in] in_str Handle of AlpHttpURLStr instance.
Returns:
Length of AlpHttpURLStr

void* alp_http_urlstr_lock AlpHttpURLStr  in_str  ) 
 

Lock AlpHttpURLStr instance, and returns its pointer.

Parameters:
[in] in_str Handle of AlpHttpURLStr instance.
Returns:
Pointer to AlpHttpString instance.

AlpHttpURLStr alp_http_urlstr_new char *  in_str,
int  in_len
 

Create a AlpHttpURLStr instance, and returns its handle.

Parameters:
[in] in_str Pointer to string
[in] in_len Length of string
Returns:
Handle of AlpHttpURLStr instance.

void alp_http_urlstr_unlock AlpHttpURLStr  in_str  ) 
 

Unlock AlpHttpURLStr instance¡¯s handle.

Parameters:
[in] in_str Handle of AlpHttpURLStr instance.
Returns:
None

int alp_http_util_read_netaddr char *  in_s,
int  in_len,
AlpHttpIPAddr out_addr
 

Convert ip address string to AlpHttpIPAddr.

Parameters:
[in] in_s String pointer
[in] in_len Size of string(bytes)
[out] out_addr Converted AlpHttpIPAddr
Returns:
Converted result.

void alp_http_vhandle_delete AlpHttpVHandle  in_vhandle  ) 
 

Delete HTTPLibVData.

Parameters:
[in] in_vhandle Handle of HTTPLibVData
Returns:
None

int alp_http_vhandle_length AlpHttpVHandle  in_vhandle  ) 
 

Return the length of HTTPLibVData.

Parameters:
[in] in_vhandle Handle of HTTPLibVData
Returns:
Length of HTTPLibData

void* alp_http_vhandle_lock AlpHttpVHandle  in_vhandle  ) 
 

Lock HTTPLibVData, and returns its pointer.

Parameters:
[in] in_vhandle Handle of HTTPLibVData
Returns:
Pointer to HTTPLibData

void alp_http_vhandle_unlock AlpHttpVHandle  in_vhandle  ) 
 

Unlock HTTPLibVData.

Parameters:
[in] in_vhandle Handle of HTTPLibVData
Returns:
None


Generated on Wed Jul 30 07:06:42 2008 by Doxygen 1.4.6 for ALP SDK + Hiker Documentation

Copyright © 1999-2008 ACCESS CO., LTD. All rights reserved.