XDK API  3.6.0
Documentation
Macros | Typedefs | Functions
Serval_XUdp.h File Reference

The interface description of an proprietary UDP based application protocol.This UDP based application protocol enabled the application to push application specific data over UDP to some target receiver. The application data is assigned as raw message as well as the payload which is sent to the application by a communication partner. The length of the payload has to be provided by the application. More...

#include <Serval_Defines.h>
#include <Serval_Types.h>
#include <PIp.h>
#include <Serval_Msg.h>
+ Include dependency graph for Serval_XUdp.h:

Macros

#define SERVAL_XUDP_MAX_LEN_APP_PAYLOAD   256
 

Typedefs

typedef struct XUdpMsg_S XUdpMsg_T
 

Functions

XUdpMsg_TMsg_getXUdpMsg (Msg_T *msg_ptr)
 
void XUdp_getXUdpPayload (Msg_T *msg_ptr, uint8_t **payload_pptr, unsigned int *payloadLen_ptr)
 
void XUdp_getXUdpPeer (Msg_T *msg_ptr, Ip_Address_T *ipAddress_ptr, uint16_t *port_ptr)
 
retcode_t XUdp_initialize (void)
 
retcode_t XUdp_push (Ip_Address_T *destIp_ptr, uint16_t destPort, uint8_t const *payload_ptr, unsigned int len, AppCallback_T appCallback, Msg_T **msg_pptr)
 
retcode_t XUdp_start (Ip_Port_T serverPort, AppCallback_T appRecCallback)
 
void XUdpMsg_setAppCallback (Msg_T *msg_ptr, AppCallback_T appCallback)
 

Macro Definition Documentation

#define SERVAL_XUDP_MAX_LEN_APP_PAYLOAD   256

This is the length of the payload buffer of a XUDP message.

Typedef Documentation

typedef struct XUdpMsg_S XUdpMsg_T

The data structure for messages of the generic proprietary UDP based application protocol XUDP.

See also
struct XUdpMsg_S

Function Documentation

XUdpMsg_T* Msg_getXUdpMsg ( Msg_T msg_ptr)

This function provides a pointer to the structure holding XUDP message in the given Msg_T object.

Parameters
[in]msg_ptrReference to a Msg_T object. It has to be a valid pointer.
Returns
a pointer of type XUdpMsg_T to the required web message structure.
void XUdp_getXUdpPayload ( Msg_T msg_ptr,
uint8_t **  payload_pptr,
unsigned int *  payloadLen_ptr 
)

It returns the reference to the payload and the payload length of a XUDP message within a message.

Parameters
[in]msg_ptrA pointer to a message which contains a XUDP message. It has to be a valid pointer.
[out]payload_pptrThe reference to the payload of the XUDP message.
[out]payloadLen_ptrThe value of the payload length of the XUDP message.
void XUdp_getXUdpPeer ( Msg_T msg_ptr,
Ip_Address_T ipAddress_ptr,
uint16_t *  port_ptr 
)

It returns the IP address and the port of a XUDP message within a message.

Parameters
[in]msg_ptrA pointer to a message which contains a XUDP message. It has to be a valid pointer.
[out]ipAddress_ptrThe reference to the IP address of a XUDP message within a message.
[out]port_ptrThe port of the XUDP message within a message.
retcode_t XUdp_initialize ( void  )

It initializes the XUDP protocol including all needed modules.

Returns
RC_OK on success or
RC_XUDP_INIT_ERROR on failure.
retcode_t XUdp_push ( Ip_Address_T destIp_ptr,
uint16_t  destPort,
uint8_t const *  payload_ptr,
unsigned int  len,
AppCallback_T  appCallback,
Msg_T **  msg_pptr 
)

It pushes the application data via UDP to the assigned destination IP address and port.

Parameters
[in]destIp_ptrThe reference of the destination IP address.
[in]destPortThe port of the destination.
[in]payload_ptrA pointer to the buffer which contains the payload of a XUDP message.
[in]lenThe length of the payload. The payload must not be longer than SERVAL_XUDP_MAX_LEN_APP_PAYLOAD.
[in]appCallbackThe application callback which will be invoked after finishing the sending in order to notify the application about success or failure of the sending.
[out]msg_pptrThe reference to the message which was sent. The reference must not be used after the application callback (which is invoked after finishing sending) has finished its task.
Returns
RC_OK on success
RC_XUDP_PAYLOAD_TOO_LARGE if the length of the payload is larger than SERVAL_XUDP_MAX_LEN_APP_PAYLOAD RC_XUDP_ASLEEP if the stack, and consequently XUDP, is not active. RC_XUDP_OVERLOADED if no free message struct is available to accept the new sending job RC_XUDP_MSG_FACTORY_OVERFLOW if there is a problem to construct the message payload to be sent RC_XUDP_SENDING_ERROR if an error occurs while trying to send the message
See also
OperationControl_isActive()
retcode_t XUdp_start ( Ip_Port_T  serverPort,
AppCallback_T  appRecCallback 
)

It starts listening on the specified port number for UDP packets.

Parameters
[in]serverPortThe port which is used to send and receive messages. It has to be a valid port number (!=0).
[in]appRecCallbackThe application callback function which should be called when a message is received. It has to be a valid pointer.
Returns
RC_OK on success or
RC_XUDP_SOCKET_ACTIVE if listening was already started before. RC_XUDP_SOCKET_ERROR if opening the UDP socket fails.
void XUdpMsg_setAppCallback ( Msg_T msg_ptr,
AppCallback_T  appCallback 
)

This function is called to initialize application callback defined by application to inform it of some event.

Parameters
[in]msg_ptrReference to a Msg_T object which holds the current message. It has to be a valid pointer.
[in]appCallbackReference to a AppCallback_T object, this holds the application callback to be called to inform application about the success or failure of response.
Since
1.3

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