parse_delim_addr.h File Reference

Generalized delimited address parser APIs. More...


Defines

#define FC_ADDRESS_BUF_SZ   12
 Given a string return the length of buffer needed to store this entry in its native format.
#define FC_ADDRESS_DIGIT   9
#define FC_ADDRESS_LEN   3
#define FC_ADDRESS_DELIM   '.'
#define WWN_BUF_SZ   24
 Given a string return the length of buffer needed to store this entry in its native format.
#define WWN_DIGIT   16
#define WWN_LEN   8
#define WWN_DELIM   ':'

Functions

parse_retcode_t parse_delim_hex_addr (const char *str, u_char *address, char *errmsg, size_t errmsgsize, size_t addr_len)
 Parses a fc address in form of XXX.XXX.XXX, using '.
parse_retcode_t parse_delim_dec_addr (const char *str, u_char *address, char *errmsg, size_t errmsgsize, size_t addr_len)
int format_delim_addr (char *buf, size_t bufsz, u_char *fc, const char delim, size_t datablk, char base)
 Formats the delimited address.


Detailed Description

Generalized delimited address parser APIs.


Define Documentation

#define FC_ADDRESS_BUF_SZ   12
 

Given a string return the length of buffer needed to store this entry in its native format.

For an FC Address this should never take more than XXX.XXX.XXX bytes (12).

#define WWN_BUF_SZ   24
 

Given a string return the length of buffer needed to store this entry in its native format.

For a World Wide Name, this should never take more than XX:XX:XX:XX:XX:XX:XX:XX bytes (24).


Function Documentation

int format_delim_addr char *  buf,
size_t  bufsz,
u_char *  fc,
const char  delim,
size_t  datablk,
char  base
 

Formats the delimited address.

Address comes out in the form of xx.xx.xx or xx:xx:xx:xx:xx:xx

Parameters:
[out] buf Output buffer
[in] bufsz Size of output buffer
[in] fc delimited address
[in] prefix Prefix length should be appened to the end of buffer
[in] plen Prefix length
Returns:
The number of characters written into the buffer, not including the null-terminator character.

parse_retcode_t parse_delim_hex_addr const char *  str,
u_char *  address,
char *  errmsg,
size_t  errmsgsize,
size_t  addr_len
 

Parses a fc address in form of XXX.XXX.XXX, using '.

' as delimiters, or XX:XX:XX:XX:XX:XX:XX, using ':' as delimiters.

Parameters:
[in] str Address to be parsed
[out] address Result address
[out] errmsg When an error occurs, the error message is written here
[in] errmsgsize Size of the message buffer
Returns:
Status of parsing the string:
  • PARSE_OK on success
  • PARSE_ERR could not grok the string, likely not a MAC address
  • PARSE_ERR_RESTRICT string is an address, but failed some restriction


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:24:32 2010 for libjuniper by Doxygen 1.4.5