Changeset View
Changeset View
Standalone View
Standalone View
lib/libtacplus/taclib_private.h
Show First 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | |||||
#define TAC_AUTHEN 0x01 /* Authentication */ | #define TAC_AUTHEN 0x01 /* Authentication */ | ||||
#define TAC_AUTHOR 0x02 /* Authorization */ | #define TAC_AUTHOR 0x02 /* Authorization */ | ||||
#define TAC_ACCT 0x03 /* Accouting */ | #define TAC_ACCT 0x03 /* Accouting */ | ||||
/* Protocol header flags */ | /* Protocol header flags */ | ||||
#define TAC_UNENCRYPTED 0x01 | #define TAC_UNENCRYPTED 0x01 | ||||
#define TAC_SINGLE_CONNECT 0x04 | #define TAC_SINGLE_CONNECT 0x04 | ||||
struct tac_server { | struct tac_str { | ||||
struct sockaddr_in addr; /* Address of server */ | char *data; | ||||
char *secret; /* Shared secret */ | |||||
int timeout; /* Timeout in seconds */ | |||||
int flags; | |||||
}; | |||||
/* | |||||
* An optional string of bytes specified by the client for inclusion in | |||||
* a request. The data is always a dynamically allocated copy that | |||||
* belongs to the library. It is copied into the request packet just | |||||
* before sending the request. | |||||
*/ | |||||
struct clnt_str { | |||||
void *data; | |||||
size_t len; | size_t len; | ||||
}; | }; | ||||
/* | |||||
* An optional string of bytes from a server response. The data resides | |||||
* in the response packet itself, and must not be freed. | |||||
*/ | |||||
struct srvr_str { | |||||
const void *data; | |||||
size_t len; | |||||
}; | |||||
struct tac_authen_start { | struct tac_authen_start { | ||||
u_int8_t action; | u_int8_t action; | ||||
u_int8_t priv_lvl; | u_int8_t priv_lvl; | ||||
u_int8_t authen_type; | u_int8_t authen_type; | ||||
u_int8_t service; | u_int8_t service; | ||||
u_int8_t user_len; | u_int8_t user_len; | ||||
u_int8_t port_len; | u_int8_t port_len; | ||||
u_int8_t rem_addr_len; | u_int8_t rem_addr_len; | ||||
▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | union { | ||||
struct tac_author_request author_request; | struct tac_author_request author_request; | ||||
struct tac_author_response author_response; | struct tac_author_response author_response; | ||||
struct tac_acct_start acct_start; | struct tac_acct_start acct_start; | ||||
struct tac_acct_reply acct_reply; | struct tac_acct_reply acct_reply; | ||||
unsigned char body[BODYSIZE]; | unsigned char body[BODYSIZE]; | ||||
} u; | } u; | ||||
}; | }; | ||||
struct tac_server { | |||||
struct sockaddr_in addr; /* Address of server */ | |||||
char *secret; /* Shared secret */ | |||||
int timeout; /* Timeout in seconds */ | |||||
int flags; | |||||
unsigned int navs; | |||||
struct tac_str avs[MAXAVPAIRS]; | |||||
}; | |||||
struct tac_handle { | struct tac_handle { | ||||
int fd; /* Socket file descriptor */ | int fd; /* Socket file descriptor */ | ||||
struct tac_server servers[MAXSERVERS]; /* Servers to contact */ | struct tac_server servers[MAXSERVERS]; /* Servers to contact */ | ||||
int num_servers; /* Number of valid server entries */ | int num_servers; /* Number of valid server entries */ | ||||
int cur_server; /* Server we are currently using */ | int cur_server; /* Server we are currently using */ | ||||
int single_connect; /* Use a single connection */ | int single_connect; /* Use a single connection */ | ||||
int last_seq_no; | int last_seq_no; | ||||
char errmsg[ERRSIZE]; /* Most recent error message */ | char errmsg[ERRSIZE]; /* Most recent error message */ | ||||
struct clnt_str user; | struct tac_str user; | ||||
struct clnt_str port; | struct tac_str port; | ||||
struct clnt_str rem_addr; | struct tac_str rem_addr; | ||||
struct clnt_str data; | struct tac_str data; | ||||
struct clnt_str user_msg; | struct tac_str user_msg; | ||||
struct clnt_str avs[MAXAVPAIRS]; | struct tac_str avs[MAXAVPAIRS]; | ||||
struct tac_msg request; | struct tac_msg request; | ||||
struct tac_msg response; | struct tac_msg response; | ||||
int srvr_pos; /* Scan position in response body */ | int srvr_pos; /* Scan position in response body */ | ||||
struct srvr_str srvr_msg; | unsigned int srvr_navs; | ||||
struct srvr_str srvr_data; | struct tac_str srvr_msg; | ||||
struct srvr_str srvr_avs[MAXAVPAIRS]; | struct tac_str srvr_data; | ||||
struct tac_str srvr_avs[MAXAVPAIRS]; | |||||
}; | }; | ||||
#define is_alpha(ch) /* alphabetical */ \ | |||||
(((ch) >= 'A' && (ch) <= 'Z') || ((ch) >= 'a' && (ch) <= 'z')) | |||||
#define is_num(ch) /* numerical */ \ | |||||
((ch) >= '0' && (ch) <= '9') | |||||
#define is_alnum(ch) /* alphanumerical */ \ | |||||
(is_alpha(ch) || is_num(ch)) | |||||
#define is_arg(ch) /* valid in an argument name */ \ | |||||
(is_alnum(ch) || (ch) == '_' || (ch) == '-') | |||||
#endif | #endif |