Main Page | Class List | File List | Class Members | File Members

util.h File Reference

Go to the source code of this file.

Functions

int rst_MACatoi (char *, unsigned char *)
 Convert a MAC address from ASCII to integer.

char * rst_MACitoa (unsigned char *, char *)
 Convert a MAC address from integer to ASCII.

int rst_getMAC (char *, unsigned char *)
 Retrieve the MAC address for interface i.

int rst_IPatoi (char *, int *)
 Convert an IP address from ASCII to integer.

char * rst_IPitoa (unsigned int, char *)
 Convert an IP address from integer to ASCII.

int rst_getIPaddr (char *, unsigned int *)
 Retrieve the IP address for interface i.

int rst_getIPmask (char *, unsigned int *)
 Retrieve the IP network mask for interface i.

void rst_maskInc (unsigned int *, unsigned int)
 Increment the masked portion of target.


Function Documentation

int rst_getIPaddr char *  i,
unsigned int *  ipInt
 

Retrieve the IP address for interface i.

Parameters:
i an Ethernet interface
ipInt an IP address
Precondition:
i is a null-terminated string
Postcondition:
if the call succeeds ipInt contains the IP address for i otherwise *ipInt is unchanged
Returns:
0: success

1: rst_open failure

2: ioctl failure

int rst_getIPmask char *  i,
unsigned int *  mask
 

Retrieve the IP network mask for interface i.

Parameters:
i an Ethernet interface
mask an IP address
Precondition:
i is the string name of a local Ethernet interface
Postcondition:
if the call succeeds mask contains the network mask for i otherwise *mask is unchanged
Returns:
0: success

1: rst_open failure

2: ioctl failure

int rst_getMAC char *  i,
unsigned char *  MACint
 

Retrieve the MAC address for interface i.

Parameters:
i an Ethernet interface
MACint a MAC address in integer form
Precondition:
i is a null-terminated string

MACint is an array of at least 6 bytes

Postcondition:
if the call succeeds MACint contains the MAC address for i; otherwise *MACint is unchanged
Returns:
0: success

1: rst_open failure

2: ioctl failure

int rst_IPatoi char *  ipString,
int *  ipInt
 

Convert an IP address from ASCII to integer.

A legal string IP address is of the form "I1.I2.I3.I4" where each of I1, I2, I3, and I4 is a 1, 2, or 3 digit decimal integer.

Parameters:
ipString the IP address in ASCII form
ipInt the resulting IP address in integer form
Precondition:
ipString is a null-terminated string

*ipInt is allocated

Postcondition:
if the call succeeds ipInt contains the IP address for i; otherwise *ipInt is unchanged
Returns:
0: success

non-zero: conversion failure

char* rst_IPitoa unsigned int  ipInt,
char *  ipString
 

Convert an IP address from integer to ASCII.

Parameters:
ipInt an IP address in integer form in hyost byte order
ipString a string buffer
Precondition:
ipString is at least 16 bytes long
Postcondition:
ipString contains the converted address
Returns:
ipString

int rst_MACatoi char *  MACstring,
unsigned char *  MACint
 

Convert a MAC address from ASCII to integer.

A legal string MAC address is of the form "D1:D2:D3:D4:D5:D6" where each of D1, D2, ..., D5 is 1 or 2 digit hex number.

Parameters:
MACstring a MAC address in string form
MACint the resulting MAC address in integer form
Precondition:
MACint is an array of at least 6 bytes
Postcondition:
if the call succeeds MACint contains the converted address; otherwise *MACint is unchanged.
Returns:
0: success

non-zero: conversion failure

char* rst_MACitoa unsigned char *  MACint,
char *  MACstring
 

Convert a MAC address from integer to ASCII.

Parameters:
MACint a MAC address in integer form
MACstring the resulting MAC address in string form
Precondition:
MACstring is at least 18 bytes long

MACint is an array of at least 6 bytes

Postcondition:
MACint contains the converted address
Returns:
MACstring

void rst_maskInc unsigned int *  target,
unsigned int  mask
 

Increment the masked portion of target.

Parameters:
target an IP address
mask an IP address
Precondition:
*target contains at least 4 bytes
Postcondition:
increment the masked portion of target, with rollover

the unmasked portion of target is unchanged

Returns:
0 for failure; non-zero for success


Generated on Sun Jul 18 17:30:56 2004 by doxygen 1.3.6