Applications
[Networking Stack]

Collaboration diagram for Applications:

Modules

 Echo Service
 Ping
 Networking tests

Files

file  parse.c
 

Generic application parsing functions implementation.


file  parse.h
 

Generic command line arguments parsing functions.


file  print_error.c
 

Generic application error printing functions implementation.


file  print_error.h
 

Generic application error printing functions.


Defines

#define IS_ICMP_ERROR(error_code)   ((error_code) > 0)
 Returns whether the error code may be an ICMP error code.
#define IS_SOCKET_ERROR(error_code)   ((error_code) < 0)
 Returns whether the error code may be socket error code.

Functions

int parse_address_family (const char *name)
 Translates the character string to the address family number.
int parse_parameter_int (int argc, char **argv, int *index, int *value, const char *name, int offset)
 Parses the next parameter as an integral number.
int parse_parameter_name_int (int argc, char **argv, int *index, int *value, const char *name, int offset, int(*parse_value)(const char *value))
 Parses the next named parameter as an integral number.
int parse_parameter_string (int argc, char **argv, int *index, char **value, const char *name, int offset)
 Parses the next parameter as a character string.
int parse_protocol_family (const char *name)
 Translates the character string to the protocol family number.
int parse_socket_type (const char *name)
 Translates the character string to the socket type number.
void print_unrecognized (int index, const char *parameter)
 Prints the parameter unrecognized message and the application help.
void icmp_print_error (FILE *output, int error_code, const char *prefix, const char *suffix)
 Prints the specific ICMP error description.
void print_error (FILE *output, int error_code, const char *prefix, const char *suffix)
 Prints the error description.
void socket_print_error (FILE *output, int error_code, const char *prefix, const char *suffix)
 Prints the specific socket error description.

Define Documentation

#define IS_ICMP_ERROR ( error_code   )     ((error_code) > 0)

Returns whether the error code may be an ICMP error code.

Parameters:
[in] error_code The error code.
Returns:
A value indicating whether the error code may be an ICMP error code.
#define IS_SOCKET_ERROR ( error_code   )     ((error_code) < 0)

Returns whether the error code may be socket error code.

Parameters:
[in] error_code The error code.
Returns:
A value indicating whether the error code may be a socket error code.

Function Documentation

void icmp_print_error ( FILE *  output,
int  error_code,
const char *  prefix,
const char *  suffix 
)

Prints the specific ICMP error description.

Parameters:
[in] output The description output stream. May be NULL.
[in] error_code The ICMP error code.
[in] prefix The error description prefix. May be NULL.
[in] suffix The error description suffix. May be NULL.
int parse_address_family ( const char *  name  ) 

Translates the character string to the address family number.

Parameters:
[in] name The address family name.
Returns:
The corresponding address family number.
EAFNOSUPPORTED if the address family is not supported.

Referenced by main().

Here is the caller graph for this function:

int parse_parameter_int ( int  argc,
char **  argv,
int *  index,
int *  value,
const char *  name,
int  offset 
)

Parses the next parameter as an integral number.

The actual parameter is pointed by the index. Parses the offseted actual parameter value if the offset is set or the next one if not.

Parameters:
[in] argc The total number of the parameters.
[in] argv The parameters.
[in,out] index The actual parameter index. The index is incremented by the number of processed parameters.
[out] value The parsed parameter value.
[in] name The parameter name to be printed on errors.
[in] offset The value offset in the actual parameter. If not set, the next parameter is parsed instead.
Returns:
EOK on success.
EINVAL if the parameter is missing.
EINVAL if the parameter is in wrong format.

Referenced by main().

Here is the caller graph for this function:

int parse_parameter_name_int ( int  argc,
char **  argv,
int *  index,
int *  value,
const char *  name,
int  offset,
int(*)(const char *value)  parse_value 
)

Parses the next named parameter as an integral number.

The actual parameter is pointed by the index. Uses the offseted actual parameter if the offset is set or the next one if not. Translates the parameter using the parse_value function. Increments the actual index by the number of processed parameters.

Parameters:
[in] argc The total number of the parameters.
[in] argv The parameters.
[in,out] index The actual parameter index. The index is incremented by the number of processed parameters.
[out] value The parsed parameter value.
[in] name The parameter name to be printed on errors.
[in] offset The value offset in the actual parameter. If not set, the next parameter is parsed instead.
[in] parse_value The translation function to parse the named value.
Returns:
EOK on success.
EINVAL if the parameter is missing.
ENOENT if the parameter name has not been found.

Referenced by main().

Here is the caller graph for this function:

int parse_parameter_string ( int  argc,
char **  argv,
int *  index,
char **  value,
const char *  name,
int  offset 
)

Parses the next parameter as a character string.

The actual parameter is pointed by the index. Uses the offseted actual parameter value if the offset is set or the next one if not. Increments the actual index by the number of processed parameters.

Parameters:
[in] argc The total number of the parameters.
[in] argv The parameters.
[in,out] index The actual parameter index. The index is incremented by the number of processed parameters.
[out] value The parsed parameter value.
[in] name The parameter name to be printed on errors.
[in] offset The value offset in the actual parameter. If not set, the next parameter is parsed instead.
Returns:
EOK on success.
EINVAL if the parameter is missing.

Referenced by main().

Here is the caller graph for this function:

int parse_protocol_family ( const char *  name  ) 

Translates the character string to the protocol family number.

Parameters:
[in] name The protocol family name.
Returns:
The corresponding protocol family number.
EPFNOSUPPORTED if the protocol family is not supported.

Referenced by main().

Here is the caller graph for this function:

int parse_socket_type ( const char *  name  ) 

Translates the character string to the socket type number.

Parameters:
[in] name The socket type name.
Returns:
The corresponding socket type number.
ESOCKNOSUPPORTED if the socket type is not supported.

Referenced by main().

Here is the caller graph for this function:

void print_error ( FILE *  output,
int  error_code,
const char *  prefix,
const char *  suffix 
)

Prints the error description.

Supports ICMP and socket error codes.

Parameters:
[in] output The description output stream. May be NULL.
[in] error_code The error code.
[in] prefix The error description prefix. May be NULL.
[in] suffix The error description suffix. May be NULL.

Referenced by main().

Here is the caller graph for this function:

void print_unrecognized ( int  index,
const char *  parameter 
)

Prints the parameter unrecognized message and the application help.

Parameters:
[in] index The index of the parameter.
[in] parameter The parameter name.

Referenced by main().

Here is the caller graph for this function:

void socket_print_error ( FILE *  output,
int  error_code,
const char *  prefix,
const char *  suffix 
)

Prints the specific socket error description.

Parameters:
[in] output The description output stream. May be NULL.
[in] error_code The socket error code.
[in] prefix The error description prefix. May be NULL.
[in] suffix The error description suffix. May be NULL.

Referenced by main().

Here is the caller graph for this function:


Generated on Thu Mar 11 20:48:16 2010 for Networking and TCP/IP stack for HelenOS system by  doxygen 1.6.1