File modules/wk/which_keytypes.c

  $Revision: 1.9 $

Example code: Determine which keys to look for.
This is based on the C code that was reversed engineered from existing Perl code. (~ottrey/which_table/which_table.c)

Included Files


Preprocessor definitions

#define DOMAINNAME "^[ ]*[a-zA-Z0-9--]*(\\.[a-zA-Z0-9--]+)*[ ]*$"

#define LEN_MIN 0

#define LEN_MAX 32

#define NETLEN 16

#define NETQUADS 4

#define NETQUAD_MIN 0

#define NETQUAD_MAX 255

#define ASNUM_MIN 1

#define ASNUM_MAX 65535

#define ASNUM_NUMOFFSET 2

#define VALIDIP6 "^[0-9A-F]{1,4}(:[0-9A-F]{1,4}){7}$"

#define NET "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$"

#define ASNUM "^AS[1-9]+[0-9]*$"

#define NETNAME "^[A-Z][A-Z0-9-]*$"

#define MAINTAINER "^[A-Z][A-Z0-9-]*$"

#define LIMERICK "^LIM-[A-Z0-9-]+$"

#define KEYCERT "^PGPKEY-[0-9A-F]{8}$"

#define ASMACRO "^AS-[A-Z]+$"

#define ROUTESETNAME "^RS-[A-Z0-9-]*$"

#define ASSETNAME "^AS-[A-Z0-9-]*$"

#define AUTONICPREFIXREGULAR "^AUTO-"

#define NAME_B "^[a-zA-Z][a-zA-Z_0-9.'|`;:,?/}{()+*#&-]*$"

#define PHONE_A "^[ ]*[+][0-9 ]*[(]{0,1}[0-9 -]+[)]{0,1}[0-9 -]*(ext\\.){0,1}[0-9 ]*$"

#define VALIDIP4PREFIX

#define EMAIL "^[.a-zA-Z0-9--]*@[a-zA-Z0-9--]*(\\.[a-zA-Z0-9--]+)*$"

#define IPRANGE "^[0-9./ -]*$"


Global Variable nicpostfix

char* nicpostfix[]
Included from modules/wk/isnic.h
Visible in:  modules/wk/which_keytypes.c
Used in: isnichandle_joao()modules/wk/which_keytypes.c

Global Variable special

char* special[]
Included from modules/wk/isnic.h
Visible in:  modules/wk/which_keytypes.c
Used in: isnichandle_joao()modules/wk/which_keytypes.c

Global Variable countries

char* countries[]
Included from modules/wk/isnic.h
Visible in:  modules/wk/which_keytypes.c
Used in: isnichandle_joao()modules/wk/which_keytypes.c

Global Variable Keytypes

Keytype strings

char* const Keytypes[]
Visible in:  modules/wk/which_keytypes.c
Used in: WK_to_string()modules/wk/which_keytypes.c


Global Variable Peerword

Peerword strings

const char* Peerword[]
Visible in:  modules/wk/which_keytypes.c
Used in: ispeerkeyword()modules/wk/which_keytypes.c


Global Function WK_new()

  Create a new which keytypes bitmap.

More:
  Authors:
        ottrey
Online References:
mask_t WK_new ( char* key )
char* key
The key to be examined.
Prototyped in: modules/wk/which_keytypes.h
Calls: MA_new()modules/ma/bitmask.c
  MA_set()modules/ma/bitmask.c
  wk_is_assetname()modules/wk/which_keytypes.c
  wk_is_autnum()modules/wk/which_keytypes.c
  wk_is_domain()modules/wk/which_keytypes.c
  wk_is_email()modules/wk/which_keytypes.c
  wk_is_hostname()modules/wk/which_keytypes.c
  wk_is_ip6prefix()modules/wk/which_keytypes.c
  wk_is_ipprefix()modules/wk/which_keytypes.c
  wk_is_iprange()modules/wk/which_keytypes.c
  wk_is_key_cert()modules/wk/which_keytypes.c
  wk_is_limerick()modules/wk/which_keytypes.c
  wk_is_mntner()modules/wk/which_keytypes.c
  wk_is_name()modules/wk/which_keytypes.c
  wk_is_net6name()modules/wk/which_keytypes.c
  wk_is_netname()modules/wk/which_keytypes.c
  wk_is_nic_hdl()modules/wk/which_keytypes.c
  wk_is_routesetname()modules/wk/which_keytypes.c

Global Function WK_to_string()

  Convert the which keytypes bitmap into a string.

More:
  Authors:
        ottrey
Online References:
char* WK_to_string ( mask_t wk )
mask_t wk
The which keytypes mask to be converted.
Prototyped in: modules/wk/which_keytypes.h
Calls: MA_to_string()modules/ma/bitmask.c
References Variables: Keytypesmodules/wk/which_keytypes.c

Local Function isaskeyword()

static int isaskeyword ( char* string )

Local Function isasmacro()

static int isasmacro ( char* string )
Calls: perform_regex_test()modules/wk/which_keytypes.c

Local Function isasnum()

static int isasnum ( char* string )
Calls: perform_regex_test()modules/wk/which_keytypes.c
  atoi()
Called by: wk_is_autnum()modules/wk/which_keytypes.c

Local Function isaspref()

static int isaspref ( char* string )

Local Function isbrace()

static int isbrace ( char* string )
Calls: matching()modules/wk/which_keytypes.c

Local Function isclnskeyword()

static int isclnskeyword ( char* string )

Local Function isclnsprefix()

static int isclnsprefix ( char* string )

Local Function iscommunity()

static int iscommunity ( char* string )

Local Function isdomname()

static int isdomname ( char* string )
Calls: perform_regex_test()modules/wk/which_keytypes.c
Called by: wk_is_domain()modules/wk/which_keytypes.c
  wk_is_hostname()modules/wk/which_keytypes.c

Local Function isemail()

static int isemail ( char* string )
Calls: perform_regex_test()modules/wk/which_keytypes.c
Called by: wk_is_email()modules/wk/which_keytypes.c

Local Function isipaddr()

static int isipaddr ( char* string )

Local Function isipv6prefix()

static int isipv6prefix ( char* string )

Local Function isipv6prefix_a()

static int isipv6prefix_a ( char* string )
Calls: perform_regex_test()modules/wk/which_keytypes.c
Called by: wk_is_ip6prefix()modules/wk/which_keytypes.c

Local Function islen()

static int islen ( char* string )
Calls: strlen()

Local Function islimerick()

static int islimerick ( char* string )
Calls: perform_regex_test()modules/wk/which_keytypes.c
Called by: wk_is_limerick()modules/wk/which_keytypes.c

Local Function ismaintainer()

static int ismaintainer ( char* string )
Calls: perform_regex_test()modules/wk/which_keytypes.c
Called by: wk_is_mntner()modules/wk/which_keytypes.c

Local Function ismask()

static int ismask ( char* string )

Local Function isname()

static int isname ( char* string )

Local Function isname_a()

static int isname_a ( char* string )
Calls: perform_regex_test()modules/wk/which_keytypes.c
Called by: isname_ab()modules/wk/which_keytypes.c

Local Function isname_ab()

static int isname_ab ( char* string )
Calls: isname_a()modules/wk/which_keytypes.c
  isname_b()modules/wk/which_keytypes.c

Local Function isname_b()

static int isname_b ( char* string )
Calls: perform_regex_test()modules/wk/which_keytypes.c
Called by: isname_ab()modules/wk/which_keytypes.c

Local Function isnet()

static int isnet ( char* string )
Calls: perform_regex_test()modules/wk/which_keytypes.c
  atoi(), g_strsplit()
Called by: isnetnum()modules/wk/which_keytypes.c

Local Function isnetlist()

static int isnetlist ( char* string )

Local Function isnetname()

static int isnetname ( char* string )
Calls: perform_regex_test()modules/wk/which_keytypes.c
Called by: wk_is_net6name()modules/wk/which_keytypes.c
  wk_is_netname()modules/wk/which_keytypes.c

Local Function isnetnum()

static int isnetnum ( char* string )
Calls: isnet()modules/wk/which_keytypes.c

Local Function isnichandle()

static int isnichandle ( char* string )
Prototyped in: modules/wk/isnic.h
Calls: isnichandle_joao()modules/wk/which_keytypes.c
Called by: wk_is_nic_hdl()modules/wk/which_keytypes.c

Local Function isnichandle_joao()

static int isnichandle_joao ( char* nichdl )
Calls: free(), regcmp(), regex(), strcmp()
Called by: isnichandle()modules/wk/which_keytypes.c
References Variables: countriesmodules/wk/which_keytypes.c
  nicpostfixmodules/wk/which_keytypes.c
  specialmodules/wk/which_keytypes.c

Local Function isparen()

static int isparen ( char* string )
Calls: matching()modules/wk/which_keytypes.c
Called by: isphone_b()modules/wk/which_keytypes.c

Local Function ispeerkeyword()

static int ispeerkeyword ( char* string )
Calls: strcmp()
References Variables: Peerwordmodules/wk/which_keytypes.c

Local Function isphone()

static int isphone ( char* string )

Local Function isphone_a()

static int isphone_a ( char* string )
Calls: perform_regex_test()modules/wk/which_keytypes.c
Called by: isphone_ab()modules/wk/which_keytypes.c

Local Function isphone_ab()

static int isphone_ab ( char* string )
Calls: isphone_a()modules/wk/which_keytypes.c
  isphone_b()modules/wk/which_keytypes.c

Local Function isphone_b()

