Dibbler - a portable DHCPv6  1.0.2RC1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
addrpack.c File Reference
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <ctype.h>
#include "Portable.h"
+ Include dependency graph for addrpack.c:

Macros

#define NS_IN6ADDRSZ   16 /* IPv6 T_AAAA */
#define NS_INADDRSZ   4 /* IPv4 T_A */
#define NS_INT16SZ   2 /* #/bytes of data in a u_int16_t */
#define u_char   unsigned char
#define u_int   unsigned int

Functions

void doRevDnsAddress (char *src, char *dst)
void doRevDnsZoneRoot (char *src, char *dst, int length)
char * inet_ntop4 (const char *src, char *dst)
char * inet_ntop6 (const char *src2, char *dst)
static int inet_pton4 (const char *src, char *dst)
int inet_pton6 (const char *src, char *dst)
void print_packed (char addr[])
void print_packed (char *addr)
uint16_t readUint16 (const char *buf)
 reads uint16_t from buffer in a portable way
uint32_t readUint32 (const char *buf)
 reads uint32_t from buffer in a portable way
uint64_t readUint64 (const char *buf)
 reads uint64_t from buffer in a portable way
uint8_t readUint8 (const char *buf)
void truncatePrefixFromConfig (char *src, char *dst, char length)
char * writeData (char *buf, char *data, size_t len)
char * writeUint16 (char *buf, uint16_t word)
 stores uint16_t to a buffer in a portable way
char * writeUint32 (char *buf, uint32_t dword)
 stores uint32_t to a buffer in a portable way
char * writeUint64 (char *buf, uint64_t qword)
 stores uint64_t to a buffer in a portable way
char * writeUint8 (char *buf, uint8_t octet)

Macro Definition Documentation

#define NS_IN6ADDRSZ   16 /* IPv6 T_AAAA */
#define NS_INADDRSZ   4 /* IPv4 T_A */
#define NS_INT16SZ   2 /* #/bytes of data in a u_int16_t */
#define u_char   unsigned char
#define u_int   unsigned int

Function Documentation

void doRevDnsAddress ( char *  src,
char *  dst 
)

converts packed address to a reverse string used in DNS Updates

Parameters
src- packed address
dst- output buffer (e.g. 1.2.3.0.0.0.0.0.0.0.0.0.0.e.f.f.3.ip6.arpa)
void doRevDnsZoneRoot ( char *  src,
char *  dst,
int  length 
)

function converts address to a DNS zone root with specified length

Parameters
src- packed address, e.g. 3ffe::123
dst- dns zone root, e.g. 0.0.0.0.e.f.f.3.ip6.arpa
length- zone length, e.g. 96
Todo:
: what to do with prefixes which do not divide by 4?
char* inet_ntop4 ( const char *  src,
char *  dst 
)
char* inet_ntop6 ( const char *  src2,
char *  dst 
)
static int inet_pton4 ( const char *  src,
char *  dst 
)
static
int inet_pton6 ( const char *  src,
char *  dst 
)
void print_packed ( char  addr[])
void print_packed ( char *  addr)
uint16_t readUint16 ( const char *  buf)

reads uint16_t from buffer in a portable way

Buffer must be at least 2 bytes long.

Parameters
bufpointer to first byte of buffer
Returns
read 16-bits value
uint32_t readUint32 ( const char *  buf)

reads uint32_t from buffer in a portable way

Buffer must be at least 4 bytes long.

Parameters
bufpointer to first address of buffer
Returns
read value
uint64_t readUint64 ( const char *  buf)

reads uint64_t from buffer in a portable way

Buffer must be at least 8 bytes long.

Parameters
bufpointer to first address of buffer
Returns
read value
uint8_t readUint8 ( const char *  buf)
void truncatePrefixFromConfig ( char *  src,
char *  dst,
char  length 
)
char* writeData ( char *  buf,
char *  data,
size_t  len 
)
char* writeUint16 ( char *  buf,
uint16_t  word 
)

stores uint16_t to a buffer in a portable way

Buffer must be at least 2 bytes long.

Parameters
bufpointer to first byte of buffer
word16-bits value to be stored
Returns
pointer to the next byte after stored value
char* writeUint32 ( char *  buf,
uint32_t  dword 
)

stores uint32_t to a buffer in a portable way

Buffer must be at least 4 bytes long.

Parameters
bufpointer to first byte of buffer
dword32-bits value to be stored
Returns
pointer to the next byte after stored value
char* writeUint64 ( char *  buf,
uint64_t  qword 
)

stores uint64_t to a buffer in a portable way

Buffer must be at least 8 bytes long.

Parameters
bufpointer to first byte of buffer
qword64-bits value to be stored
Returns
pointer to the next byte after stored value
char* writeUint8 ( char *  buf,
uint8_t  octet 
)