The friendly Operating System for the Internet of Things
Raw IPv4/IPv6 connections

Connection submodule for raw IPv4/IPv6 connections. More...

Detailed Description

Deprecated:
Please use Raw IPv4/IPv6 sock API instead

Files

file  conn/ip.h
 Raw IPv4/IPv6 connection definitions.
 

Typedefs

typedef struct conn_ip conn_ip_t
 Implementation-specific type of a raw IPv4/IPv6 connection object.
 

Functions

int conn_ip_create (conn_ip_t *conn, const void *addr, size_t addr_len, int family, int proto)
 Creates a new raw IPv4/IPv6 connection object. More...
 
void conn_ip_close (conn_ip_t *conn)
 Closes a raw IPv4/IPv6 connection. More...
 
int conn_ip_getlocaladdr (conn_ip_t *conn, void *addr)
 Gets the local address of a raw IPv4/IPv6 connection. More...
 
int conn_ip_recvfrom (conn_ip_t *conn, void *data, size_t max_len, void *addr, size_t *addr_len)
 Receives a message over IPv4/IPv6. More...
 
int conn_ip_sendto (const void *data, size_t len, const void *src, size_t src_len, void *dst, size_t dst_len, int family, int proto)
 Sends a message over IPv4/IPv6. More...
 

Function Documentation

void conn_ip_close ( conn_ip_t conn)
Parameters
[in,out]connA raw IPv4/IPv6 connection object.
int conn_ip_create ( conn_ip_t conn,
const void *  addr,
size_t  addr_len,
int  family,
int  proto 
)
Parameters
[out]connPreallocated connection object. Must fill the size of the stack-specific connection desriptor.
[in]addrThe local IP address for conn.
[in]addr_lenLength of addr. Must be fitting for the family.
[in]familyThe family of addr (see UNIX address families).
[in]protoProtocol Numbers for the IPv6 packets to receive.
Returns
0 on success.
any other negative number in case of an error. For portability implementations should draw inspiration of the errno values from the POSIX' bind() function specification.
int conn_ip_getlocaladdr ( conn_ip_t conn,
void *  addr 
)
Parameters
[in]connA raw IPv4/IPv6 connection object.
[out]addrThe local IP address. Must have space for any address of the connection's family.
Returns
length of addr on success.
any other negative number in case of an error. For portability implementations should draw inspiration of the errno values from the POSIX' getsockname() function specification.
int conn_ip_recvfrom ( conn_ip_t conn,
void *  data,
size_t  max_len,
void *  addr,
size_t *  addr_len 
)
Parameters
[in]connA raw IPv4/IPv6 connection object.
[out]dataPointer where the received data should be stored.
[in]max_lenMaximum space available at data.
[out]addrNULL pointer or the sender's IP address. Must have space for any address of the connection's family.
[out]addr_lenLength of addr. Can be NULL if addr is NULL.
Note
Function may block.
Returns
The number of bytes received on success.
0, if no received data is available, but everything is in order.
any other negative number in case of an error. For portability, implementations should draw inspiration of the errno values from the POSIX' recv(), recvfrom(), or recvmsg() function specification.
int conn_ip_sendto ( const void *  data,
size_t  len,
const void *  src,
size_t  src_len,
void *  dst,
size_t  dst_len,
int  family,
int  proto 
)
Parameters
[in]dataPointer where the received data should be stored.
[in]lenMaximum space available at data.
[in]srcThe source address. May be NULL for all any interface address.
[in]src_lenLength of src.
[in]dstThe receiver's network address.
[in]dst_lenLength of dst.
[in]familyThe family of src and dst (see UNIX address families).
[in]protoProtocol Numbers for the IPv6 packets to set.
Note
Function may block.
Returns
The number of bytes send on success.
any other negative number in case of an error. For portability, implementations should draw inspiration of the errno values from the POSIX' send(), sendfrom(), or sendmsg() function specification.