📄 mms_vvar.h
字号:
ST_INT el_size; /* Size of the element in memory */ };typedef struct rt_aa_ctrl RT_AA_CTRL;ST_RET ms_adl_to_aa (ST_CHAR *adl_str,ALT_ACCESS *alt_acc);ST_RET ms_aa_to_adl (ALT_ACCESS *alt_acc, ST_CHAR *adl_str, ST_INT max_adl_len);ST_RET ms_local_to_asn1_aa (ASN1_ENC_CTXT *aCtx, SD_CONST RUNTIME_TYPE *rt_head, ST_INT rt_num, ALT_ACCESS *alt_acc, ST_CHAR *dptr);ST_RET ms_asn1_to_local_aa (SD_CONST RUNTIME_TYPE *rt_head, ST_INT rt_num, ALT_ACCESS *alt_acc, ST_UCHAR *asn1ptr, ST_INT asn1len, ST_CHAR *dptr);ST_VOID ms_log_alt_access (ALT_ACCESS *alt_acc);ST_RET ms_aa_to_asn1 (ASN1_ENC_CTXT *aCtx, ALT_ACCESS *alt_acc);ST_RET ms_asn1_to_aa (ST_UCHAR *asn1ptr, ST_INT asn1len, ALT_ACCESS *alt_acc_out);/************************************************************************/#ifndef MMS_LITE/************************************************************************//************************************************************************//* Type definition structures and manipulation functions *//************************************************************************/struct named_type /* type definition table structure */ { DBL_LNK link; /* generic list links */ ST_CHAR type_name[MAX_IDENT_LEN+1]; /* name of data type */ ST_BOOLEAN deletable; /* set != 0 if deletable */ ST_UCHAR protection; /* protection afforded for type */ ST_BOOLEAN erased; /* flags if deleted, but nref !=0 */ ST_INT nref; /* number of var def'ns referencing this*/ RUNTIME_TYPE *rt_head; /* ptr to runtime type def head */ ST_INT rt_num; /* # of rt_blocks in runtime type def */ ST_INT asn1len; /* # bytes in ASN.1 definition */ ST_UCHAR *asn1ptr; /* pointer to ASN.1 definition */ ST_INT blocked_len; /* length of blocked (packed) data type */ ST_CHAR *(*read_ind_fun)(ST_CHAR *src, ST_INT len); /* std read ind function ptr */ ST_INT (*write_ind_fun)(ST_CHAR *src, ST_CHAR *dest, ST_INT len); /* std write ind */ };typedef struct named_type NAMED_TYPE;ST_RET ms_locl_to_asn1_aa (ASN1_ENC_CTXT *aCtx, NAMED_TYPE *tptr, ALT_ACCESS *alt_acc, ST_CHAR *dptr);ST_RET ms_asn1_to_locl_aa (NAMED_TYPE *tptr, ALT_ACCESS *alt_acc, ST_UCHAR *asn1ptr, ST_INT asn1len, ST_CHAR *dptr);extern ST_INT max_mmsease_types; /* max number allowed */extern ST_INT mms_type_count; /* number currently defined */NAMED_TYPE *ms_add_named_type (DOMAIN_OBJS *dom, ST_CHAR *name, ST_UCHAR *asn1, ST_INT asn1len);NAMED_TYPE *ms_find_named_type_obj (OBJECT_NAME *obj, ST_INT chan);NAMED_TYPE *ms_find_named_type (DOMAIN_OBJS *dom,ST_CHAR *name);ST_RET ms_del_named_type (DOMAIN_OBJS *dom,ST_CHAR *name);ST_RET ms_del_type (DOMAIN_OBJS *dom, NAMED_TYPE *name);ST_VOID ms_del_all_named_types (DOMAIN_OBJS *dom_objs);ST_RET ms_del_named_type_obj (OBJECT_NAME *obj, ST_INT chan);ST_RET ms_add_std_types (DOMAIN_OBJS *dom);ST_CHAR *rdind_fun (ST_CHAR *addr, ST_INT len);ST_RET wrind_fun (ST_CHAR *data, ST_CHAR *addr, ST_INT len);ST_RET mv_gettype_resp (MMSREQ_IND *ind);ST_RET mv_gettype_resp (MMSREQ_IND *ind);ST_RET mv_deltype_resp (MMSREQ_IND *ind);ST_RET mv_deftype_resp (MMSREQ_IND *ind);/************************************************************************//* Variable definition structures and manipulation functions *//************************************************************************/struct named_var /* name table structure */ { DBL_LNK link; /* generic list links */ ST_CHAR varname[MAX_IDENT_LEN+1];/* variable name */ ST_BOOLEAN invalid; /* variable invalidated due */ /* to type or addr deleted */ NAMED_TYPE *type; /* type name/domain */ ST_BOOLEAN deletable; /* != 0 if deletable */ ST_UCHAR rd_pro; /* read protection */ ST_UCHAR wr_pro; /* write protection */ VAR_ACC_ADDR addr; /* address */ ST_CHAR *(*read_ind_fun)(ST_CHAR *src, ST_INT len); /* std read ind function ptr */ ST_INT (*write_ind_fun)(ST_CHAR *src, ST_CHAR *dest, ST_INT len); /* std write ind *//* Followed by the address, for symbolic or unconstrained address *//* types. The length of this address is determined when the var added */ SD_END_STRUCT };typedef struct named_var NAMED_VAR;struct named_var_list /* name variable list structure */ { DBL_LNK link; /* generic list links */ ST_CHAR name[MAX_IDENT_LEN+1]; /* variable list name */ ST_BOOLEAN deletable; /* != 0 if deletable */ ST_INT num_vars; /* # of vars in Named Variable List. */ /* VARIABLE_LIST var_list [num_of_variables]; */ SD_END_STRUCT };typedef struct named_var_list NAMED_VAR_LIST;extern ST_INT max_mmsease_vars; /* max number allowed */extern ST_INT mms_var_count; /* number currently defined */extern ST_INT max_mmsease_nvlists;extern ST_INT mms_nvlist_count;/************************************************************************//* This function selects the binary search mechansisms (default) */ST_VOID ms_bs_init (ST_VOID);/* This function selects the linked list search mechansisms */ST_VOID ms_ll_init (ST_VOID);NAMED_VAR *ms_add_named_var (DOMAIN_OBJS *dom, ST_CHAR *name, OBJECT_NAME *type, VAR_ACC_ADDR *addr, ST_INT chan);NAMED_VAR *ms_add_var (DOMAIN_OBJS *dom, ST_CHAR *name, NAMED_TYPE *type, VAR_ACC_ADDR *addr, ST_INT chan);NAMED_VAR *ms_find_named_var (DOMAIN_OBJS *dom, ST_CHAR *name);NAMED_VAR *ms_find_named_var_obj (OBJECT_NAME *obj, ST_INT chan);ST_RET ms_del_named_var (DOMAIN_OBJS *dom, ST_CHAR *name);ST_RET ms_del_named_var_obj (OBJECT_NAME *obj, ST_INT chan);ST_VOID ms_del_all_named_vars (DOMAIN_OBJS *dom);NAMED_VAR_LIST *ms_add_nvlist (DOMAIN_OBJS *dom, ST_CHAR *name, ST_INT num_vars, VARIABLE_LIST *var_list);NAMED_VAR_LIST *ms_find_nvlist (DOMAIN_OBJS *dom, ST_CHAR *name);NAMED_VAR_LIST *ms_find_nvlist_obj (OBJECT_NAME *obj, ST_INT chan);ST_RET ms_del_nvlist (DOMAIN_OBJS *dom, ST_CHAR *name);ST_RET ms_del_nvlist_obj (OBJECT_NAME *obj, ST_INT chan);ST_VOID ms_del_all_nvlists (DOMAIN_OBJS *dom);ST_RET mv_getvar_resp (MMSREQ_IND *ind);ST_RET mv_delvar_resp (MMSREQ_IND *ind);ST_RET mv_defvar_resp (MMSREQ_IND *ind);ST_RET mv_namelist_resp (MMSREQ_IND *ind);ST_RET mv_getvlist_resp (MMSREQ_IND *ind);ST_RET mv_delvlist_resp (MMSREQ_IND *ind);ST_RET mv_defvlist_resp (MMSREQ_IND *ind);/************************************************************************//* VIRTUAL MACHINE READ, WRITE, INFORMATION REPORT *//* The structure below are used for most variable access VM req funs, *//* and allows multiple variables per transaction. *//************************************************************************//* VM defines to be used for DataAccessError codes */#define ERROR_RESPONSE 20 /* for error response only */#define NUM_VAR_MISMATCH 21 struct mv_vardesc /* virtual machine variable description */ { OBJECT_NAME name; /* name of variable */ OBJECT_NAME type; /* type of variable */ ST_CHAR *data; /* destination/source pointer */ };typedef struct mv_vardesc MV_VARDESC;/* This structure is provided as request information for a MV read req. *//* If desired, this info may be examined in the user confirm function. */struct readvars_req_info { /* virtual machine read req structure */ ST_INT num_of_vars; /* number of variables *//* list of variables *//* MV_VARDESC vardesc_list [num_of_vars]; */ SD_END_STRUCT };typedef struct readvars_req_info READVARS_REQ_INFO;/***** READ REQUEST **** *//* a pointer to an array of these structures are passed into the *//* 'mv_read_variables' function */struct mv_read_req_info { struct /* input (request) information */ { ST_CHAR *data_ptr; /* Dest data buffer (for success) */ NAMED_TYPE *type; /* pointer to associated type */ ST_BOOLEAN alt_acc_pres; /* set SD_TRUE if Alt Access is present */ ST_BOOLEAN alt_acc_type_aa; /* set SD_TRUE if type is Alt Acc ready */ ST_BOOLEAN alt_acc_data_packed; /* set SD_TRUE if local data is packed */ ALT_ACCESS alt_acc; /* Alternate Access specification */ }i; struct /* output (result) information */ { ST_RET result; /* !=0 for success, else SD_FAILURE */ ST_INT16 err_code; /* DataAccessError (for failure) *//* If a named type is not supplied, and the read was a success, this *//* is the derived runtime type. It was allocated using 'chk_calloc' *//* and must be free'd using 'chk_free' */ ST_INT num_rt; RUNTIME_TYPE *rt_out; /* If a data_ptr is not supplied, and the read was a success, this *//* is the buffer allocated for the data. It was allocated using *//* 'chk_calloc' and must be free'd using 'chk_free' */ ST_CHAR *data_ptr_out; /* Dest data buffer (for success) */ }o; };typedef struct mv_read_req_info MV_READ_REQ_INFO;MMSREQ_PEND *mv_read (ST_INT chan, OBJECT_NAME *name, OBJECT_NAME *type, ST_CHAR *dest);MMSREQ_PEND *mv_readvars (ST_INT chan, ST_INT num_var, MV_VARDESC *info);MMSREQ_PEND *mv_read_variables (ST_INT chan, ST_INT num_var, READ_REQ_INFO *prim, MV_READ_REQ_INFO *vminfo);/***** READ RESPONSE ***** *//* a pointer to an array of these structures are passed into the *//* 'mv_read_response' function */struct mv_read_resp_info { ST_INT16 result; /* ACC_RSLT_SUCCESS, ACC_RSLT_FAILURE */ ST_INT16 err_code; /* DataAccessError (for failure) */ ST_CHAR *data_ptr; /* Source data buffer (for success) */ NAMED_TYPE *type; /* pointer to associated type */ ST_BOOLEAN alt_acc_pres; /* set SD_TRUE if Alt Access is present */ ST_BOOLEAN alt_acc_data_packed;/* set SD_TRUE if local data is packed */ ALT_ACCESS alt_acc; /* Alternate Access specification */ };typedef struct mv_read_resp_info MV_READ_RESP_INFO;ST_RET mv_read_resp (MMSREQ_IND *ind);ST_RET mv_read_response (MMSREQ_IND *ind, ST_INT num_var, MV_READ_RESP_INFO *info);/***** WRITE REQUEST **** *//* a pointer to an array of these structures are passed into the *//* 'mv_write_variables' function */struct mv_write_req_info { ST_CHAR *data_ptr; /* Source data buffer */ NAMED_TYPE *type; /* pointer to associated type */ ST_BOOLEAN alt_acc_pres; /* set SD_TRUE if Alt Access is present */ ST_BOOLEAN alt_acc_type_aa; /* set SD_TRUE if type is Alt Acc ready */ ST_BOOLEAN alt_acc_data_packed;/* set SD_TRUE if local data is packed */ ALT_ACCESS alt_acc; /* Alternate Access specification */ };typedef struct mv_write_req_info MV_WRITE_REQ_INFO;MMSREQ_PEND *mv_write (ST_INT chan, OBJECT_NAME *var, OBJECT_NAME *type, ST_CHAR *src);MMSREQ_PEND *mv_writevars (ST_INT chan, ST_INT num_var, MV_VARDESC *info);MMSREQ_PEND *mv_write_variables (ST_INT chan, ST_INT num_data, VAR_ACC_SPEC *reqinfo, MV_WRITE_REQ_INFO *vminfo);/***** WRITE RESPONSE **** */ST_RET mv_write_resp (MMSREQ_IND *ind);WRITE_RESP_INFO *mv_write_decode (MMSREQ_IND *indptr);ST_RET ms_extract_write_data (MMSREQ_IND *ind, ST_INT index, NAMED_TYPE *type, ST_CHAR *dest, ST_BOOLEAN alt_acc_packed);ST_RET ms_extract_wr_data (MMSREQ_IND *indptr, ST_INT i, NAMED_TYPE *type, ST_CHAR *dest, ST_BOOLEAN alt_acc_packed, ALT_ACCESS *alt_acc_ptr);/***** INFORMATION REPORT REQUEST ***** */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -