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

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

#include <Serval_Defines.h>
#include <Serval_Rest.h>
#include <Serval_Msg.h>
#include <Serval_Security.h>
+ Include dependency graph for Serval_RestClient.h:

Data Structures

struct  RestClient_ReqInfo_S
 

Macros

#define REST_CLIENT_PROTOCOL_COAP   REST_PROTOCOL_COAP
 
#define REST_CLIENT_PROTOCOL_HTTP   REST_PROTOCOL_HTTP
 
#define RestClient_Protocol_T   Rest_Protocol_T
 
#define SERVAL_ENABLE_REST_SECURE_CLIENT   1
 

Typedefs

typedef retcode_t(* RestAppRespCallback_T )(RestSession_T *restSession, Msg_T *msg_ptr, retcode_t status)
 
typedef struct RestClient_ReqInfo_S RestClient_ReqInfo_T
 

Enumerations

enum  RestClient_MsgReliabilityMode_T
 

Functions

retcode_t RestClient_closeSecureConn (Ip_Address_T *peerAddr_ptr, Ip_Port_T peerPort, Rest_Protocol_T protocol)
 
retcode_t RestClient_connectSecure (Ip_Address_T *peerAddr_ptr, Ip_Port_T peerPort, Rest_Protocol_T protocol)
 
retcode_t RestClient_fillReqMsg (Msg_T *msg_ptr, RestClient_ReqInfo_T const *requestInfo_ptr)
 
retcode_t RestClient_getSecureConnError (Ip_Address_T *peerAddr_ptr, Ip_Port_T peerPort, retcode_t *rc_ptr)
 
retcode_t RestClient_getSecureConnState (Ip_Address_T *peerAddr_ptr, Ip_Port_T peerPort, SecureConnectionState_T *state_ptr)
 
retcode_t RestClient_initialize (void)
 
retcode_t RestClient_initReqMsg (Ip_Address_T *addr_ptr, Ip_Port_T port, Msg_T **msg_pptr, Rest_Protocol_T protocol)
 
retcode_t RestClient_initSecureReqMsg (Ip_Address_T *addr_ptr, Ip_Port_T port, Msg_T **msg_pptr, Rest_Protocol_T protocol)
 
void RestClient_iterateSecureConnections (int16_t *iterator_ptr, bool onlyWithError, Ip_Address_T *ipAddr_ptr, Ip_Port_T *port_ptr)
 
retcode_t RestClient_request (Msg_T *msg_ptr, AppSentCallback_T appSentCallback, RestAppRespCallback_T respCallback)
 
retcode_t RestClient_startInstance (bool enableCoap, bool enableHttp)
 
retcode_t RestClient_startSecureInstance (bool enableCoap, bool enableHttp)
 

Macro Definition Documentation

#define REST_CLIENT_PROTOCOL_COAP   REST_PROTOCOL_COAP
#define REST_CLIENT_PROTOCOL_HTTP   REST_PROTOCOL_HTTP
#define RestClient_Protocol_T   Rest_Protocol_T

This enumeration defines the possible protocols of a REST message

See also
Rest_Protocol_T
Deprecated:
since 1.3
#define SERVAL_ENABLE_REST_SECURE_CLIENT   1

Defines if the secure REST client instance should be enabled.

Typedef Documentation

typedef retcode_t(* RestAppRespCallback_T)(RestSession_T *restSession, Msg_T *msg_ptr, retcode_t status)

A data type representing a callback function pointer for REST application. The application uses such callback functions in order to be notified about the received messages. Also if there was an error during receiving response for request by CoAP client this callback will be invoked with error code and the RestSession_T, which can be used to identify failed request.

This data structure holds the data of a REST request.

Enumeration Type Documentation

This enumeration defines the reliability mode of a REST message.

Enumerator
REST_CLIENT_MSG_RELIABLE 
REST_CLIENT_MSG_UNRELIABLE 

Function Documentation

retcode_t RestClient_closeSecureConn ( Ip_Address_T peerAddr_ptr,
Ip_Port_T  peerPort,
Rest_Protocol_T  protocol 
)

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
[in]protocolThis defines which protocol should be used for the request.
Returns
when error code available On success, RC_OK is returned.
RC_REST_SECURE_CONNECTION_ERROR
retcode_t RestClient_connectSecure ( Ip_Address_T peerAddr_ptr,
Ip_Port_T  peerPort,
Rest_Protocol_T  protocol 
)

This function connects and opens a secure COAP client connection.

Parameters
[in]peerAddr_ptrip address of the remote server socket
[in]peerPortport number of the remote server socket
[in]protocolThis defines which protocol should be used for the request.
Returns
when error code available On success, RC_OK is returned.
RC_REST_SECURE_CONNECTION_ERROR
retcode_t RestClient_fillReqMsg ( Msg_T msg_ptr,
RestClient_ReqInfo_T const *  requestInfo_ptr 
)

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

Parameters
[in]msg_ptrA reference to the message to be used for the response.
[in]requestInfo_ptrA reference to the request info to be used for the request
Returns
RC_OK on success
RC_REST_CREATE_REQUEST_ERROR if an error occurs creating the request.
See also
RestClient_ReqInfo_T
retcode_t RestClient_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 RestClient_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 RestClient_initialize ( void  )

Initializes the REST client including all needed used modules.

Returns
RC_OK if successful
RC_REST_CLIENT_INIT_ERROR if the initialization of the REST client module fails.
retcode_t RestClient_initReqMsg ( Ip_Address_T addr_ptr,
Ip_Port_T  port,
Msg_T **  msg_pptr,
Rest_Protocol_T  protocol 
)

This function is called to initiate a request from REST client.

Parameters
[in]addr_ptrThis is the reference to the IP address of the receiver.
[in]portThis is the server port of the receiver.
[out]msg_pptrThis holds message to be filled by application for request.
[in]protocolThis defines which protocol should be used for the request.
Returns
RC_OK, if successful
RC_REST_CLIENT_INIT_REQ_ERROR, otherwise.
retcode_t RestClient_initSecureReqMsg ( Ip_Address_T addr_ptr,
Ip_Port_T  port,
Msg_T **  msg_pptr,
Rest_Protocol_T  protocol 
)

This function is called to initiate a secure request from REST client.

Parameters
[in]addr_ptrThis is the reference to the IP address of the receiver.
[in]portThis is the server port of the receiver.
[out]msg_pptrThis holds message to be filled by application for request.
[in]protocolThis defines which protocol should be used for the request.
Returns
RC_OK, if successful
RC_REST_CLIENT_INIT_REQ_ERROR, otherwise.
void RestClient_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 RestClient_request ( Msg_T msg_ptr,
AppSentCallback_T  appSentCallback,
RestAppRespCallback_T  respCallback 
)

This function is called to push a request from REST client.

Parameters
[in]msg_ptrA reference to the request message to be pushed.
[in]appSentCallbackThis is the application callback to be called for informing application about status of sending. If the application is not interested in the delivery notification, then this function may be NULL.
[in]respCallbackThis is the application callback to be called for a received response message for this request. If the application does not expect a response for this request it should be set to NULL.
Returns
RC_OK, if successful
RC_REST_CLIENT_SEND_ERROR, otherwise.
retcode_t RestClient_startInstance ( bool  enableCoap,
bool  enableHttp 
)

This function is called to start the default REST client

Parameters
[in]enableCoapDefines if the CoAP binding should be enabled for this REST client instance.
[in]enableHttpDefines if the HTTP binding should be enabled for this REST client instance.
Returns
RC_OK if successful
RC_REST_CLIENT_LISTEN_ERROR if the listening for the client fails.
retcode_t RestClient_startSecureInstance ( bool  enableCoap,
bool  enableHttp 
)

This function is called to start the secure CoAP client

Parameters
[in]enableCoapDefines if the CoAP binding should be enabled for this REST client instance.
[in]enableHttpDefines if the HTTP binding should be enabled for this REST client instance.
Returns
, RC_OK, if successful RC_REST_CLIENT_LISTEN_ERROR if the listening for the client 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