XDK API  3.6.0
Documentation
Data Structures | Macros | Typedefs | Functions
Serval_RestServer.h File Reference

REST Server ModuleThe interface description of the REST Server. More...

#include <Serval_Defines.h>
#include <Serval_Rest.h>
#include <Serval_Http.h>
#include <Serval_Security.h>
+ Include dependency graph for Serval_RestServer.h:

Data Structures

struct  RestResource_S
 
struct  RestServer_RespInfo_S
 
struct  RestSettings_S
 

Macros

#define SERVAL_ENABLE_REST_SECURE_SERVER   1
 

Typedefs

typedef struct RestResource_S RestResource_T
 
typedef struct
RestServer_RespInfo_S 
RestServer_RespInfo_T
 
typedef RestResource_T const *(* RestServer_TraversalFunc_T )(RestSettings_T const *, RestServer_VisitorFunc_T, void *)
 
typedef bool(* RestServer_VisitorFunc_T )(RestResource_T const *, void *)
 
typedef struct RestSettings_S RestSettings_T
 

Functions

retcode_t RestServer_closeSecureConn (Ip_Address_T *peerAddr_ptr, Ip_Port_T peerPort)
 
retcode_t RestServer_fillRespMsg (Msg_T *msg_ptr, RestServer_RespInfo_T const *responseInfo_ptr)
 
retcode_t RestServer_getSecureConnError (Ip_Address_T *peerAddr_ptr, Ip_Port_T peerPort, retcode_t *rc_ptr)
 
retcode_t RestServer_getSecureConnState (Ip_Address_T *peerAddr_ptr, Ip_Port_T peerPort, SecureConnectionState_T *state_ptr)
 
retcode_t RestServer_initialize (void)
 
void RestServer_iterateSecureConnections (int16_t *iterator_ptr, bool onlyWithError, Ip_Address_T *ipAddr_ptr, Ip_Port_T *port_ptr)
 
retcode_t RestServer_respond (Msg_T *msg_ptr)
 
retcode_t RestServer_startInstance (RestSettings_T *restService_ptr)
 
retcode_t RestServer_startSecureInstance (RestSettings_T *restService_ptr)
 

Macro Definition Documentation

#define SERVAL_ENABLE_REST_SECURE_SERVER   1

Defines if the secure REST server instance should be enabled.

Typedef Documentation

A data type for a resource meta data.

See also
struct RestResource_S

This data structure holds the data of a REST response.

typedef RestResource_T const*(* RestServer_TraversalFunc_T)(RestSettings_T const *, RestServer_VisitorFunc_T, void *)

This is a function pointer data type for traversal function of the RESTful resources. It traverses the resources and applies the given visitor function to each resource. The traversal terminates when the visitor function returns true. In this case, the corresponding resource is returned. Otherwise, NULL is returned. Notice that a void pointer might be given as a parameter to be passed to the visitor function. This pointer maybe used to reference to any structure needed by the visitor function.

typedef bool(* RestServer_VisitorFunc_T)(RestResource_T const *, void *)

This is function pointer data type for visitor functions, which are used along with the traversal function of the RESTful resources.

See also
RestServer_TraversalFunc_T

This data type represents a REST service.

See also
struct RestSettings_S

Function Documentation

retcode_t RestServer_closeSecureConn ( Ip_Address_T peerAddr_ptr,
Ip_Port_T  peerPort 
)

This function close and disconnect an existing secure COAP connection.

Parameters
[in]peerAddr_ptrip address of the remote server socket
[in]peerPortport number of the remote server socket
Returns
when error code available On success, RC_OK is returned.
RC_REST_SECURE_CONNECTION_ERROR
retcode_t RestServer_fillRespMsg ( Msg_T msg_ptr,
RestServer_RespInfo_T const *  responseInfo_ptr 
)

Writes the response into the given message using the given response info.

Parameters
[in]msg_ptrA reference to the message to be used for the response.
[in]responseInfo_ptrA reference to the response infos to be used for the response
Returns
RC_OK on success
RC_REST_CREATE_RESPONSE_ERROR if an error occurs creating the response.
See also
RestServer_RespInfo_T
retcode_t RestServer_getSecureConnError ( Ip_Address_T peerAddr_ptr,
Ip_Port_T  peerPort,
retcode_t rc_ptr 
)

This function reports the errors of a secure connection

Parameters
[in]peerAddr_ptrreturned ip address of the connection endpoint
[in]peerPortreturned port number of the connection endpoint
[out]rc_ptrstatus of this connection
Returns
On success, RC_OK is returned.
RC_REST_SECURE_CONNECTION_ERROR
retcode_t RestServer_getSecureConnState ( Ip_Address_T peerAddr_ptr,
Ip_Port_T  peerPort,
SecureConnectionState_T state_ptr 
)

This function reports the status of a secure connection

Parameters
[in]peerAddr_ptrreturned ip address of the connection endpoint
[in]peerPortreturned port number of the connection endpoint
[out]state_ptrstatus of this connection
Returns
On success, RC_OK is returned.
RC_REST_SECURE_CONNECTION_ERROR
retcode_t RestServer_initialize ( void  )

Initializes the REST server including all needed used modules.

Returns
RC_OK if successful
RC_REST_SERVER_INIT_ERROR if the initialization of the REST server module fails.
void RestServer_iterateSecureConnections ( int16_t *  iterator_ptr,
bool  onlyWithError,
Ip_Address_T ipAddr_ptr,
Ip_Port_T port_ptr 
)

This function reports the secure connections.

Parameters
[in]iterator_ptrIterator for this function. Initialized to -1 it reports the first connection. The next returned values will report the next connections. if -1 returns, no more connections are assigned to this socket. Example: int16_t iter = -1; while(1) { rc = _getSecureConnection(&iter,...); if(iter < 0) break; do_some_thing(...); }
[in]onlyWithErrortrue -> report only connections with failures. false -> report all connections
[out]ipAddr_ptrreturned ip address of the connection endpoint
[out]port_ptrreturned port number of the connection endpoint
retcode_t RestServer_respond ( Msg_T msg_ptr)

Sends the response

Parameters
[in]msg_ptrA reference to the response message to be sent.
Returns
RC_OK on success
RC_REST_SERVER_SEND_ERROR if an error occurs.
retcode_t RestServer_startInstance ( RestSettings_T restService_ptr)

This function is called to start the default REST server

Parameters
[in]restService_ptrpointer to the connection and port to be handled
Returns
RC_OK if successful
RC_REST_SERVER_LISTEN_ERROR if the listening for the server fails.
retcode_t RestServer_startSecureInstance ( RestSettings_T restService_ptr)

This function is called to start the secure REST server

Parameters
[in]restService_ptrpointer to the connection and port to be handled
Returns
RC_OK if successful
RC_REST_SERVER_LISTEN_ERROR if the listening for the server 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:46 by doxygen 1.8.8