parse_iso.h File Reference

Generalized ISO address/prefix parser APIs. More...


Defines

#define PISOF_ADDRESS   (1<<0)
 Want NSAP without prefix len.
#define ISO_NSAP_LEN_MIN   8
#define ISO_NSAP_LEN_MAX   20
#define ISO_SYSID_LEN   6
#define ISO_SYSID_ASCII_LEN_MAX   14

Functions

boolean parse_is_iso_addr (const char *str)
 Simple check if string is potentially an ISO address.
parse_retcode_t parse_iso_addr (const char *str, u_int32_t parse_flags, u_int8_t *address, u_int8_t *address_size, int *pfxseen, u_int16_t *pfxlen, char *errmsg, int errmsglen)
 Parses the various forms of ISO addresses directed by parse_flags (PISOF_*).
boolean parse_is_iso_sysid (const char *str)
 Performs a simple check to see if a string is potentially an ISO system-id.
void format_iso_addr (u_int8_t *addr, u_int8_t alen, int pfxseen, u_int16_t pfxlen, char *out, size_t len)
 Formats a string representation of an ISO address.
parse_retcode_t parse_iso_sysid (const char *str, u_int8_t *sysid_ptr, size_t sysid_size, char *errmsg, int errmsglen)
 Parses the ISO system-id string.
void format_iso_sysid (u_int8_t *sysid, char *out, size_t len)
 Formats a string representation of an ISO system-id.


Detailed Description

Generalized ISO address/prefix parser APIs.


Function Documentation

void format_iso_addr u_int8_t *  addr,
u_int8_t  alen,
int  pfxseen,
u_int16_t  pfxlen,
char *  out,
size_t  len
 

Formats a string representation of an ISO address.

Parameters:
[in] addr Pointer to the addres (in network byte order)
[in] alen Size of the address buffer
[in] pfxseen Add the prefix length to the formatted output
[in] pfxlen Prefix length
[out] out Output buffer for result string
[in] len Size of the output buffer

void format_iso_sysid u_int8_t *  sysid,
char *  out,
size_t  len
 

Formats a string representation of an ISO system-id.

The system-id string will be of the form: XXXX.XXXX.XXXX

Parameters:
[in] sysid Pointer to the buffer containing the system-id (it should be ISO_SYSID_LEN bytes long)
[out] out Output buffer for result string
[in] len Size of the output buffer

boolean parse_is_iso_addr const char *  str  ) 
 

Simple check if string is potentially an ISO address.

Checks...

  • All chars must be either hex or '.' or '/'
  • Must have at least ISO_NSAP_LEN_MIN * 2 nibbles.
  • Must have at least 4 '.'
Note:
The full parse routine can still encounter errors if this function returns TRUE.
Parameters:
[in] str String to check for ISO address
Returns:
TRUE if the string could not have been an IP address or ATM VPN, however it does not guarantee that the string is an ISO address; FALSE otherwise.

boolean parse_is_iso_sysid const char *  str  ) 
 

Performs a simple check to see if a string is potentially an ISO system-id.

Checks...

  • All chars must be either hex or '.'
  • Each segment must be 1-4 hex digits
  • Must have at least 3 '.'
Note:
The full parse routine can still encounter errors if this function returns TRUE.
Parameters:
[in] str String to check for ISO address
Returns:
TRUE if the string could not have been an IP address or ATM VPN, however it does not guarantee that the string is an ISO address; FALSE otherwise.

parse_retcode_t parse_iso_addr const char *  str,
u_int32_t  parse_flags,
u_int8_t *  address,
u_int8_t *  address_size,
int *  pfxseen,
u_int16_t *  pfxlen,
char *  errmsg,
int  errmsglen
 

Parses the various forms of ISO addresses directed by parse_flags (PISOF_*).

Parameters:
[in] str Address to be parsed
[in] parse_flags Directs parsing of str (see PISOF_ flags)
[out] address Result address (in network byte order)
[out] address_size Size of result address buffer, in bytes
[out] pfxseen Prefix length (/'pfxlen') was seen in string
[out] pfxlen Result prefix length. Default is the maximum value.
[out] errmsg When an error occurs, the error message is written here
[in] errmsglen Size of the message buffer
Returns:
Status of parsing the string:
  • PARSE_OK on success
  • PARSE_ERR could not grok the string, likely not an address
  • PARSE_ERR_RESTRICT string is an address, but failed some restriction

parse_retcode_t parse_iso_sysid const char *  str,
u_int8_t *  sysid_ptr,
size_t  sysid_size,
char *  errmsg,
int  errmsglen
 

Parses the ISO system-id string.

The system-id string will be of the form: XXXX.XXXX.XXXX

Parameters:
[in] str Address to be parsed
[out] sysid_ptr Result address (in network byte order)
[in] sysid_size Size of the result address buffer
[out] errmsg When an error occurs, the error message is written here
[in] errmsglen Size of the message buffer
Returns:
Status of parsing the string:
  • PARSE_OK on success
  • PARSE_ERR could not grok the string, likely not an 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