📄 u_ivar.c
字号:
OBJECT_NAME *obj_ptr;ST_INT j;#if !defined (USE_MV_DELVAR_RESP)DELVAR_RESP_INFO rspinfo;#endif if (mms_debug_sel & MMS_LOG_USR_IND) { indic_info_print (req_info,"Delete Variable Access "); req_ptr = (DELVAR_REQ_INFO *) req_info->req_info_ptr; printf ("\n Scope of Delete = %d,", req_ptr->scope); switch (req_ptr->scope) { case DELVAR_SPEC : printf (" Specific "); break; case DELVAR_AA : printf (" AA-Specific "); break; case DELVAR_DOM : printf (" Domain "); break; case DELVAR_VMD : printf (" VMD "); break; } printf ("\n Domain Name : "); if (req_ptr->dname_pres) printf (" %s ", req_ptr->dname); else printf (" Not Present "); printf ("\n Variable Names : "); if (req_ptr->vnames_pres) { printf (" %d ", req_ptr->num_of_vnames); obj_ptr = (OBJECT_NAME *) (req_ptr + 1); for (j = 0; j < req_ptr->num_of_vnames; j++) { print_objname (obj_ptr); obj_ptr++; } } else printf (" Not Present "); }#ifdef USE_MV_DELVAR_RESP mv_delvar_resp (req_info);#else rspinfo.num_matched = 98765L; rspinfo.num_deleted = 43210L; mp_delvar_resp (req_info,&rspinfo);#endif /* end of USE_MV_DELVAR_RESP #else */ indic_info_wait (); /* allow user to see indic info */ }#endif/************************************************************************//* DEFINE SCATTERED ACCESS *//************************************************************************/#if MMS_DEFSCAT_EN & RESP_ENST_VOID u_defscat_ind (MMSREQ_IND *req_info) {DEFSCAT_REQ_INFO *req_ptr; if (mms_debug_sel & MMS_LOG_USR_IND) { indic_info_print (req_info,"Define Scattered Access Attributes "); req_ptr = (DEFSCAT_REQ_INFO *) req_info->req_info_ptr; print_objname (&req_ptr->sa_name); printf ("\n Scattered Access Description : "); list_bytes (req_ptr->sa_descr.data,req_ptr->sa_descr.len); } mp_defscat_resp (req_info); indic_info_wait (); /* allow user to see indic info */ }#endif/************************************************************************//* GET SCATTERED ACCESS ATTRIBUTES *//************************************************************************/#if MMS_GETSCAT_EN & RESP_ENST_VOID u_getscat_ind (MMSREQ_IND *req_info) {GETSCAT_REQ_INFO *req_ptr;GETSCAT_RESP_INFO rsp_info; if (mms_debug_sel & MMS_LOG_USR_IND) { indic_info_print (req_info,"Get Scattered Access Attributes "); req_ptr = (GETSCAT_REQ_INFO *) req_info->req_info_ptr; print_objname (&req_ptr->sa_name); } /* create a default response */ /*dest_buffer [0] = '\x80';*/ dest_buffer [0] = '\x40'; /* set the bit next to the MSB */ dest_buffer [0] <<= 1; /* move it left setting the MSB */ dest_buffer [1] = '\x01'; dest_buffer [2] = '\x12'; rsp_info.mms_deletable = SD_FALSE; rsp_info.sa_descr.data = (ST_UCHAR *)dest_buffer; rsp_info.sa_descr.len = 3; if (mms_debug_sel & MMS_LOG_USR_IND) { if (ask ("\n\n Do you want to enter MMS Deletable (y=TRUE,n=FALSE) (default = n) :", 0)) rsp_info.mms_deletable = SD_TRUE; else rsp_info.mms_deletable = SD_FALSE; init_nxtbuf (); /* initialize next buffer for data */ rsp_info.sa_descr.data = (ST_UCHAR *) dest_buffer + 10; if (tot_len = get_var_data ("Scattered Access", rsp_info.sa_descr.data)) rsp_info.sa_descr.len = tot_len; else rsp_info.sa_descr.data = (ST_UCHAR *) dest_buffer; } mp_getscat_resp (req_info, &rsp_info); indic_info_wait (); /* allow user to see indic info */ }#endif/************************************************************************//* DEFINE NAMED VARIABLE LIST *//************************************************************************/#if MMS_DEFVLIST_EN & RESP_ENST_VOID u_defvlist_ind (MMSREQ_IND *req_info) {DEFVLIST_REQ_INFO *req_ptr;VARIABLE_LIST *vl_ptr; if (mms_debug_sel & MMS_LOG_USR_IND) { indic_info_print (req_info,"Define Named Variable List"); req_ptr = (DEFVLIST_REQ_INFO *) req_info->req_info_ptr; print_objname (&req_ptr->vl_name); vl_ptr = (VARIABLE_LIST *) (req_ptr + 1); print_var_list (vl_ptr, req_ptr->num_of_variables); } mv_defvlist_resp (req_info); /* send primitive response */ indic_info_wait (); /* allow user to see indic info */ }#endif/************************************************************************//* GET NAMED VARIABLE LIST *//************************************************************************/#if MMS_GETVLIST_EN & RESP_ENST_VOID u_getvlist_ind (MMSREQ_IND *req_info) {GETVLIST_REQ_INFO *req_ptr; if (mms_debug_sel & MMS_LOG_USR_IND) { indic_info_print (req_info,"Get Named Variable List Attributes"); req_ptr = (GETVLIST_REQ_INFO *) req_info->req_info_ptr; print_objname (&req_ptr->vl_name); } mv_getvlist_resp (req_info); indic_info_wait (); /* allow user to see indic info */ }#endif/************************************************************************//* DELETE NAMED VARIABLE LIST *//************************************************************************/#if MMS_DELVLIST_EN & RESP_ENST_VOID u_delvlist_ind (MMSREQ_IND *req_info) {DELVLIST_REQ_INFO *req_ptr;OBJECT_NAME *obj_ptr;ST_INT j; if (mms_debug_sel & MMS_LOG_USR_IND) { indic_info_print (req_info,"Delete Named Variable List "); req_ptr = (DELVLIST_REQ_INFO *) req_info->req_info_ptr; printf ("\n Scope of Delete = %d,", req_ptr->scope); switch (req_ptr->scope) { case DELVL_SPEC : printf (" Specific "); break; case DELVL_AA : printf (" AA-Specific "); break; case DELVL_DOM : printf (" Domain "); break; case DELVL_VMD : printf (" VMD "); break; } printf ("\n Domain Name : "); if (req_ptr->dname_pres) printf (" %s ", req_ptr->dname); else printf (" Not Present "); printf ("\n Variable Names : "); if (req_ptr->vnames_pres) { printf (" %d ", req_ptr->num_of_vnames); obj_ptr = (OBJECT_NAME *) (req_ptr + 1); for (j = 0; j < req_ptr->num_of_vnames; j++) { print_objname (obj_ptr); obj_ptr++; } } else printf (" Not Present "); } mv_delvlist_resp (req_info); indic_info_wait (); /* allow user to see indic info */ }#endif/************************************************************************//* GET TYPE DEFINITION *//************************************************************************/#define USE_MV_GETTYPE_RESP /* define to use VM responder */#if MMS_GETTYPE_EN & RESP_ENST_VOID u_gettype_ind (MMSREQ_IND *req_info) {GETTYPE_REQ_INFO *req_ptr;#if !defined (USE_MV_GETTYPE_RESP)GETTYPE_RESP_INFO rsp_info;#endif if (mms_debug_sel & MMS_LOG_USR_IND) { indic_info_print (req_info,"Get Named Type Attributes "); req_ptr = (GETTYPE_REQ_INFO *) req_info->req_info_ptr; print_objname (&req_ptr->type_name); }#ifdef USE_MV_GETTYPE_RESP mv_gettype_resp (req_info);#else /*dest_buffer [0] = '\x80';*/ dest_buffer [0] = '\x40'; /* set the bit next to the MSB */ dest_buffer [0] <<= 1; /* move it left setting the MSB */ dest_buffer [1] = '\x01'; dest_buffer [2] = '\x12'; /* create a default response */ rsp_info.mms_deletable = SD_FALSE; rsp_info.type_spec.data = dest_buffer; rsp_info.type_spec.len = 3; if (mms_debug_sel & MMS_LOG_USR_IND) { rsp_info.mms_deletable = ask ("\n\n Do you want to enter MMS Deletable (y=TRUE,n=FALSE) (default = n) :",0); init_nxtbuf (); /* initialize next buffer for data */ rsp_info.type_spec.data = dest_buffer + 10; if (tot_len = get_var_data ("Type Specification", rsp_info.type_spec.data)) rsp_info.type_spec.len = tot_len; else rsp_info.type_spec.data = dest_buffer; } mp_gettype_resp (req_info, &rsp_info);#endif /* end of USE_MV_GETTYPE_RESP #else */ indic_info_wait (); /* allow user to see indic info */ }#endif/************************************************************************//* DEFINE TYPE *//************************************************************************/#define USE_MV_DEFTYPE_RESP /* define to use VM responder */#if MMS_DEFTYPE_EN & RESP_ENST_VOID u_deftype_ind (MMSREQ_IND *req_info) {DEFTYPE_REQ_INFO *req_ptr; if (mms_debug_sel & MMS_LOG_USR_IND) { indic_info_print (req_info,"Define Named Type "); req_ptr = (DEFTYPE_REQ_INFO *) req_info->req_info_ptr; print_objname (&req_ptr->type_name); printf ("\n Type Specification :"); list_bytes (req_ptr->type_spec.data,req_ptr->type_spec.len); }#ifdef USE_MV_DEFTYPE_RESP mv_deftype_resp (req_info);#else mp_deftype_resp (req_info);#endif /* end of USE_MV_DEFTYPE_RESP #else */ indic_info_wait (); /* allow user to see indic info */ }#endif/************************************************************************//* DELETE TYPE *//************************************************************************/#define USE_MV_DELTYPE_RESP /* define to use VM responder */#if MMS_DELTYPE_EN & RESP_ENST_VOID u_deltype_ind (MMSREQ_IND *req_info) {DELTYPE_REQ_INFO *req_ptr;OBJECT_NAME *obj_ptr;#if !defined (USE_MV_DELTYPE_RESP)DELTYPE_RESP_INFO rspinfo;#endifST_INT j; if (mms_debug_sel & MMS_LOG_USR_IND) { indic_info_print (req_info,"Delete Named Type "); req_ptr = (DELTYPE_REQ_INFO *) req_info->req_info_ptr; printf ("\n Scope of Delete = %d,", req_ptr->scope); switch (req_ptr->scope) { case DELTYPE_SPEC : printf (" Specific "); break; case DELTYPE_AA : printf (" AA-Specific "); break; case DELTYPE_DOM : printf (" Domain "); break; case DELTYPE_VMD : printf (" VMD "); break; } printf ("\n Domain Name : "); if (req_ptr->dname_pres) printf (" %s ", req_ptr->dname); else printf (" Not Present "); printf ("\n Type Names : "); if (req_ptr->tnames_pres) { printf (" %d ", req_ptr->num_of_tnames); obj_ptr = (OBJECT_NAME *) (req_ptr + 1); for (j = 0; j < req_ptr->num_of_tnames; j++) { print_objname (obj_ptr); obj_ptr++; } } else printf (" Not Present "); }#ifdef USE_MV_DELTYPE_RESP mv_deltype_resp (req_info);#else rspinfo.num_matched = 45L; rspinfo.num_deleted = 42L; mp_deltype_resp (req_info,&rspinfo);#endif /* end of USE_MV_DELTYPE_RESP #else */ indic_info_wait (); /* allow user to see indic info */ }#endif/************************************************************************//* The following functions are only required by the demo to return time *//* from the machine during a Read indication. *//************************************************************************//* Please only use ANSI time functions here */ST_INT32 calc_mill_since_12( ST_VOID ) {ST_INT32 milliseconds_today = 0;time_t timer;struct tm *tm; time( &timer ); if ( tm = localtime( &timer ) ) { /* count up seconds today and * by 1000 */ milliseconds_today = ((ST_INT32)tm->tm_hour * 3600 + (ST_INT32)tm->tm_min * 60 + (ST_INT32)tm->tm_sec) * 1000; } return (milliseconds_today); }/************************************************************************//* *//************************************************************************/ST_INT32 calc_days_since_1184 (ST_VOID) {ST_INT32 days_since_84 = 0; time_t currTime;time_t t_84;struct tm tm84;ST_DOUBLE tm_dif; /* time in sec from January 1, 1984, 00:00:00 */ /* assemble time_t since 1 Jan, 1984 */ memset (&tm84, 0, sizeof (struct tm)); tm84.tm_mday = 1; tm84.tm_mon = 0; /* January=0 */ tm84.tm_year = 84; /* date/time January 1, 1984, 00:00:00 */ tm84.tm_isdst = -1; /* let C lib compute if daylight time is in effect */ t_84 = mktime (&tm84); time( &currTime ); /* get the diffrence beetween local times */ tm_dif = difftime (currTime, t_84); /* num of secs from 01/01/84 */ /* divide seconds by ( 24 hours in a day * 3600 seconds in an hour ) */ /* to get days since January 1, 1984 00:00:00. */ days_since_84 = (ST_INT32) (tm_dif / (24.0 * 3600.0)); return( days_since_84 ); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -