Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 4559 → Rev 4704

/branches/network/uspace/srv/net/include/inet.h
31,7 → 31,7
*/
 
/** @file
*
* Internet common definitions.
*/
 
#ifndef __NET_INET_H__
41,17 → 41,55
 
#include "byteorder.h"
 
/** Type definition of the socket address.
* @see sockaddr
*/
typedef struct sockaddr sockaddr_t;
 
/** Type definition of the address information.
* @see addrinfo
*/
typedef struct addrinfo addrinfo_t;
 
/** Prints the address into the character buffer.
* @param family The address family. Input parameter.
* @param data The address data. Input parameter.
* @param address The character buffer to be filled. Output parameter.
* @param length The buffer length. Input parameter.
* @returns EOK on success.
* @returns EINVAL if the data or address parameter is NULL.
* @returns ENOMEM if the character buffer is not long enough.
* @returns ENOTSUP if the address family is not supported.
*/
int inet_ntop( uint16_t family, const uint8_t * data, char * address, size_t length );
 
/** Parses the character string into the address.
* If the string is shorter than the full address, zero bytes are added.
* @param family The address family. Input parameter.
* @param address The character buffer to be parsed. Input parameter.
* @param data The address data to be filled. Output parameter.
* @returns EOK on success.
* @returns EINVAL if the data parameter is NULL.
* @returns ENOENT if the address parameter is NULL.
* @returns ENOTSUP if the address family is not supported.
*/
int inet_pton( uint16_t family, const char * address, uint8_t * data );
 
/** Socket address.
*/
struct sockaddr{
uint16_t sa_family; // address family, AF_xxx
uint8_t sa_data[ 14 ]; // 14 bytes of protocol address
/** Address family.
* @see socket.h
*/
uint16_t sa_family;
/** 14 byte protocol address.
*/
uint8_t sa_data[ 14 ];
};
 
/** Address information.
* \todo
*/
struct addrinfo{
int ai_flags; // AI_PASSIVE, AI_CANONNAME, etc.
uint16_t ai_family; // AF_INET, AF_INET6, AF_UNSPEC