parse.h File Reference

Common parser APIs and return code definition. More...


Typedefs

typedef enum parse_retcode_e parse_retcode_t
 Return codes for the parse_xxx routines.

Enumerations

enum  parse_retcode_e { PARSE_OK = 0, PARSE_ERR = -1, PARSE_ERR_RESTRICT = -2 }
 Return codes for the parse_xxx routines. More...

Functions

int parse_number (const char *unparsed, int *number, int max)
 Gets a number from the unparsed buffer.
int parse_integer (const char *unparsed, int *number)
 Gets an integer from the unparsed buffer.
int parse_quad (const char *unparsed, quad_t *number)
 Gets a quad from the unparsed buffer.


Detailed Description

Common parser APIs and return code definition.


Enumeration Type Documentation

enum parse_retcode_e
 

Return codes for the parse_xxx routines.

Enumerator:
PARSE_OK  Everything parsed without errors.
PARSE_ERR  Could not grok the string.
PARSE_ERR_RESTRICT  Almost parsed, but failed some restriction.


Function Documentation

int parse_integer const char *  unparsed,
int *  number
 

Gets an integer from the unparsed buffer.

The integer can be specified in decimal or hexadecimal format.

Parameters:
[in] unparsed String to parse
[out] number Pointer to where parsed value should be stored
Returns:
0 if successful; -1 otherwise (errno will be set appropriately).

int parse_number const char *  unparsed,
int *  number,
int  max
 

Gets a number from the unparsed buffer.

The number must be between zero and max.

Parameters:
[in] unparsed String to parse
[out] number Pointer to where parsed value should be stored
[in] max Maximum value for the number
Returns:
TRUE if succesful; FALSE otherwise.

int parse_quad const char *  unparsed,
quad_t *  number
 

Gets a quad from the unparsed buffer.

The quad can be specified in decimal or hexadecimal format.

Parameters:
[in] unparsed String to parse
[out] number Pointer to where parsed value should be stored
Returns:
0 if successful; -1 otherwise (errno will be set appropriately).


2007-2009 Juniper Networks, Inc. All rights reserved. The information contained herein is confidential information of Juniper Networks, Inc., and may not be used, disclosed, distributed, modified, or copied without the prior written consent of Juniper Networks, Inc. in an express license. This information is subject to change by Juniper Networks, Inc. Juniper Networks, the Juniper Networks logo, and JUNOS are registered trademarks of Juniper Networks, Inc. in the United States and other countries. All other trademarks, service marks, registered trademarks, or registered service marks are the property of their respective owners.
Generated on Sun May 30 20:23:40 2010 for libjuniper by Doxygen 1.4.5