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

📄 test-m2pa.c

📁 No7信令,我需要交换类似的代码, 请店长审核,谢谢了,急着交换,谢谢
💻 C
📖 第 1 页 / 共 5 页
字号:
			ret = ACK;			break;		case M2PA_PROVING_MESSAGE:			ret = PROVING;			break;		case M2PA_DATA_MESSAGE:			ret = DATA;			break;		default:			ret = FAILURE;			break;	}	if ( ret != oldret )	{		if ( ret == DATA && !expand )			cntmsg++;		else			cntret = 0;		oldret = ret;		if ( verbose )		{		if ( cntret )		{			printf("    Ct=%5d                                                        \n",cntret+1);			FFLUSH(stdout);		}		}		cntret = 0;	}	else		if ( !expand )			cntret++;#if 0	if ( show_fisus || ret != FISU || verbose )	{		if ( ret != oldret || oldisb != (((iut_bib|iut_bsn)<<8)|(iut_fib|iut_fsn)) )		{//			if ( oldisb == (((iut_bib|iut_bsn)<<8)|(iut_fib|iut_fsn)) &&//					( ( ret == FISU && oldret == DATA ) || ( ret == DATA && oldret == FISU ) ) )//			{//				if ( ret == DATA && !expand )//					cntmsg++;//			}//			else				cntret = 0;			oldret = ret;			oldisb = ((iut_bib|iut_bsn)<<8)|(iut_fib|iut_fsn);			if ( verbose )			{			if ( cntret )			{				printf("    Ct=%5d                                                        \n",cntret+1);				FFLUSH(stdout);			}			}			cntret = 0;		}		else			if ( !expand )				cntret++;	}#endif	if ( !cntret )	{		switch ( ret )		{			case IN_SERVICE:				printf("                         <-----------------  IN-SERVICE             \n");				FFLUSH(stdout);				return ret;			case ALIGNMENT:				printf("                         <-----------------  ALIGNMENT              \n");				FFLUSH(stdout);				return ret;			case PROVING_NORMAL:				printf("                         <-----------------  PROVING-NORMAL         \n");				FFLUSH(stdout);				return ret;			case PROVING_EMERG:				printf("                         <-----------------  PROVING-EMERGENCY      \n");				FFLUSH(stdout);				return ret;			case OUT_OF_SERVICE:				printf("                         <-----------------  OUT-OF-SERVICE         \n");				FFLUSH(stdout);				return ret;			case PROCESSOR_OUTAGE:				printf("                         <-----------------  PROCESSOR-OUTAGE       \n");				FFLUSH(stdout);				return ret;			case BUSY:				printf("                         <-----------------  BUSY                   \n");				FFLUSH(stdout);				return ret;			case INVALID_STATUS:				printf("                         <-----------------  [INVALID STATUS]       \n");				FFLUSH(stdout);				return ret;			case PROCESSOR_ENDED:				printf("                         <-----------------  PROCESSOR-OUTAGE-ENDED \n");				FFLUSH(stdout);				return ret;			case BUSY_ENDED:				printf("                         <-----------------  BUSY-ENDED             \n");				FFLUSH(stdout);				return ret;			case ACK:				printf("                         <-----------------  ACK [%5u msgs]       \n",ntohl(((uint32_t *)pt_buf)[2]));				FFLUSH(stdout);				return ret;			case PROVING:				printf("                         <-----------------  PROVING [%5u bytes]  \n",ntohl(((uint32_t *)pt_buf)[1])-2*sizeof(uint32_t));				FFLUSH(stdout);				return ret;			case DATA:				if ( show_msus || verbose )				{					printf("                         <-----------------  DATA [%5u bytes]     \n",ntohl(((uint32_t *)pt_buf)[1])-2*sizeof(uint32_t));					FFLUSH(stdout);					return ret;				}				return ret;			default:				printf("                         <-----------------  ????????               \n");				FFLUSH(stdout);				return ret;		}	}	return ret;}/* *  ------------------------------------------------------------------------- * *  Decode ctrl at Protocol Tester * *  ------------------------------------------------------------------------- */static int pt_decode_msg(unsigned char *buf){	union primitives *p = (union primitives *)buf;	if ( debug && verbose )	printf("pt decode msg...         <-----------------                         \n");	switch ( p->npi.type )	{		case N_DATA_IND:			if ( verbose )			{				printf("              !data ind                                             \n");				FFLUSH(stdout);			}			return pt_decode_data();		case N_EXDATA_IND:			if ( verbose )			{				printf("            !exdata ind                                             \n");				FFLUSH(stdout);			}			return pt_decode_data();		case N_CONN_IND:			if ( verbose )			{				printf("              !conn ind                                             \n");				FFLUSH(stdout);			}			pt_seq = p->npi.conn_ind.SEQ_number;			return UNKNOWN;		case N_CONN_CON:			if ( verbose )			{				printf("              !conn con                                             \n");				FFLUSH(stdout);			}			return UNKNOWN;		case N_DISCON_IND:			if ( verbose )			{				printf("            !discon ind                                             \n");				FFLUSH(stdout);			}			return DISCON_IND;		case N_INFO_ACK:			if ( verbose )			{				printf("              !info ack                                             \n");				FFLUSH(stdout);			}			return UNKNOWN;		case N_BIND_ACK:			if ( verbose )			{				printf("              !bind ack                                             \n");				printf("    cons = %lu\n",p->npi.bind_ack.CONIND_number);				printf("    tok  = %lx\n",p->npi.bind_ack.TOKEN_value);				printf("    alen = %lu\n",p->npi.bind_ack.ADDR_length);				if ( p->npi.bind_ack.ADDR_length == 14 )				{					addr_t *a = (addr_t *)(buf+p->npi.bind_ack.ADDR_offset);					printf("    port = %u\n",ntohs(a->port));					printf("    add1 = %d.%d.%d.%d\n",							(a->addr[0]>> 0)&0xff,							(a->addr[0]>> 8)&0xff,							(a->addr[0]>>16)&0xff,							(a->addr[0]>>24)&0xff);					printf("    add2 = %d.%d.%d.%d\n",							(a->addr[1]>> 0)&0xff,							(a->addr[1]>> 8)&0xff,							(a->addr[1]>>16)&0xff,							(a->addr[1]>>24)&0xff);					printf("    add3 = %d.%d.%d.%d\n",							(a->addr[2]>> 0)&0xff,							(a->addr[2]>> 8)&0xff,							(a->addr[2]>>16)&0xff,							(a->addr[2]>>24)&0xff);				}				FFLUSH(stdout);			}			pt_tok = p->npi.bind_ack.TOKEN_value;			return BIND_ACK;		case N_ERROR_ACK:			if ( verbose )			{				printf("             !error ack                                             \n");				FFLUSH(stdout);			}			return ERROR_ACK;		case N_OK_ACK:			if ( verbose )			{				printf("                !ok ack                                             \n");				FFLUSH(stdout);			}			return OK_ACK;		case N_UNITDATA_IND:			if ( verbose )			{				printf("          !unitdata ind                                             \n");				FFLUSH(stdout);			}			return UNKNOWN;		case N_UDERROR_IND:			if ( verbose )			{				printf("           !uderror ind                                             \n");				FFLUSH(stdout);			}			return UNKNOWN;		case N_DATACK_IND:			if ( verbose )			{				printf("            !datack ind                                             \n");				FFLUSH(stdout);			}			return ACK;		case N_RESET_IND:			if ( verbose )			{				printf("             !reset ind                                             \n");				FFLUSH(stdout);			}			return UNKNOWN;		case N_RESET_CON:			if ( verbose )			{				printf("             !reset con                                             \n");				FFLUSH(stdout);			}			return UNKNOWN;		default:			printf("         !(unknown %3ld)                                             \n",p->npi.type);			FFLUSH(stdout);			return UNKNOWN;	}}/* *  ------------------------------------------------------------------------- * *  Decode data at Implementation Under Test * *  ------------------------------------------------------------------------- */static int iut_decode_data(void){	printf("                                             !msu                   \n");	FFLUSH(stdout);	return IUT_DATA;}/* *  ------------------------------------------------------------------------- * *  Decode ctrl at Implementation Under Test * *  ------------------------------------------------------------------------- */static int iut_decode_msg(unsigned char *buf){	char *reason;	union primitives *p = (union primitives *)buf;	if ( p->sl.sl_primitive != oldprm )	{		oldprm = p->sl.sl_primitive;		cntprm = 0;	}	else		if ( !expand )			cntprm++;	switch ( p->prim )	{		case SL_REMOTE_PROCESSOR_OUTAGE_IND:			if ( !cntprm )			{				printf("                                             !rpo                   \n");				FFLUSH(stdout);			}			return IUT_RPO;		case SL_REMOTE_PROCESSOR_RECOVERED_IND:			if ( !cntprm )			{				printf("                                             !rpr                   \n");				FFLUSH(stdout);			}			return IUT_RPR;		case SL_IN_SERVICE_IND:			printf("                                             !in service            \n");			FFLUSH(stdout);			return IUT_IN_SERVICE;		case SL_OUT_OF_SERVICE_IND:			switch ( p->sl.out_of_service_ind.sl_reason )			{				case SL_FAIL_UNSPECIFIED:            reason = "unspec"; break;				case SL_FAIL_CONG_TIMEOUT:           reason = "T6";     break;				case SL_FAIL_ACK_TIMEOUT:            reason = "T7";     break;				case SL_FAIL_ABNORMAL_BSNR:          reason = "BSNR";   break;				case SL_FAIL_ABNORMAL_FIBR:          reason = "FIBR";   break;				case SL_FAIL_SUERM_EIM:              reason = "SUERM";  break;				case SL_FAIL_ALIGNMENT_NOT_POSSIBLE: reason = "AERM";   break;				case SL_FAIL_RECEIVED_SIO:           reason = "SIO";    break;				case SL_FAIL_RECEIVED_SIN:           reason = "SIN";    break;				case SL_FAIL_RECEIVED_SIE:           reason = "SIE";    break;				case SL_FAIL_RECEIVED_SIOS:          reason = "SIOS";   break;				case SL_FAIL_T1_TIMEOUT:             reason = "T1";     break;				default:                             reason = "???";    break;			}			printf("                                             !out of service(%s)\n", reason);			FFLUSH(stdout);			return IUT_OUT_OF_SERVICE;		case SL_PDU_IND:			printf("                                             !msu                   \n");			FFLUSH(stdout);			return IUT_DATA;		case SL_LINK_CONGESTED_IND:			printf("                                             !congested             \n");			FFLUSH(stdout);			return UNKNOWN;		case SL_LINK_CONGESTION_CEASED_IND:			printf("                                             !congestion ceased     \n");			FFLUSH(stdout);			return UNKNOWN;		case SL_RETRIEVED_MESSAGE_IND:			printf("                                             !retrieved message     \n");			FFLUSH(stdout);			return UNKNOWN;		case SL_RETRIEVAL_COMPLETE_IND:			printf("                                             !retrieval compelte    \n");			FFLUSH(stdout);			return UNKNOWN;		case SL_RB_CLEARED_IND:			printf("                                             !rb cleared            \n");			FFLUSH(stdout);			return UNKNOWN;		case SL_BSNT_IND:			printf("                                             !bsnt                  \n");			FFLUSH(stdout);			return UNKNOWN;		case SL_RTB_CLEARED_IND:			printf("                                             !rtb cleared           \n");			FFLUSH(stdout);			return UNKNOWN;		case LMI_INFO_ACK:			if ( verbose )			{				printf("                                             !info ack              \n");				FFLUSH(stdout);			}			return UNKNOWN;		case LMI_OK_ACK:			if ( verbose )			{				printf("                                             !ok ack                \n");				FFLUSH(stdout);			}			return OK_ACK;		case LMI_ERROR_ACK:			if ( verbose )			{				printf("                                             !error ack             \n");				FFLUSH(stdout);			}			return ERROR_ACK;		case LMI_ENABLE_CON:			if ( verbose )			{				printf("                                             !enable con            \n");				FFLUSH(stdout);			}			return ENABLE_CON;		case LMI_DISABLE_CON:			if ( verbose )			{				printf("                                             !disable con           \n");				FFLUSH(stdout);			}			return DISABLE_CON;		case LMI_ERROR_IND:			if ( verbose )			{				printf("                                             !error ind             \n");				FFLUSH(stdout);			}			return ERROR_IND;		case LMI_STATS_IND:			if ( verbose )			{				printf("                                             !stats ind             \n");				FFLUSH(stdout);			}			return UNKNOWN;		case LMI_EVENT_IND:			if ( verbose )			{				printf("                                             !event ind             \n");				FFLUSH(stdout);			}			return UNKNOWN;		case N_CONN_IND:			if ( verbose )			{				printf("                                             !conn ind              \n");				FFLUSH(stdout);			}			iut_seq = p->npi.conn_ind.SEQ_number;			return UNKNOWN;		case N_CONN_CON:			if ( verbose )			{				printf("                                             !conn con              \n");				FFLUSH(stdout);			}			return CONN_CON;		case N_DISCON_IND:			if ( verbose )			{				printf("                                             !discon ind            \n");				FFLUSH(stdout);			}			return UNKNOWN;		case N_INFO_ACK:			if ( verbose )			{				printf("                                             !info ack              \n");				FFLUSH(stdout);			}

⌨️ 快捷键说明

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