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

📄 u_acse.c

📁 ICCP Toolkit 是在 Tru64下开发Tase.2通信协议的开发包
💻 C
字号:
/************************************************************************//* SISCO SOFTWARE MODULE HEADER *****************************************//************************************************************************//*   (c) Copyright Systems Integration Specialists Company, Inc.,	*//*      	  1986 - 2001, All Rights Reserved.		        *//*									*//* MODULE NAME : u_acse.c						*//* PRODUCT(S)  : MMSEASE						*//*									*//* MODULE DESCRIPTION : 						*//*	This module contains application functions that are called by	*//*	SUIC when communication events occur.  These functions are	*//*	mostly for user information, and are not typically required.	*//*	However, they may be used for any desired purpose, and in the	*//*	sample application, they provide a mechanism to print case	*//*	transfer information if enabled.				*//*									*//* GLOBAL FUNCTIONS DEFINED IN THIS MODULE :				*//*									*//* MODIFICATION LOG :							*//*  Date     Who   Rev			Comments			*//* --------  ---  ------   -------------------------------------------	*//* 10/19/01  EJV     06    UNIX: Added timeout in while loop.		*//* 01/28/99  EJV     05    Added some sys includes for select() call.	*//* 12/07/98  EJV     04    Replaced // comment.				*//* 09/14/98  EJV     03    Added check for pipe full condition for all	*//*			   UNIX systems in u_mllp_a_assoc_ind		*//* 09/01/98  RKR     02    Added code to lookup the caller's id		*//* 05/13/97  DSF     01    Added Security-related code			*//* 04/15/97  DSF   7.00    MMSEASE 7.0 release. See MODL70.DOC for	*//*			   history.					*//************************************************************************/#include "glbtypes.h"#include "sysincs.h"#include "scrndefs.h"#include "mms_usr.h"#include "suicacse.h"#include "userdefs.h"#include "fkeydefs.h"#include "gvaldefs.h"#if defined (_AIX) || (defined (__alpha) && !defined(__VMS)) || defined (__hpux)#if defined (__alpha)#include <sys/time.h>#endif#if !defined (__hpux)#include <sys/select.h>		/* we need define for fd_set struct */#endif#endif/*#define CHECKOUT_RESP*/ /* define to ask question in u_mllp_a_assoc_ind	*//************************************************************************//* For debug version, use a static pointer to avoid duplication of 	*//* __FILE__ strings.							*//************************************************************************/#ifdef DEBUG_SISCOstatic ST_CHAR *thisFileName = __FILE__;#endif/************************************************************************//************************************************************************//* ACSE INDICATION USER FUNCTIONS					*//************************************************************************//************************************************************************//*			u_mllp_a_assoc_ind					*//* This function is called by MMSEASE when an association indication	*//* is received. The user is to examine any association indication info	*//* to determine whether to accept the association. All ACSE AARQ parms	*//* are accessable via the 'assinfo->ar_info', and the proposed pres'	*//* contexts are found in the 'assinfo->p_contexts'. The '->matched'	*//* flag indicates that the received ar_info for the local matched that	*//* which was registered onto the channel.				*//************************************************************************/ST_RET u_mllp_a_assoc_ind (ST_INT chan, ACSE_ASSINFO *assinfo)  {ACSE_AR_INFO *ar;register i;#ifdef SECURITY_SUPPORTPASSBASED_INFO	*password_ptr;DESCBC_INFO	*descbc_ptr;#endifAPP_REF	appref;ST_CHAR arname[65];  if (mms_debug_sel & MMS_LOG_USR_IND)    {    clear_bottom ();		/* clear the bottom area		*/    printf (" Channel %d Assoc. Ind. Received",chan);    ar = assinfo -> ar_info;    if (ar -> AP_title_pres)      {      printf ("\n AP title present : ");      for (i = 0; i < ar -> AP_title.num_comps; i++)        printf (" %d",ar -> AP_title.comps[i]);      }    else      printf ("\n AP title not present ");    if (ar -> AE_qual_pres)      printf ("\n AE Qualifier present : %ld",ar -> AE_qual);    else      printf ("\n AE Qualifier not present ");    if (ar -> part_AP_title_pres)      {      printf ("\n Partner AP title present : ");      for (i = 0; i < ar -> part_AP_title.num_comps; i++)        printf (" %d",ar -> part_AP_title.comps[i]);      }    else      printf ("\n Partner AP title not present ");    if (ar -> part_AE_qual_pres)      printf ("\n Partner AE Qualifier present : %ld",ar -> part_AE_qual);    else      printf ("\n Partner AE Qualifier not present ");    printf ("\n AR matched = %d, P_Contexts = %04x",assinfo->ar_matched,					assinfo->p_contexts);    if (ar -> part_AP_title_form == APP_REF_FORM2)      {      appref.form = APP_REF_FORM2;/* Copy the AP Title if any						*/      appref.ap_title_pres = ar -> part_AP_title_pres;      if (ar -> part_AP_title_pres)        {        appref.ap_title.form_2.num_comps=ar->part_AP_title.num_comps;        for (i = 0; i < ar -> part_AP_title.num_comps; i++)	  {	  appref.ap_title.form_2.comps[i]=ar->part_AP_title.comps[i];	  }        }/* Copy the AE Qualifier if any 					*/      appref.ae_qual_pres = ar->part_AE_qual_pres;      if (ar -> part_AE_qual_pres)        {        appref.ae_qual.form_2 = ar -> part_AE_qual;	}/* Invoke ID (instance) information, ignore		      		*/      appref.ap_invoke_pres = SD_FALSE;      appref.ae_invoke_pres = SD_FALSE;      if (ms_appref_to_arname(arname, &appref) == SD_SUCCESS)        {	printf( "\n Matched Partner AR Name %s in DIB", arname);	}      else        {	printf( "\n Partner AR Name not matched in DIB");	}      }#ifdef SECURITY_SUPPORT	if (ar->secure_assoc )  	  { 	  printf ("\n %d bytes of Calling Authentication Value present:\n",	           ar->part_auth_value_len);          list_bytes (ar->part_auth_value, ar->part_auth_value_len);	  printf ("\n Encryption method is: ");	  switch (ar->algo_type)	    {	    case ALGO_PASSWORD:	      printf ("ALGO_PASSWORD");	      break;	    case ALGO_DESCBC:	      printf ("ALGO_DESCBC");	      break;	    default :	      printf ("not PASSWORD or DESCBC"); 	      break;	    }	  printf ("\n Calling Mechanism Name: [ ");	  for (i=0; i<ar->part_mech_name.num_comps; i++)	    {	    printf("%d ",ar->part_mech_name.comps[i]);	    }          printf ("]");	  switch (ar->algo_type)	    {	    case ALGO_PASSWORD:	      password_ptr = (PASSBASED_INFO *)ar->mech_info;	      if (password_ptr->passwd_pres==SD_TRUE)	        {                printf ("\n Calling password: '%s'",password_ptr->password);                if (password_ptr->level>0)                  printf ("\n Password matched OK at level: %d",		          password_ptr->level);		else  	          printf ("\n Password not found in local configuration");		}	      else	        printf ("\n Password is not present");	      break;	    case ALGO_DESCBC:	      descbc_ptr = (DESCBC_INFO	*)ar->mech_info;	      printf ("\n Sender Name: [ ");              for (i=0; i<descbc_ptr->sender_id.num_comps; i++)                {                printf("%d ",descbc_ptr->sender_id.comps[i]);                }              printf ("]");	      printf ("\n Recipient Name: [ ");              for (i=0; i<descbc_ptr->recip_id.num_comps; i++)                {                printf("%d ",descbc_ptr->recip_id.comps[i]);                }              printf ("]");	      printf ("\n Encryption Key table index: %d", descbc_ptr->index);	      printf ("\n Encryption Key: ");              list_bytes (descbc_ptr->key, KEY_LENGTH);	      printf ("\n Initialization Key: ");              list_bytes (descbc_ptr->iv, IV_LENGTH);	      if (descbc_ptr->passwd_pres==SD_TRUE)	        {                printf ("\n Calling password: '%s'",descbc_ptr->password);                if (descbc_ptr->level>0)                  printf ("\n Password matched OK at level: %d",		          descbc_ptr->level);		else  	          printf ("\n Password not found in local configuration");		}	      else	        printf ("\n Password is not present");	      break;	    default:	      break;	    }	  }	else	  printf ("\n Connection is not secure" );#endif#ifdef CHECKOUT_RESP    printf ("\n\n     U_ASSOC_IND_RESP_OK           : %d",U_ASSOC_IND_RESP_OK);    printf ("\n     U_ASSOC_IND_RESP_REJECT       : %d",U_ASSOC_IND_RESP_REJECT);    printf ("\n     U_ASSOC_IND_RESP_ABORT_OK     : %d",U_ASSOC_IND_RESP_ABORT_OK);    printf ("\n     U_ASSOC_IND_RESP_ABORT_REJECT : %d",U_ASSOC_IND_RESP_ABORT_REJECT);    printf("\n Enter Response to Associate Indication: ");     if (!intget(&u_mllp_a_assoc_ind_ret))      u_mllp_a_assoc_ind_ret = U_ASSOC_IND_RESP_OK; /* hope for the best*/#else    wait_msg ("");#endif    }#if defined(_AIX) || (defined(__alpha) && !defined(__VMS)) || defined(sun) || \    defined(__hpux)  { /* start block */  struct timeval time_to_wait;  ST_INT req_type;  ST_INT wait_time = 2000;	/* try for 2 sec to send the response	*/  switch (u_mllp_a_assoc_ind_ret)    {    case U_ASSOC_IND_RESP_OK :      req_type = S_REQTYPE_ASSOC_ACCEPT;    break;    case U_ASSOC_IND_RESP_REJECT :      req_type = S_REQTYPE_ASSOC_REJECT;    break;    case U_ASSOC_IND_RESP_ABORT_OK :    case U_ASSOC_IND_RESP_ABORT_REJECT :      req_type = S_REQTYPE_U_ABORT;    break;    }    /* Check if resources are available for transmitting the response.	*/  /* Timeout to prevent the stack deregistering our application in case */  /* our pipe gets full because we are not reading any messages.	*/  while (s_chk_sys_resource (req_type) == SD_FAILURE && wait_time > 0)    {    time_to_wait.tv_sec = 0;    time_to_wait.tv_usec = 50 * 1000;			/* milli-seconds */    select(0,(fd_set *)0,(fd_set *)0,(fd_set *)0,&time_to_wait);    wait_time -= 50;    }  }  /* end block */#endif  switch (u_mllp_a_assoc_ind_ret)    {    case U_ASSOC_IND_RESP_OK :      return (SD_SUCCESS);    break;    case U_ASSOC_IND_RESP_REJECT :      return (SD_FAILURE);    break;    case U_ASSOC_IND_RESP_ABORT_OK :      mp_abort (chan,1);      return (SD_SUCCESS);    break;    case U_ASSOC_IND_RESP_ABORT_REJECT :      mp_abort (chan,1);      return (SD_FAILURE);    break;    }  return (SD_SUCCESS);  }/************************************************************************//*			u_mllp_a_assoc_conf				*//* This function is called by MMSEASE when an association confirm	*//* is received. It allows the user to verify that the p-contexts that	*//* were negiotiated are acceptable, and also to allow examination of	*//* the AARS PDU information.						*//* THis function returns '0' for OK to accept, else the abort reason to *//* use.									*//************************************************************************/ST_RET u_mllp_a_assoc_conf (ST_INT chan, ACSE_ASSINFO *assinfo)  {ACSE_AR_INFO *ar;register i;  if (mms_debug_sel & MMS_LOG_USR_CONF)    {    clear_bottom ();		/* clear the bottom area		*/    printf (" Channel %d Assoc. Confirm Received",chan);    printf ("\n P_Contexts = %04x",assinfo->p_contexts);    ar = assinfo -> ar_info;    if (ar -> part_AP_title_pres)      {      printf ("\n Partner AP title present : ");      for (i = 0; i < ar -> part_AP_title.num_comps; i++)        printf (" %d",ar -> part_AP_title.comps[i]);      }    else      printf ("\n Partner AP title not present ");    if (ar -> part_AE_qual_pres)      printf ("\n Partner AE Qualifier present : %ld",ar -> part_AE_qual);    else      printf ("\n Partner AE Qualifier not present ");    printf ("\n AR matched = %d, P_Contexts = %04x",assinfo->ar_matched,					assinfo->p_contexts);    wait_msg ("");    }					/* Accept any P-context's     	*/  return (0); 				/* OK, allow to continue	*/  }/************************************************************************//************************************************************************//* MMS/SUIC AUXILIARY FUNCTIONS 					*//************************************************************************//************************************************************************//*			msg_ready					*//* This function is called when INI message print is enabled (printen)	*//* and a INI message is available					*//* Print INI messages at top of screen. 				*//************************************************************************/ST_VOID msg_ready (ST_CHAR *msgptr)  {  clear_bottom ();		/* use a aux. MMSEASE function to set	*/  printf ("\n\n\n\n %s",msgptr); /* to write the bottom of the screen   */  }

⌨️ 快捷键说明

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