📄 u_confrm.c
字号:
/************************************************************************//* SISCO SOFTWARE MODULE HEADER *****************************************//************************************************************************//* (c) Copyright Systems Integration Specialists Company, Inc., *//* 1986 - 1997, All Rights Reserved. *//* *//* MODULE NAME : u_confrm.c *//* PRODUCT(S) : MMSEASE *//* *//* MODULE DESCRIPTION : *//* This module contains user confirm functions. These functions *//* are invoked from 'mms_req_serve' when the response to an *//* outstanding request is received. These functions should check *//* the resp_err member of the request control structure before *//* assuming returned data. *//* *//* NOTES ON REQUEST INFORMATION : *//* In the user application, request information structures may be *//* committed when the request is made (e.g. for error recovery). *//* If so, these information buffers could be freed in the confirm *//* functions. In the sample application, all request information *//* structures are automatic or handled when the request is issued. *//* *//* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : *//* *//* MODIFICATION LOG : *//* Date Who Rev Comments *//* -------- --- ------ ------------------------------------------- *//* 08/03/98 DSF 01 Fixed spelling *//* 04/15/97 DSF 7.00 MMSEASE 7.0 release. See MODL70.DOC for *//* history. *//************************************************************************/#include "glbtypes.h"#include "sysincs.h"#include "mms_usr.h"#include "mms_pcon.h"#include "userdefs.h"#include "mmsop_en.h"#include "gvaldefs.h"#include "scrndefs.h"#include "fkeydefs.h"/************************************************************************//* For debug version, use a static pointer to avoid duplication of *//* __FILE__ strings. *//************************************************************************/#ifdef DEBUG_SISCOstatic ST_CHAR *thisFileName = __FILE__;#endif/************************************************************************//************************************************************************//* CONFIRM INFO PRINT *//************************************************************************/ST_VOID conf_info_print (MMSREQ_PEND *req_ptr, ST_CHAR *str) { if (mms_debug_sel & MMS_LOG_USR_CONF) { CLEARSCR; printf ("\n MMS RESPONSE RECEIVED\n"); printf ("\n Channel = %d",req_ptr -> chan); printf ("\n Context = %02x",req_ptr -> context); printf ("\n Invoke ID = %lu",req_ptr -> id); printf ("\n Opcode = %u",req_ptr -> op); if (req_ptr->cs.cs_pres) { printf ("\n Companion Standard Information Present :\n"); list_bytes (req_ptr->cs.cs_ptr,req_ptr->cs.cs_len); } if (!req_ptr -> resp_err) { if (req_ptr -> resp_info_pres) printf ("\n Data Present"); else printf ("\n No Data Present"); printf ("\n\n Request Issued Time : %s",ctime (&req_ptr -> req_time)); printf (" Response Received Time : %s",ctime (&req_ptr -> resp_time)); printf (" \n Elapsed Time : %ld Seconds",req_ptr->resp_time - req_ptr->req_time); printf ("\n Operation is : %s",str); } else printf ("\n"); /* just for looks */ } }ST_VOID conf_info_wait (ST_VOID) { if (mms_debug_sel & MMS_LOG_USR_CONF) { wait_msg (""); (*menu_set_fun)(); } }/************************************************************************//************************************************************************//* list_err_info *//* This function is called from the various u_xxx_conf sample functions *//* when an ERROR response is received. Just print the error information *//* about the response error (no attempt at error recovery). *//************************************************************************/ST_VOID list_error_info (ERR_INFO *);ST_VOID print_err_resp_msg (MMSREQ_PEND *req_ptr, ST_CHAR *msg);ST_VOID list_err_info (MMSREQ_PEND *req_ptr) {ERR_INFO *err_ptr;REJECT_RESP_INFO *rej_ptr; if (mms_debug_sel & MMS_LOG_USR_CONF) { printf ("\n\n RESPONSE ERROR : "); switch (req_ptr->resp_err) { case CNF_ERR_OK : /* error response */ printf ("\n Error Info:"); err_ptr = (ERR_INFO *) req_ptr->resp_info_ptr; printf ("\n Opcode : %u", req_ptr->op); printf ("\n Invoke ID : %lu", req_ptr->id); list_error_info (err_ptr); break; case CNF_REJ_ERR : /* REJECT */ printf ("\n Reject detected "); rej_ptr = (REJECT_RESP_INFO *) req_ptr->resp_info_ptr; if (rej_ptr->detected_here) printf ("here."); else printf ("at peer."); if (rej_ptr->invoke_known) printf ("\n Invoke ID : %lu", rej_ptr->invoke); else printf ("\n Invoke ID NOT KNOWN"); printf ("\n Reject Class : %d", rej_ptr->rej_class); printf ("\n Reject Code : %d", rej_ptr->rej_code); break; default : /* other error */ ms_perror (req_ptr->resp_err); /* just print basic err msg */ break; } print_err_resp_msg (req_ptr, "Response"); } }/************************************************************************//* list_error_info *//************************************************************************/ST_VOID list_error_info (ERR_INFO *err_ptr) { printf ("\n Service Error : "); printf ("\n Problem Class : %2d", err_ptr->eclass); printf ("\n Problem Code : %2d", err_ptr->code); printf ("\n Additional Information : "); if (err_ptr->adtnl.info_pres) { printf ("\n Adtnl Code : "); if (err_ptr->adtnl.code_pres) printf ("%ld", err_ptr->adtnl.code); else printf ("Not present"); printf ("\n Adtnl Description : "); if (err_ptr->adtnl.descr_pres) printf ("%s", err_ptr->adtnl.descr); else printf ("Not present"); printf ("\n Adtnl ServiceSpecInfo : "); if (err_ptr->adtnl.ssi_pres) { printf ("\n Adtnl Service :%2d", err_ptr->adtnl.service); printf ("\n Adtnl Service Error : "); if (err_ptr->adtnl.service == 8) { printf ("Define Event Enrollment Name"); print_objname (&(err_ptr->adtnl.ss_error_oname)); } else if (err_ptr->adtnl.service == 10) { list_bytes (err_ptr->adtnl.ss_error_data, err_ptr->adtnl.ss_error_len); } else printf ("%lu", err_ptr->adtnl.ss_error_val); } else printf ("Not present"); } else printf ("Not present"); }/************************************************************************//************************************************************************//* err_resp_msg (req_ptr,msg) *//************************************************************************/ST_CHAR *err_class_msg[] = { "VMD State", /* Class = 0 */ "Application Reference", /* Class = 1 */ "Definition", /* Class = 2 */ "Resource", /* Class = 3 */ "Service", /* Class = 4 */ "Service Preempt", /* Class = 5 */ "Time Resolution", /* Class = 6 */ "Access", /* Class = 7 */ "Initiate", /* Class = 8 */ "Conclude", /* Class = 9 */ "Cancel", /* Class = 10 */ "File" /* Class = 11 */ };ST_CHAR *vmd_err_code_msg[] = { "Other", "State Conflict", "Operational Problem", "Domain transfer Problem", "State Machine ID Invalid" };ST_CHAR *def_err_code_msg[] = { "Other", "Object Undefined", "Invalid Address", "Type Unsupported", "Type Inconsistent", "Object Exists", "Attribute Inconsistent" };ST_CHAR *res_err_code_msg[] = { "Other", "Memory", "Processor", "Mass Storage", "Capability Unavailable", "Capability Unknown" };ST_CHAR *ser_err_code_msg[] = { "Other", "Primitive Sequence", "State Conflict", "PDU Size", "Continuation", "Constraint Conflict" };ST_CHAR *acc_err_code_msg[] = { "Other", "Access Unsupported", "Nonexistent", "Access Denied", "Invalidated" };ST_CHAR *init_err_code_msg[] = { "Other", "Version", "Max Segment", "Oustanding Calling", "Oustanding Called", "Service CBB", "Parameter CBB", "Nesting" };ST_CHAR *concl_err_code_msg[] = { "Other", "Further Communication Req'd" };ST_CHAR *file_err_code_msg[] = { "Other", "FileName Ambiguous", "File Busy", "FileName Syntax", "Content Type", "Position", "Access Denied", "Non-Existent" };/************************************************************************//************************************************************************/ST_CHAR *rej_class_msg[] = { "", "Request PDU", "Response PDU", "Error PDU", "Unconfirmed PDU", "PDU Error", "Cancel Request", "Cancel Response", "Cancel Error", "Conclude Request", "Conclude Response", "Conclude Error" };ST_CHAR *class1_rej_code_msg[] = { "Other", "Unrecognized Service", "Modifier", "Invalid Invoke ID", "Argument", "Modifier", "Max Outstanding Exceeded", "Reserved", "Max Recursion Exceeded", "Value Out Of Range" }; ST_CHAR *class2_rej_code_msg[] = { "Other", "Unrecognized Service", "Invalid Invoke ID", "Result", "Reserved", "Recursion", "Value Out Of Range" };ST_CHAR *class3_rej_code_msg[] = { "Other", "Unrecognized Service", "Invalid Invoke ID", "Invalid Error", "Value" };ST_CHAR *class5_rej_code_msg[] = { "Unknown PDU Type", "Invalid PDU", "Illegal ACSE Mapping" };ST_CHAR *class9_rej_code_msg[] = { "Other", "Argument" };ST_CHAR *class10_rej_code_msg[] = { "Other", "Result" };ST_CHAR *class11_rej_code_msg[] = { "Other", "Invalid Error", "Value" };/************************************************************************//************************************************************************/ST_VOID print_err_resp_msg (MMSREQ_PEND *req_ptr, ST_CHAR *msg) {ERR_INFO *err_ptr;REJECT_RESP_INFO *rej_ptr;ST_CHAR buf[200];ST_CHAR buf2[100];ST_CHAR **msg_tbl;/* Get opcode string */#ifdef DEBUG_SISCO if (req_ptr->op < m_num_mms_op_string) msg = mms_op_string[req_ptr->op]; else#endif msg = ""; switch (req_ptr->resp_err) { case CNF_ERR_OK : /* error response */ err_ptr = (ERR_INFO *) req_ptr->resp_info_ptr; sprintf (buf,"\n %s Error : %s, ",msg, err_class_msg[err_ptr->eclass]); switch (err_ptr->eclass) { case 0 : msg_tbl = vmd_err_code_msg; break; case 2 : msg_tbl = def_err_code_msg; break; case 3 : msg_tbl = res_err_code_msg; break; case 4 : msg_tbl = ser_err_code_msg; break; case 7 : msg_tbl = acc_err_code_msg; break; case 8 : msg_tbl = init_err_code_msg; break; case 9 : msg_tbl = concl_err_code_msg; break; case 11 : msg_tbl = file_err_code_msg; break; default : sprintf (buf2," Code %d",err_ptr->code); strcat (buf,buf2); msg_tbl = NULL; } if (msg_tbl) strcat (buf,msg_tbl[err_ptr->code]); break; case CNF_PARSE_ERR : /* parse error */ sprintf (buf,"\n %s, Response Parse Error",msg); break; case CNF_REJ_ERR : /* REJECT */ rej_ptr = (REJECT_RESP_INFO *) req_ptr->resp_info_ptr; sprintf (buf,"\n %s Rejected : %s, ",msg, rej_class_msg[rej_ptr->rej_class]); switch (rej_ptr->rej_class) { case 1 : msg_tbl = class1_rej_code_msg; break; case 2 : msg_tbl = class2_rej_code_msg; break; case 3 : msg_tbl = class3_rej_code_msg; break; case 5 : msg_tbl = class5_rej_code_msg; break; case 9 : msg_tbl = class9_rej_code_msg; break; case 10 : msg_tbl = class10_rej_code_msg; break; case 11 : msg_tbl = class11_rej_code_msg; break; default : sprintf (buf2," Code %d",rej_ptr->rej_class); strcat (buf,buf2); msg_tbl = NULL; } if (msg_tbl) strcat (buf,msg_tbl[rej_ptr->rej_code]); break; case CNF_DISCONNECTED : /* channel terminated */ sprintf (buf,"\n %s : Connection Terminated ",msg); break; default : /* other error */ sprintf (buf,"\n %s : Error Code = 0x%04x",msg, req_ptr->resp_err); break; } printf (buf); }/************************************************************************//* confirmation function not supported *//************************************************************************/ST_VOID u_conf_not_supp (MMSREQ_PEND *req_ptr) { if (mms_debug_sel & MMS_LOG_USR_CONF) { conf_info_print (req_ptr,"Confirmation not supported"); conf_info_wait (); } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -