70 likes | 220 Views
General Purpose Functions. Utility Functions Account Security Functions. Utility Functions – IP Address Conversion. unsigned long NAInet_addr( char * addrp ); “dot” notation C string to unsigned long void NAInet_toa( unsigned long ipaddr , char *dest );
E N D
General Purpose Functions Utility Functions Account Security Functions
Utility Functions – IP Address Conversion • unsigned long NAInet_addr( char *addrp ); • “dot” notation C string to unsigned long • void NAInet_toa( unsigned long ipaddr, char *dest ); • Unsigned long to “dot” notation C string • Destination must be >= 16 characters
Utility Functions – System Tick • void NATotalTicks( unsigned long *hidest, unsigned long *lodest); • Returns total ticks from system start • *hidest, *lodest: pointers to target fields for high- and low-order portions of system clock. • unsigned long NADeltaTicks (unsigned long hiord, unsigned long loord); • Returns difference in ticks from supplied value to “now” • hiord, loord: high- and low-order portions of supplied value
Account Security Functions - get • unsigned int NAgetSysAccess (char *user, char *password, unsigned int *ipAddr); • For account name user, returns the account password in password • ipAddr points to an optional IP address filter • Returns account privilege, a combination of one or more from the following slide
Access Level Bit Settings • NASYSACC_LEVEL_R (read only) • NASYSACC_LEVEL_RW (read/write) • NASYSACC_LEVEL_HTTP_Rx (can access Web pages in the indicated security realm) • NASYSACC_LEVEL_GATEWAY (can be used for secure gateway) • NASYSACC_LEVEL_SNMP_R (defines SNMP public community string) • NASYSACC_LEVEL_SNMP_RW (defines SNMP private community string) • NASYSACC_LEVEL_ROOT (full privileges) • 0 – no privileges or NULL password
Account Security Functions – create/remove record • int NAsetSysAccess (unsigned int op, char *user, char *password, unsigned int level, char *ipAddr); • op: NASYSACC_ADD or NASYSACC_DEL • user: pointer to account name, default <= 80 bytes • password: pointer to password, default <= 80 bytes • level: same as previous slide • ipAddr: pointer to IP address as a C string in “dot” notation; allow account access from this IP address only. May be NULL. • Return: see next slide
NAsetSysAccess Return Codes • 0 (Success) • NASYSACC_INVALID_OPERATION • NASYSACC_INVALID_USERNAME • NASYSACC_DUPLICATE_USERNAME • NASYSACC_INVALID_PASSWORD • NASYSACC_INVALID_IPADDRESS • NASYSACC_INVALID_ACCOUNT • NASYSACC_DATABASE_FULL • NASYSACC_NOMEM