static int isphone_b ( char* string )
Calls: isparen()modules/wk/which_keytypes.c
Called by: isphone_ab()modules/wk/which_keytypes.c

Local Function issubdomname()

static int issubdomname ( char* string )
Calls: perform_regex_test()modules/wk/which_keytypes.c

Local Function matching()

static int matching ( char* string, char left_c, char right_c )
Calls: strlen()
Called by: isbrace()modules/wk/which_keytypes.c
  isparen()modules/wk/which_keytypes.c

Local Function perform_regex_test()

static int perform_regex_test ( const char* pattern, char* string )
Calls: free(), regcmp(), regex()
Called by: isasmacro()modules/wk/which_keytypes.c
  isasnum()modules/wk/which_keytypes.c
  isdomname()modules/wk/which_keytypes.c
  isemail()modules/wk/which_keytypes.c
  isipv6prefix_a()modules/wk/which_keytypes.c
  islimerick()modules/wk/which_keytypes.c
  ismaintainer()modules/wk/which_keytypes.c
  isname_a()modules/wk/which_keytypes.c
  isname_b()modules/wk/which_keytypes.c
  isnet()modules/wk/which_keytypes.c
  isnetname()modules/wk/which_keytypes.c
  isphone_a()modules/wk/which_keytypes.c
  issubdomname()modules/wk/which_keytypes.c
  wk_is_assetname()modules/wk/which_keytypes.c
  wk_is_iprange()modules/wk/which_keytypes.c
  wk_is_key_cert()modules/wk/which_keytypes.c
  wk_is_routesetname()modules/wk/which_keytypes.c

Local Function wk_is_assetname()

static int wk_is_assetname ( char* key )
Calls: perform_regex_test()modules/wk/which_keytypes.c
Called by: WK_new()modules/wk/which_keytypes.c

Local Function wk_is_autnum()

static int wk_is_autnum ( char* key )
Calls: isasnum()modules/wk/which_keytypes.c
Called by: WK_new()modules/wk/which_keytypes.c

Local Function wk_is_domain()

static int wk_is_domain ( char* key )
Calls: isdomname()modules/wk/which_keytypes.c
Called by: WK_new()modules/wk/which_keytypes.c

Local Function wk_is_email()

static int wk_is_email ( char* key )
Calls: isemail()modules/wk/which_keytypes.c
Called by: WK_new()modules/wk/which_keytypes.c

Local Function wk_is_hostname()

static int wk_is_hostname ( char* key )
Calls: isdomname()modules/wk/which_keytypes.c
  wk_is_iprange()modules/wk/which_keytypes.c
Called by: WK_new()modules/wk/which_keytypes.c

Local Function wk_is_ip6prefix()

static int wk_is_ip6prefix ( char* key )
Calls: isipv6prefix_a()modules/wk/which_keytypes.c
Called by: WK_new()modules/wk/which_keytypes.c

Local Function wk_is_ipprefix()

static int wk_is_ipprefix ( char* key )
Called by: WK_new()modules/wk/which_keytypes.c

Local Function wk_is_iprange()

static int wk_is_iprange ( char* key )
Calls: perform_regex_test()modules/wk/which_keytypes.c
Called by: WK_new()modules/wk/which_keytypes.c
  wk_is_hostname()modules/wk/which_keytypes.c

Local Function wk_is_key_cert()

static int wk_is_key_cert ( char* key )
Calls: perform_regex_test()modules/wk/which_keytypes.c
Called by: WK_new()modules/wk/which_keytypes.c

Local Function wk_is_limerick()

static int wk_is_limerick ( char* key )
Calls: islimerick()modules/wk/which_keytypes.c
Called by: WK_new()modules/wk/which_keytypes.c

Local Function wk_is_mntner()

static int wk_is_mntner ( char* key )
Calls: ismaintainer()modules/wk/which_keytypes.c
Called by: WK_new()modules/wk/which_keytypes.c

Local Function wk_is_name()

static int wk_is_name ( char* key )
Called by: WK_new()modules/wk/which_keytypes.c

Local Function wk_is_net6name()

static int wk_is_net6name ( char* key )
Calls: isnetname()modules/wk/which_keytypes.c
Called by: WK_new()modules/wk/which_keytypes.c

Local Function wk_is_netname()

static int wk_is_netname ( char* key )
Calls: isnetname()modules/wk/which_keytypes.c
Called by: WK_new()modules/wk/which_keytypes.c

Local Function wk_is_nic_hdl()

static int wk_is_nic_hdl ( char* key )
Calls: isnichandle()modules/wk/which_keytypes.c
Called by: WK_new()modules/wk/which_keytypes.c

Local Function wk_is_routesetname()

static int wk_is_routesetname ( char* key )
Calls: perform_regex_test()modules/wk/which_keytypes.c
Called by: WK_new()modules/wk/which_keytypes.c