Intial m3ua commit. Inital port of our m3ua. This should be enough to do ISUP

git-svn-id: http://svn.openzap.org/svn/openzap/trunk@438 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
Shane Burrell 2008-04-03 03:19:52 +00:00
parent d06ede0e44
commit 4dbaeebd55
2 changed files with 133 additions and 0 deletions

View File

@ -0,0 +1,58 @@
/* WARNING WORK IN PROGRESS
* mstm3ua.c
* mstss7d port
*
* Created by Shane Burrell on 2/2/08.
* Copyright 2008 Shane Burrell. All rights reserved.
*
*/
#include "mstm3ua.h"
int build_route_context(unsigned char *opc, unsigned char *dpc, unsigned char *bytemsg, unsigned char len)
{
//Routing Context
bytemsg[8] = 0x10; //Tag 0x210 Protocol Data
bytemsg[9] = 0x02;
bytemsg[10] = len; //Len
bytemsg[11] = 0x00;
bytemsg[12] = opc[2]; //OPC Member
bytemsg[13] = opc[1]; //OPC Cluster
bytemsg[14] = opc[0]; //OPC Network
bytemsg[15] = 0x00;
bytemsg[16] = dpc[2];//DPC Member
bytemsg[17] = dpc[1];//DPC Cluster
bytemsg[18] = dpc[0];//DPC Network
bytemsg[19] = 0x00;
return 0;
}
int build_m3ua_hdr(unsigned char len,unsigned char *bytemsg)
{
bytemsg[0] = M_VERSION_REL1; // 1 Verison
//bytemsg[1] = 0x00; // 2 RESERVED
//bytemsg[2] = M_CLASS_XFER; // 3 Msg Class
//SS7 BOX Kludge
bytemsg[1] = 0x01; // 2 RESERVED
bytemsg[2] = 0x00; // 2 RESERVED
bytemsg[3] = M_TYPE_DATA ; // 4 Msg Type
bytemsg[4] = len; // 5 Msg LENGTH 81 32bit field
bytemsg[5] = 0x00; // 6
bytemsg[6] = 0x00; // 7
bytemsg[7] = 0x00; // 8
return(0);
};

View File

@ -0,0 +1,75 @@
/* mstm3ua.h
* mstss7d
*
* Created by Shane Burrell on 3/2/08.
* Copyright 2008 Shane Burrell. All rights reserved.
*
*/
#ifndef __SS7_M3UA_H__
#define __SS7_M3UA_H__
typedef unsigned long m3ua_ulong;
typedef unsigned short m3ua_ushort;
typedef unsigned char m3ua_uchar;
typedef unsigned char u8;
typedef unsigned short u16; /* Note: multi-byte values are little-endian */
typedef unsigned long u32;
#define M_TAG_NETWORK_APPEARANCE 1
#define M_TAG_PROTOCOL_DATA 3
#define M_TAG_INFO_STRING 4
#define M_TAG_AFFECTED_DPC 5
#define M_TAG_ROUTING_CONTEXT 6
#define M_TAG_DIAGNOSTIC_INFORMATION 7
#define M_TAG_HEARTBEAT_DATA 8
#define M_TAG_UNAVAILABILITY_CAUSE 9
#define M_TAG_REASON 10
#define M_TAG_TRAFFIC_MODE_TYPE 11
#define M_TAG_ERROR_CODE 12
#define M_TAG_STATUS_TYPE 13
#define M_TAG_CONGESTED_INDICATIONS 14
#define M_VERSION_REL1 1
#define M_CLASS_MGMT 0x00
#define M_CLASS_XFER 0x01
#define M_CLASS_SSNM 0x02
#define M_CLASS_ASPSM 0x03
#define M_CLASS_ASPTM 0x04
#define M_CLASS_RKM 0x09
#define M_TYPE_ERR (0|M_CLASS_MGMT
#define M_TYPE_NTFY (1|M_CLASS_XFER)
#define M_TYPE_DATA (1|M_CLASS_XFER)
#define M_TYPE_DUNA (1|M_CLASS_SSNM)
#define M_TYPE_DAVA (2|M_CLASS_SSNM)
#define M_TYPE_DUAD (3|M_CLASS_SSNM)
#define M_TYPE_SCON (4|M_CLASS_SSNM)
#define M_TYPE_DUPU (5|M_CLASS_SSNM)
#define M_TYPE_UP (1|M_CLASS_ASPSM)
#define M_TYPE_DOWN (2|M_CLASS_ASPSM)
#define M_TYPE_BEAT (3|M_CLASS_ASPSM)
#define M_TYPE_UP_ACK (4|M_CLASS_ASPSM)
#define M_TYPE_DOWN_ACK (5|M_CLASS_ASPSM)
#define M_TYPE_BEAT_ACK (6|M_CLASS_ASPSM)
#define M_TYPE_ACTIVE (1|M_CLASS_ASPTM)
#define M_TYPE_INACTIVE (2|M_CLASS_ASPTM)
#define M_TYPE_ACTIVE_ACK (3|M_CLASS_ASPTM)
#define M_TYPE_INACTIVE_ACK (4|M_CLASS_ASPTM)
#define M_CLASS_MASK 0xff00
#define M_TYPE_MASK 0x00ff
#endif