XDK API  3.6.0
Documentation
Functions
Serval_HttpServer.h File Reference

HTTP Server ModuleThe interface description of the HTTP server. More...

#include <Serval_Defines.h>
#include <Serval_Types.h>
#include <Serval_Http.h>
#include <Serval_Callable.h>
#include <Serval_Tcp.h>
+ Include dependency graph for Serval_HttpServer.h:

Functions

char const * HttpServer_formatHost (Ip_Address_T *addr, char *buf_ptr)
 
retcode_t HttpServer_initialize (void)
 
retcode_t HttpServer_respond (Msg_T *msg_ptr, Http_StatusCode_T respStatus, const char *contentType, Callable_T *alpCallback_ptr)
 
retcode_t HttpServer_start (HttpServerInstance_T *HttpServerInstance_ptr)
 

Function Documentation

char const* HttpServer_formatHost ( Ip_Address_T addr,
char *  buf_ptr 
)

Converts a given host address to the correct format of either IPv4 or IPv6 depending on the definition of SERVAL_IPV6. In the case IPv6 the host IP address will be put in brackets "[...]".

Parameters
[in]addrThe address to which the formatting is intended.
[in,out]buf_ptrThe pointer to the buffer which will contain the converted address (zero terminating). The buffer must not be smaller than (SERVAL_IP_ADDR_LEN + 1), where SERVAL_IP_ADDR_LEN is the value specified by the Platform Adaption Layer (PAL) as the maximal length of a serialized IP address.
Returns
String representing the formatted address in either IPv4 or IPv6, depending on the definition of SERVAL_IPV6.
retcode_t HttpServer_initialize ( void  )

Initializes the HTTP server including all needed used modules.

Returns
RC_OK if successful TODO: Error handling!
retcode_t HttpServer_respond ( Msg_T msg_ptr,
Http_StatusCode_T  respStatus,
const char *  contentType,
Callable_T alpCallback_ptr 
)

This function is responsible for responding to an HTTP request. It is used by upper protocols such the Webserver or DPWS to respond to incoming requests. It builds the HTTP message header and hands the message to the MsgSender to send it via TCP.

Parameters
[in]msg_ptrPointer to the Msg_T element representing the request/response message.
[in]respStatusThe HTTP status code
[in]contentTypeThe content type of HTTP response (e.g. "application/soap+xml")
[in]alpCallback_ptrPointer to function that would act as a callback function when sending is completed. This callback function will be invoked to notify the upper-layer about the result of the sending.
Returns
RC_OK or RC_SERVAL_ERROR TODO: Error handling!
retcode_t HttpServer_start ( HttpServerInstance_T HttpServerInstance_ptr)

This function opens a port and registers a handling function for this port.

Parameters
[in]HttpServerInstance_ptrpointer to the connection and port to be handled
Returns
RC_OK on success or RC_HTTP_LISTEN_ERROR if listening at the port fails.

All rights reserved. The use is subject to the XDK SDK EULA by Bosch Connected Devices and Solutions GmbH.
This documentation file has been automatically generated on Thu Mar 14 2019 19:12:45 by doxygen 1.8.8