GC_PARM gcs7_parm; gcs7_parm.intvalue = 8;if(gc_SetParm(dev,GCPR_RECEIVE_INFO_BUF,gcs7_parm)!=GC_SUCCESS){ // print_GC_error( dev, "gc_SetParm"); } else { // LOG_TRACE(dev, "gc_SetParm( )"); }
char buffer[350]; // Should be enough to hold the Global Call SS7 SIGINFO header + any ISUP message S7_SIGINFO_BLK *blk_p = (S7_SIGINFO_BLK *)buffer; blk_p->length = 350;int t_res = gc_GetSigInfo(dev, buffer, 0, &metaevt); if(t_res == 0){ // LOG_TRACE(dev, "gc_GetSigInfo() succeeded: length of SigInfo block [%d]; ISUP primitive [%d]", blk_p->length, blk_p->prim); Parse(blk_p); } else { //print_GC_error( dev, "gc_GetSigInfo"); }
static void Parse(S7_SIGINFO_BLK *a_blk_p) { printf("gc_GetSigInfo() succeeded: length of SigInfo block [%d]; ISUP primitive [%d]\n", a_blk_p->length, a_blk_p->prim); S7_IE *t_data_p = &a_blk_p->data; int t_CurrIESize = sizeof(S7_IE) - 1 + t_data_p->length; int t_BytesLeft = a_blk_p->length-2; while((t_BytesLeft >= sizeof(S7_IE)) && (t_BytesLeft >= t_CurrIESize)){ unsigned char t_ByteValue; unsigned short t_ShortValue; unsigned int t_IntValue; printf("Found parameter %d [0x%x]; length=%d; ", t_data_p->parm, t_data_p->parm, t_data_p->length); switch(t_data_p->length){ case 0: printf("Parsing error: length=0\n"); break; case 1: t_ByteValue = t_data_p->value; memcpy(&t_ByteValue, &t_data_p->value, 1); printf("value = [0x%x]\n", t_ByteValue); break; case 2: memcpy(&t_ShortValue, &t_data_p->value, 2); printf("value = [0x%x]\n", t_ShortValue); break; case 4: memcpy(&t_IntValue, &t_data_p->value, 4); printf("value = [0x%x]\n", t_IntValue); break; default: //more // eventually write suitable code here to print data for IE of 3 bytes or of more than // 4 bytes of length ... break; } //next step t_BytesLeft -= t_CurrIESize; t_data_p = (S7_IE*)((char*)t_data_p + t_CurrIESize); t_CurrIESize = sizeof(S7_IE) - 1 + t_data_p->length; } }