⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mmseasy.c

📁 ICCP Toolkit 是在 Tru64下开发Tase.2通信协议的开发包
💻 C
📖 第 1 页 / 共 3 页
字号:
  reqDone = SD_TRUE;  }/************************************************************************//*                       u_mp_conclude_done					*//************************************************************************/ST_VOID u_mp_conclude_done (ST_INT chan, ST_RET ret_code)  {  }/************************************************************************//************************************************************************//************************************************************************//* SERVER SPECIFIC FUNCTIONS						*//************************************************************************//************************************************************************//*			addServerVar 					*//************************************************************************//* This function adds a MMS-EASE named variable to the Virtual Machine	*//* database. This will allow read indications for this variable to be	*//* handled easily by the VM.						*/static NAMED_VAR *addServerVar (ST_CHAR *varName, ST_VOID *addr, 				NAMED_TYPE *namedType)  {VAR_ACC_ADDR mmsAddr;NAMED_VAR *namedVar;ST_CHAR	address_string[40];  mmsAddr.addr_tag = SYM_ADDR;  sprintf (address_string, "0x%p", addr);  mmsAddr.addr.sym_addr = address_string;  namedVar = ms_add_var (&m_vmd_select->vmd_wide, 			 varName, namedType, &mmsAddr, 0);  return (namedVar);  }/************************************************************************//*			u_mllp_a_assoc_ind				*//************************************************************************//* This function is called by MMSEASE when an association indication	*//* is received. Return SUCCCESS to accept the association at this level	*/ST_RET u_mllp_a_assoc_ind (ST_INT chan, ACSE_ASSINFO *assinfo)  {  return (SD_SUCCESS);  }/************************************************************************//*			u_init_ind					*//************************************************************************//* Someone wants to talk to us. 					*/ST_VOID u_init_ind (MMSREQ_IND *req_info)  {  mv_init_resp (req_info);  }/************************************************************************//*                       u_init_resp_done				*//************************************************************************//* This is a notification function that is called to tell us that the	*//* connection is now open for business. No action is required.		*/ST_VOID u_init_resp_done (ST_INT chan)  {  }/************************************************************************//*			u_read_ind					*//************************************************************************//* Someone wants to read one of our variables				*/ST_VOID u_read_ind (MMSREQ_IND *req_info)  {  mv_read_resp (req_info);		/* let VM respond		*/  ++Temperature;			/* Turn up the heat		*/  }/************************************************************************//*			u_write_ind					*//************************************************************************//* Someone wants to write one of our variables				*/ST_VOID u_write_ind (MMSREQ_IND *req_info)  {  mv_write_resp (req_info);		/* let VM write responder do it */  }/************************************************************************//*			u_get_named_addr				*//************************************************************************//* This function is called from within the mv_read/write_resp functions	*//* to resolve the named variable's local address. The scheme we are 	*//* using is to handle symbolic addresses as a character string that 	*//* represents a pointer to the varible converted into a string.  Many	*//* other methods can be used.						*/ST_CHAR *u_get_named_addr (NAMED_VAR *vardef)  {ST_CHAR	*byte_addr;  sscanf (&vardef->addr.addr.sym_addr[2], "%p", &byte_addr);  return (byte_addr);  }/************************************************************************//*			u_namelist_ind 					*//************************************************************************//* Someone wants a list of our named variables				*/ST_VOID u_namelist_ind (MMSREQ_IND *req_info)  {  mv_namelist_resp (req_info);	/* let VM respond			*/  }/************************************************************************//*			u_getvar_ind					*//************************************************************************//* Someone wants to know all about one of our named variables		*/ST_VOID u_getvar_ind (MMSREQ_IND *req_info)  {  mv_getvar_resp (req_info);  }/************************************************************************//*			u_conclude_ind					*//************************************************************************//* The remote node wants to close this connection. Say OK.		*/ST_VOID u_conclude_ind (MMSREQ_IND *req_info)  {  mp_conclude_resp (req_info);  }/************************************************************************//*                       u_release_ind					*//************************************************************************//* This function is called when the connection has been terminated.	*//* We will re-post a listen if it is on channel 1			*/ST_VOID u_release_ind (ST_INT chan)  {ST_RET ret;  if (chan == 1)    {    ret = mllp_ass_listen (chan);	/* post another listen			*/    if (ret != SD_SUCCESS)      printf ("\n Repost Listen Error : 0x%x", ret);    }  }/************************************************************************//*			u_info_ind					*//************************************************************************//* client wants to know about changes to something			*/ST_VOID u_info_ind (MMSREQ_IND *req_info)  {ST_INT i, numVar;ST_INT16 dataBuf;ACCESS_RESULT *pstAccessResult;VARIABLE_LIST *pstVarList;INFO_REQ_INFO *pstInfo;  pstInfo = (INFO_REQ_INFO *)req_info->req_info_ptr;  numVar = pstInfo->va_spec.num_of_variables;  pstAccessResult = (ACCESS_RESULT *) (pstInfo->acc_rslt_list);  pstVarList   = (VARIABLE_LIST *) (pstInfo+1);  for (i = 0; i < numVar; ++i, ++pstVarList, ++pstAccessResult)    {    if (strcmp (pstVarList->var_spec.vs.name.obj_name.vmd_spec, "Temperature") == 0)      {      ms_extract_info_data (req_info, i, int16Type, (ST_CHAR *) &dataBuf, SD_FALSE);      printf ("\n\t\t Information Report Indication - Temperature=%d\n\n",              dataBuf);      }    else      printf ("\n\t\tInvalid Information Report Indication.");    }  }/************************************************************************//************************************************************************//* AUXILIARY FUNCTIONS 							*//************************************************************************//*				mSetLogCfg 				*//************************************************************************//* Set up the SLOG subsystem, so we can log all MMS activity. This is 	*//* very useful for system level debugging, and can easily be extended 	*//* to log user events as well.						*/#ifdef USE_MLOGstatic ST_VOID mSetLogCfg (ST_VOID)  {LOG_CTRL *lc;/* Initialize the logging for MMS-EASE					*/  lc = chk_calloc (1,sizeof (LOG_CTRL));/* sLogCtrl is obsolete, but is macro'd to the new variable sLogCtrl.	*//* We will use this for compatibility with older versions. 		*/  sLogCtrl = lc;  lc->mc.ctrl = MEM_CTRL_MSG_HDR_EN;  lc->logCtrl = LOG_FILE_EN;/* Use time/date time log						*/  lc->logCtrl |= (LOG_TIMEDATE_EN | LOG_TIME_EN);/* File Logging Control defaults 					*/  lc->fc.fileName = "mms.log";  lc->fc.maxSize = 250000L;  lc->fc.ctrl = (FIL_CTRL_WIPE_EN |                  FIL_CTRL_WRAP_EN |                  FIL_CTRL_MSG_HDR_EN);  mms_debug_sel |=     (MMS_LOG_REQ | MMS_LOG_IND | MMS_LOG_RESP | MMS_LOG_CONF | MMS_LOG_PDU);  }#endif/************************************************************************//************************************************************************//* OTHER MMS-EASE USER FUNCTIONS					*//************************************************************************//************************************************************************//*                       u_abort_ind					*//************************************************************************//* This function is called when the connection has been terminated via	*//* an Abort. We will re-post a listen if it is on channel 1		*/ST_VOID u_abort_ind (ST_INT chan, ST_INT reason, ST_BOOLEAN au_flag)  {ST_INT ret;  if (chan == 1)    {    ret = mllp_ass_listen (chan);	/* post another listen			*/    if (ret != SD_SUCCESS)      printf ("\n Repost Listen Error : 0x%x", ret);    }  }/************************************************************************//*                       u_reject_ind					*//************************************************************************//* Someone did not like a MMS PDU - us or them. Normally we should	*//* abort the connectin when this happens.				*/ST_VOID u_reject_ind (ST_INT chan, REJECT_RESP_INFO *rej_ptr)  {  }/************************************************************************//*                       u_mmsexcept_ind			       	*//************************************************************************//* Something really bad happened - time to quit.			*/ST_VOID u_mmsexcept_ind (ST_INT chan, ST_RET errval)  {  doIt = SD_FALSE;  printf ("\n MMS exception on chan %d: ",chan);  }/************************************************************************//*                       u_llp_error_ind					*//************************************************************************//* Something really bad happened - time to quit.			*/ST_VOID u_llp_error_ind (ST_INT chan, ST_LONG code)  {  doIt = SD_FALSE;  printf ("\n LLP Error Indication received for channel %d, Code = 0x%08lx",							chan,code);  }/************************************************************************//************************************************************************//************************************************************************//* FUNCTIONS REQUIRED TO SATISFY LINK REFERENCES			*//************************************************************************//************************************************************************//*                       u_mp_abort_done			       	*//************************************************************************//* This function is required to satisfy linker references only.		*//* This is true because we do not issue aborts in this application	*/ST_VOID u_mp_abort_done (ST_INT chan)  {  }/************************************************************************//*                       u_mp_cancel_conf					*//************************************************************************//* This function is required to satisfy linker references only.		*//* This is true because we do not issue cancels in this application	*/ST_VOID u_mp_cancel_conf (MMSREQ_PEND *req_ptr, ST_BOOLEAN errdata_pres, 			ERR_INFO *err_ptr)  {  }/************************************************************************//*                       u_ind_not_supp					*//************************************************************************//* This function is required to satisfy linker references only.		*/ST_VOID u_ind_not_supp (MMSREQ_IND *req_info)  {  }/************************************************************************//*                       u_conf_not_supp				*//************************************************************************//* This function is required to satisfy linker references only.		*/ST_VOID u_conf_not_supp (MMSREQ_PEND *req_info)  {  }/************************************************************************//*                       printUsage					*//************************************************************************/static ST_VOID printUsage (ST_VOID)  {  printf ("Usage : mmseasy -c localArName remoteArName\n");  printf ("        mmseasy -s localArName\n\n");  printf ("   -c           : Client Mode\n");  printf ("   -s           : Server Mode\n");  printf ("   localArName  : AR Name of Local Node\n");  printf ("   remoteArName : AR Name of Node to connect to\n");  }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -