📄 text_param.h
字号:
* NUMBER_RANGE, not NUMBER * Stores the list of allowed values (for negotiation) */ char *value_list; /* Contains all the info required for negotiating this parameter * packed into bits */ __u32 neg_info; /* One of the bits in this word will be set if this key * requires "special" processing -- each key defines * its own special bit */ __u64 special_key_flag;};/* chap and srp support - CHONG */struct auth_parameter_type { int auth_flags; struct CHAP_Context *chap_local_ctx; struct CHAP_Context *chap_peer_ctx; struct SRP_Context *srp_ctx;};/* Macros for checking the type */#define IS_SECURITY_PARAM(p) ((p) & SECURITY_PARAM)#define IS_OPERATIONAL_PARAM(p) ((p) & OPERATIONAL_PARAM)#define IS_INFORMATIONAL_PARAM(p) ((p) & INFORMATIONAL_PARAM)#define IS_LEADING_ONLY(p) ((p) & LEADING_ONLY)#define IS_INITIAL_ONLY(p) ((p) & INITIAL_ONLY)#define IS_FULL_FEATURE_ONLY(p) ((p) & FULL_FEATURE_ONLY)#define IS_USE_BY_INITIATOR(p) ((p) & USE_BY_INITIATOR)#define IS_USE_BY_TARGET(p) ((p) & USE_BY_TARGET)#define IS_KEY_SINGLE_VALUE(p) ((p) & KEY_SINGLE_VALUE)#define IS_KEY_TWO_VALUE(p) ((p) & KEY_TWO_VALUE)#define IS_KEY_MULTI_VALUE(p) ((p) & KEY_MULTI_VALUE)#define IS_KEY_NO_VALUE(p) ((p) & KEY_NO_VALUE)#define IS_NUMBER(p) ((p) & NUMBER)#define IS_NUMBER_RANGE(p) ((p) & NUMBER_RANGE)#define IS_MAX_NUMBER(p) ((p) & MAX_NUMBER)#define IS_MIN_NUMBER(p) ((p) & MIN_NUMBER)#define IS_STRING(p) ((p) & STRING)#define IS_ENUMERATED(p) ((p) & ENUMERATED)#define IS_BOOL_AND(p) ((p) & BOOL_AND)#define IS_BOOL_OR(p) ((p) & BOOL_OR)#define IS_BOOLEAN(p) ((p) & (BOOL_AND|BOOL_OR))/* If the type is number */#define IS_ONE_TO_65535(p) ((p) & ONE_TO_65535)#define IS_ZERO_TO_65535(p) ((p) & ZERO_TO_65535)#define IS_N512_TO_16777215(p) ((p) & N512_TO_16777215)#define IS_ZERO_TO_3600(p) ((p) & ZERO_TO_3600)#define IS_ZERO_TO_2(p) ((p) & ZERO_TO_2)/* If the type is string */#define IS_UTF_8(p) (IS_STRING((p)) && ((p) & UTF_8))#define IS_ISCSI_NAME(p) (IS_STRING((p)) && ((p) & ISCSI_NAME))#define IS_TARGET_ADDRESS_TYPE(p)(IS_STRING((p)) && ((p) & TARGET_ADDRESS_TYPE))/* If the type is ENUMERATED */#define IS_DIGEST_PARAM(p) ((p) & DIGEST_PARAM)#define IS_AUTH_PARAM(p) ((p) & AUTH_PARAM)#define IS_DISCOVERY_NORMAL(p) ((p) & DISCOVERY_NORMAL)/**********************************************************************//* Macros to test bits used in the "neg_info" variable and key field */#define IS_KEY_TO_BE_NEGOTIATED(p) ((p) & KEY_TO_BE_NEGOTIATED)#define IS_KEY_BREAK_CONN_OR_RJT(p) ((p) & KEY_BREAK_CONN_OR_RJT)#define IS_KEY_SENT_TO_OTHER_SIDE(p) ((p) & KEY_SENT_TO_OTHER_SIDE)#define IS_KEY_GOT_FROM_OTHER_SIDE(p) ((p) & KEY_GOT_FROM_OTHER_SIDE)#define IS_KEY_REPLY_OPTIONAL(p) ((p) & KEY_REPLY_OPTIONAL)#define IS_KEY_IRRELEVANT(p) ((p) & KEY_IRRELEVANT)#define IS_KEY_BAD(p) ((p) & KEY_BAD)#define IS_KEY_REJECT(p) ((p) & KEY_REJECT)struct key_values { char *yes; char *no; char *none; char *reject; char *irrelevant; char *discovery; char *normal; char *notunderstood;};/* structure used to keep a list of unknown keys sent to us * chap and srp support - CHONG */struct unknown_key { __u32 processed; char *keyname; char *keyvalue; struct unknown_key *next;};/* maximum number of unkown keys we will accept before terminating login */#define MAX_UNKNOWN_KEYS 8/************************************************************************//* deal with security keys *//************************************************************************//* returns 0 on failure, else GOT_XXX value for this key */__u32 __attribute__ ((no_instrument_function))is_securitykey(char *keyname);/* returns 0 on failure after printing error message, * else GOT_XXX value for this key */__u32 __attribute__ ((no_instrument_function))print_bad_security_key(struct unknown_key *key);void __attribute__ ((no_instrument_function))print_not_allowed_security_key(struct unknown_key *key);/* called once on module load to setup the security key hash table */void setup_security_hash_table(void);/* Called to get table entry for key identified by keytext string. * Returns pointer to entry if found, NULL if not found. */struct parameter_type * __attribute__ ((no_instrument_function))find_parameter(char *keytext, struct parameter_type p_param_tbl[MAX_CONFIG_PARAMS]);/* Called to get pointer to table entry for key identified by its special flag*/struct parameter_type * __attribute__ ((no_instrument_function))find_flag_parameter(__u64 key_flag, struct parameter_type p_param_tbl[MAX_CONFIG_PARAMS]);/* Called to set max_recv_length to value we sent to target in a * MaxRecvDataSegmentLength key */voidset_connection_recv_length(struct parameter_type p_param_tbl[MAX_CONFIG_PARAMS], int *max_recv_length);voidset_digestflags(struct parameter_type p_param_tbl[MAX_CONFIG_PARAMS], __u32 * connection_flags);/* Check that a number is within legal bounds depending on its type. * Returns 1 if ok, 0 if error */int __attribute__ ((no_instrument_function))check_bounds(struct parameter_type *p, int int_value, int who_called);/* This is a range, check both numbers and their order. * Returns first number in range if ok, -1 if error */int __attribute__ ((no_instrument_function))check_range(char *value_list, int value);char * __attribute__ ((no_instrument_function))strdup(char *str);void __attribute__ ((no_instrument_function))strreplace(char **str, char *new_str);/* Copy src parameter table to dst, duplicating any strings */voidparam_tbl_cpy(struct parameter_type dst[MAX_CONFIG_PARAMS], struct parameter_type src[MAX_CONFIG_PARAMS]);/* Copy initial parameter table to dst, duplicating any strings */voidparam_tbl_init(struct parameter_type dst[MAX_CONFIG_PARAMS]);/* Free any strings referenced in dst parameter table */voidparam_tbl_uncpy(struct parameter_type dst[MAX_CONFIG_PARAMS]);voidconfigure_parameter(int param_neg_info, char *ptr_to_keytext, struct parameter_type p_param_tbl[MAX_CONFIG_PARAMS]);/* Draft 20, Section 5.2 Text Mode Negotiation * "Some parameters may be subject to integrity rules (e.g., parameter-x * must not exceed parameter-y or parameter-u not 1 implies parameter-v * be Yes). Whenever required, integrity rules are specified with the * keys. Checking for compliance with the integrity rule must only be * performed after all the parameters are available (the existent and the * newly negotiated). An iSCSI target MUST perform integrity checking * before the new parameters take effect. An initiator MAY perform * integrity checking." */voidcheck_integrity_rules(struct parameter_type p_param_tbl[MAX_CONFIG_PARAMS], __u16 secondary_connection);struct socket;/************************************************************************//* This function receives 'length' bytes into buffer from the socket *//************************************************************************/intiscsi_recv_msg(struct socket *sock, int length, char *buffer, int flags);/* * returns 1 if needs a break from the loop * else returns a 0 */int __attribute__ ((no_instrument_function))check_out_length(int out_length, int resp_len);/* * sends the PDUs to the other end. */intiscsi_send_msg(struct socket *sock, struct generic_pdu *outputpdu, int flags);/* * checks whether the receiving side has received all the responses * for the negotiations it started in the last packet. * Return: * -1 if error, didn't receive the response * 0 if success */intcheck_neg_responses(struct parameter_type p_param_tbl[MAX_CONFIG_PARAMS], __u32 print_error);/* * scan through the input and process keys * p_param_tbl - pointer to the table of parameters * sock - pointer to the socket structure * process_these_types - types of parameters to be processed. * flags_to_be_set - Which flags to set * role - who is calling (INITIATOR/TARGET) * Return: returns the length of the string added to the output string */intscan_input_and_process(struct socket *sock, struct parameter_type p_param_tbl[MAX_CONFIG_PARAMS], int process_these_types, int flags_to_be_set, int role, int *max_send_length, __u32 when_called, struct generic_pdu *inputpdu, struct generic_pdu *outputpdu, __u32 flags, __u64 * login_flags, struct unknown_key **unknown_key_list);/* * scan through the table and count the keys of each type * that still remain to be negotiated * p_param_tbl - pointer to the table of parameters * returns counts in last 3 parameters */voidscan_table_and_count(struct parameter_type p_param_tbl[MAX_CONFIG_PARAMS], int *nsecurity, int *ninformational, int *noperational);/* * scan through the table and process keys * p_param_tbl - pointer to the table of parameters * process_these_types - types of parameters to be processed. * Return: returns the length of the string added to the output string */intscan_table_and_process(struct socket *sock, struct parameter_type p_param_tbl[MAX_CONFIG_PARAMS], int process_these_types, int flags_to_be_set, int role, struct generic_pdu *inputpdu, struct generic_pdu *outputpdu, __u32 flags, __u64 * login_flags);/* * Uses the final values negotiated during a successful login of a new session * to set up the session-wide operational values used during FFP */voidset_session_parameters(struct session_operational_parameters *oper_param_entry, struct parameter_type login_params[MAX_CONFIG_PARAMS]);/* * Uses the final values negotiated during a successful login of a new * connection to set up the connection-specific operational values used * during FFP */voidset_connection_parameters(struct connection_operational_parameters *oper_param_entry, struct parameter_type login_params[MAX_CONFIG_PARAMS]);/* * Returns -1 on error (duplicate key) * 0 if not a duplicate */int __attribute__ ((no_instrument_function))check_step_key(struct unknown_key *key, __u32 * got_keys, __u32 got_value);/* Returns -1 on error (duplicate key or illegal numeric value) * 0 if not a duplicate, numeric_value is set */int __attribute__ ((no_instrument_function))check_step_key_number(struct unknown_key *key, __u32 * got_keys, __u32 got_value, __u32 limit, __u32 * numeric_value);/* * prints all the keys in the param_tbl and their values */int __attribute__ ((no_instrument_function))print_config_info(struct parameter_type param_tbl[MAX_CONFIG_PARAMS], char *buffer);/* * Prints the session-wide parameter values as negotiated during a * successful login of the first connection in a new session */int __attribute__ ((no_instrument_function))print_session_params(struct session_operational_parameters *sop, struct parameter_type param_tbl[MAX_CONFIG_PARAMS], char *buffer);#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -