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

Interface to the platform IP management. More...

#include <PIp.h>
#include <Serval_Types.h>
+ Include dependency graph for Serval_Ip.h:
+ This graph shows which files directly or indirectly include this file:

Data Structures

struct  Peer_S
 

Typedefs

typedef struct Peer_S Peer_T
 

Functions

static bool comparePeer (const Peer_T *a, const Peer_T *b)
 
bool Ip_compareAddr (Ip_Address_T const *ip1_ptr, Ip_Address_T const *ip2_ptr)
 
int Ip_convertAddrToString (Ip_Address_T const *ipAddr_ptr, char *buffer_ptr)
 
Ip_Port_T Ip_convertIntToPort (uint16_t port)
 
void Ip_convertOctetsToAddr (uint8_t first, uint8_t second, uint8_t third, uint8_t fourth, Ip_Address_T *ipAddr_ptr)
 
uint16_t Ip_convertPortToInt (Ip_Port_T port)
 
void Ip_copyAddr (Ip_Address_T const *src_ptr, Ip_Address_T *dest_ptr)
 
Ip_Address_TIp_getMyIpAddr (void)
 
Ip_Address_T const * Ip_getUnspecifiedAddr (void)
 
static bool samePeer (const Peer_T *peer, const Ip_Address_T *address, const Ip_Port_T port)
 

Detailed Description

This module provides functions to convert an IP address String to an Integer and vice versa. It also provides functions to convert a port to an Integer and vice versa. It provides a function to retrieve the IP address of its current interface.
Note: This interface includes PIp.h. This header has to be provided by the PAL implementation. It has to provide:

Typedef Documentation

typedef struct Peer_S Peer_T

A data structure to contain information about a communication peer

See also
struct Peer_S

Function Documentation

static bool comparePeer ( const Peer_T a,
const Peer_T b 
)
inlinestatic

Compare a peer with another peer

Returns
true if both address and port of the peers match

+ Here is the call graph for this function:

bool Ip_compareAddr ( Ip_Address_T const *  ip1_ptr,
Ip_Address_T const *  ip2_ptr 
)

This function is called compares two IP addresses on being equal and return the result.

Parameters
[in]ip1_ptrA pointer to the first IP address. It has to be valid.
[in]ip2_ptrA pointer to the second IP address. It has to be valid.
Returns
TRUE if the both IP address are equal, or FALSE otherwise.

+ Here is the caller graph for this function:

int Ip_convertAddrToString ( Ip_Address_T const *  ipAddr_ptr,
char *  buffer_ptr 
)

This function converts a given IP address to a null-terminated string, and stores the result in the given buffer.

Parameters
[in]ipAddr_ptrA valid pointer reference to the IP address to be converted.
[out]buffer_ptrA valid pointer to the buffer which the IP string should be written to. The given buffer must be larger than the maximal length of the IP string presentation by at least 1 (for the null-character). The written string will be NULL terminated.
Returns
On success, the total number of characters written is returned. This count does not include the additional null-character. On failure, a negative number is returned.

+ Here is the caller graph for this function:

Ip_Port_T Ip_convertIntToPort ( uint16_t  port)

This function converts a given Integer to a port and returns the result.

Parameters
[in]portThe port number as an Integer in the platform byte order
Returns
The port in the network byte order.
void Ip_convertOctetsToAddr ( uint8_t  first,
uint8_t  second,
uint8_t  third,
uint8_t  fourth,
Ip_Address_T ipAddr_ptr 
)

This function converts given octets to an IP address.

Parameters
[in]firstFirst block of the IP address. It has to be in the range of 0-255.
[in]secondSecond block of the IP address. It has to be in the range of 0-255.
[in]thirdThird block of the IP address. It has to be in the range of 0-255.
[in]fourthForth block of the IP address. It has to be in the range of 0-255.
[out]ipAddr_ptrReference to an IPv4 address for the result of the conversion. It has to be a valid pointer.

TODO: Rename to Ip_convertBlocksToAddr()

uint16_t Ip_convertPortToInt ( Ip_Port_T  port)

This function converts a given port from the network byte order to an Integer in the platform byte order and returns the result.

Parameters
[in]portPort to be converted.
Returns
Converted port as an Integer in the platform byte order.
void Ip_copyAddr ( Ip_Address_T const *  src_ptr,
Ip_Address_T dest_ptr 
)

This function is called to copy a given IP address to a destination whose reference is given.

Parameters
[in]src_ptrReference to the source IP address to be copied
[out]dest_ptrReference to the destination which the given IP will copied to.
Ip_Address_T* Ip_getMyIpAddr ( void  )

This function returns a reference to the IP address assigned to the own network interface. If no IP address has been assigned to the network interface, this function returns the unspecified IP address, i.e. an address which is equal to the result of Ip_getUnspecifiedAddr().

Returns
On success, a reference to the own IP address is returned. On failure Null is returned.
See also
Ip_getUnspecifiedAddr()
Ip_Address_T const* Ip_getUnspecifiedAddr ( void  )

This function should be used to un-initialize an IP address. It returns a reference to the unspecified address which is 0.0.0.0 in the case of IPv4 or 0:0:0:0:0:0:0:0:0 (i.e. ::) in the case of IPv6.

Returns
A reference to the unspecified IP address.
static bool samePeer ( const Peer_T peer,
const Ip_Address_T address,
const Ip_Port_T  port 
)
inlinestatic

Compare a peer with an address and a port.

Returns
true if both address and port match the ones stored in the peer

+ Here is the call graph for this function:


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:47 by doxygen 1.8.8