Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

sockaddr_ptoa.c File Reference


Detailed Description

For internal use only.

brief Implementation of sockaddr_ptoa().

This file contains the implementation of the sockaddr_ptoa() function.

Definition in file sockaddr_ptoa.c.

#include "event_int.h"
#include <string.h>

Include dependency graph for sockaddr_ptoa.c:

Go to the source code of this file.

Data Structures

struct  partaddr
 Parse state. More...

Defines

#define VALMASK
 Mask to retrieve character value.
#define DIGIT
 Character is a digit.
#define XDIGIT
 Character is a hexadecimal digit.
#define COLON
 Character is a colon.
#define PERIOD
 Character is a period.
#define TYPEMASK
 Character type mask.
#define ctype(c)
 Obtain character type.
#define cval(c)
 Obtain character value.
#define _bcd(num, digit)
 Obtain specified digit.
#define bcd(num)
 Convert a BCD number to an ordinary integer.
#define bcd_isquad(num)
 Test a BCD number for IPv4 quad constraints.
#define hex_accum(accum, c)
 Add another digit to a hexadecimal (or BCD) number.
#define dec_accum(accum, c)
 Add another digit to a decimal number.
#define partaddr_init(pa, res)
 Initialize a struct partaddr.
#define accumulate(pa, accum)
 Accumulate an address part.
#define test_v6(pa)
 Test if an address is a fully specified IPv6 address.

Functions

ev_err_t sockaddr_ptoa (ev_sockaddr_t *sa, const char *address, int alen)
 Fill an ev_sockaddr_t from a presentation format.

Variables

static unsigned char cmap []
 Mapping of characters to type and value.


Define Documentation

#define _bcd num,
digit   ) 
 

For internal use only.

This macro retrieves the specified digit--counting from zero--of a hexadecimal or binary-coded-decimal number.

Parameters:
[in] num The number to obtain the digit of.
[in] digit The digit, counted from zero, to obtain.
Returns:
The value of the digit specified.

Definition at line 158 of file sockaddr_ptoa.c.

#define accumulate pa,
accum   ) 
 

For internal use only.

This macro accumulates a given value onto a partial address in a struct partaddr.

Parameters:
[in] pa A pointer to a struct partaddr.
[in] accum The 16-bit value to be accumulated onto the partial address.

Definition at line 283 of file sockaddr_ptoa.c.

Referenced by sockaddr_ptoa().

#define bcd num   ) 
 

For internal use only.

This macro takes the num, which is assumed to be a binary-coded-decimal number, and converts it to an ordinary integer.

Warning:
This macro evaluates the num parameter multiple times.
Parameters:
[in] num The number to convert from BCD.
Returns:
The value of num converted to an ordinary integer.

Definition at line 173 of file sockaddr_ptoa.c.

Referenced by sockaddr_ptoa().

#define bcd_isquad num   ) 
 

For internal use only.

This macro tests the num to determine whether it is a valid IPv4 quad (i.e., less than 255).

Warning:
This macro evaluates the num parameter multiple times.
Parameters:
[in] num The number to test.
Returns:
Boolean true if num contains a valid IPv4 quad, false otherwise.

Definition at line 191 of file sockaddr_ptoa.c.

Referenced by sockaddr_ptoa().

#define COLON
 

For internal use only.

This type value, when set in the cmap character map entry for a character, indicates that the character plays the part of the colon in an IPv6 address.

Definition at line 69 of file sockaddr_ptoa.c.

Referenced by sockaddr_ptoa().

#define ctype  ) 
 

For internal use only.

This macro retrieves the type of the character c.

Parameters:
[in] c The character to retrieve the type of.
Return values:
DIGIT The character is a numeric digit.
XDIGIT The character is an alphabetic hexadecimal digit.
COLON The character is a colon.
PERIOD The character is a period.

Definition at line 103 of file sockaddr_ptoa.c.

Referenced by sockaddr_ptoa().

#define cval  ) 
 

For internal use only.

This macro retrieves the value of the given decimal or hexadecimal character.

Parameters:
[in] c The character to retrieve the value of.
Returns:
The value of the character c.

Definition at line 116 of file sockaddr_ptoa.c.

#define dec_accum accum,
 ) 
 

For internal use only.

This macro is used to add another digit to the accum accumulator. The number in accum is assumed to be a decimal number.

Warning:
This macro evaluates the accum parameter multiple times.
Parameters:
[in] accum The accumulator containing the number.
[in] c The character to be added to the accumulator. Note that this is a character value, which will be converted by cval() to an actual numerical value.

Definition at line 232 of file sockaddr_ptoa.c.

Referenced by sockaddr_ptoa().

#define DIGIT
 

For internal use only.

This type value, when set in the cmap character map entry for a character, indicates that the character is a decimal (or hexadecimal) digit. The value may be obtained by ANDing the cmap entry with VALMASK.

Definition at line 50 of file sockaddr_ptoa.c.

Referenced by sockaddr_ptoa().

#define hex_accum accum,
 ) 
 

For internal use only.

This macro is used to add another digit to the accum accumulator. The number in accum is assumed to be a hexadecimal or BCD number.

Warning:
This macro evaluates the accum parameter multiple times.
Parameters:
[in] accum The accumulator containing the number.
[in] c The character to be added to the accumulator. Note that this is a character value, which will be converted by cval() to an actual numerical value.

Definition at line 212 of file sockaddr_ptoa.c.

Referenced by sockaddr_ptoa().

#define partaddr_init pa,
res   ) 
 

For internal use only.

This macro initializes pa given the address of the ev_sockaddr_t to be filled in.

Parameters:
[in] pa A pointer to a struct partaddr to be initialized.
[in] res A pointer to the ev_sockaddr_t to be filled in.

Definition at line 260 of file sockaddr_ptoa.c.

Referenced by sockaddr_ptoa().

#define PERIOD
 

For internal use only.

This type value, when set in the cmap character map entry for a character, indicates that the character plays the part of the period in an IPv4 address, or plays the part of the port separator character.

Definition at line 79 of file sockaddr_ptoa.c.

Referenced by sockaddr_ptoa().

#define test_v6 pa   ) 
 

For internal use only.

This macro will check to see if an address is a fully specified IPv6 address, returning an error to the function caller if it is not.

Parameters:
[in] pa A pointer to a struct partaddr to test.

Definition at line 305 of file sockaddr_ptoa.c.

Referenced by sockaddr_ptoa().

#define TYPEMASK
 

For internal use only.

This mask may be ANDed with the cmap character map entry to obtain the character type.

Definition at line 87 of file sockaddr_ptoa.c.

#define VALMASK
 

For internal use only.

This mask may be ANDed with the value associated with a character in cmap in order to obtain the value of that character--for conversion of decimal and hexadecimal numbers.

Definition at line 40 of file sockaddr_ptoa.c.

#define XDIGIT
 

For internal use only.

This type value, when set in the cmap character map entry for a character, indicates that the character is a alphabetic hexadecimal digit (i.e., a-fA-F). The value may be obtained by ANDing the cmap entry with VALMASK.

Definition at line 60 of file sockaddr_ptoa.c.

Referenced by sockaddr_ptoa().


Variable Documentation

unsigned char cmap[] [static]
 

For internal use only.

This variable maps character values to character type and value.

Definition at line 123 of file sockaddr_ptoa.c.


Generated on Wed Dec 28 23:37:32 2005 for event by  doxygen 1.4.4