[libss7-commits] mattf: trunk r77 - in /trunk: README isup.c isup.h
libss7.h mtp3.c ss7linktest.c
libss7-commits at lists.digium.com
libss7-commits at lists.digium.com
Fri Mar 30 13:46:34 MST 2007
Author: mattf
Date: Fri Mar 30 15:46:33 2007
New Revision: 77
URL: http://svn.digium.com/view/libss7?view=rev&rev=77
Log:
Add support for mulitple DPCs and CIC groups. (#9423)
Modified:
trunk/README
trunk/isup.c
trunk/isup.h
trunk/libss7.h
trunk/mtp3.c
trunk/ss7linktest.c
Modified: trunk/README
URL: http://svn.digium.com/view/libss7/trunk/README?view=diff&rev=77&r1=76&r2=77
==============================================================================
--- trunk/README (original)
+++ trunk/README Fri Mar 30 15:46:33 2007
@@ -59,7 +59,9 @@
short term:
SUS/RES
-CPG
+CallerID presentation
+RDNIS
+Timer for last SU received so we know if layer2 goes out under us
long term:
SCCP support
Modified: trunk/isup.c
URL: http://svn.digium.com/view/libss7/trunk/isup.c?view=diff&rev=77&r1=76&r2=77
==============================================================================
--- trunk/isup.c (original)
+++ trunk/isup.c Fri Mar 30 15:46:33 2007
@@ -711,9 +711,15 @@
return c;
}
-void isup_init_call(struct ss7 *ss7, struct isup_call *c, int cic, char *calledpartynum, char *callingpartynum)
+void isup_set_call_dpc(struct isup_call *c, unsigned int dpc)
+{
+ c->dpc = dpc;
+}
+
+void isup_init_call(struct ss7 *ss7, struct isup_call *c, int cic, unsigned int dpc, char *calledpartynum, char *callingpartynum)
{
c->cic = cic;
+ c->dpc = dpc;
if (calledpartynum && calledpartynum[0]) {
if (ss7->switchtype == SS7_ITU)
snprintf(c->called_party_num, sizeof(c->called_party_num), "%s#", calledpartynum);
@@ -882,7 +888,9 @@
rlptr = ss7_msg_userpart(msg);
rl.opc = ss7->pc;
rl.sls = sls_next(ss7);
- rl.dpc = ss7->def_dpc;
+ /* use CIC's DPC instead of linkset's DPC */
+ /* rl.dpc = ss7->def_dpc; */
+ rl.dpc = c->dpc;
rl.type = ss7->switchtype;
rlsize = set_routinglabel(rlptr, &rl);
mh = (struct isup_h *)(rlptr + rlsize); /* Note to self, do NOT put a typecasted pointer next to an addition operation */
@@ -1254,7 +1262,7 @@
}
}
-static int isup_send_cicgroupmessage(struct ss7 *ss7, int messagetype, int begincic, int endcic, unsigned char status[], int type)
+static int isup_send_cicgroupmessage(struct ss7 *ss7, int messagetype, int begincic, int endcic, unsigned int dpc, unsigned char status[], int type)
{
struct isup_call call;
int i;
@@ -1272,7 +1280,7 @@
return isup_send_message(ss7, &call, messagetype, cicgroup_params);
}
-int isup_grs(struct ss7 *ss7, int begincic, int endcic)
+int isup_grs(struct ss7 *ss7, int begincic, int endcic, unsigned int dpc)
{
struct isup_call call;
@@ -1281,6 +1289,8 @@
call.cic = begincic;
call.range = endcic - begincic;
+ call.dpc = dpc;
+ call.dpc = dpc;
if (call.range > 31)
return -1;
@@ -1288,7 +1298,7 @@
return isup_send_message(ss7, &call, ISUP_GRS, greset_params);
}
-int isup_gra(struct ss7 *ss7, int begincic, int endcic)
+int isup_gra(struct ss7 *ss7, int begincic, int endcic, unsigned int dpc)
{
struct isup_call call;
@@ -1296,6 +1306,7 @@
return -1;
call.cic = begincic;
call.range = endcic - begincic;
+ call.dpc = dpc;
if (call.range > 31)
return -1;
@@ -1303,35 +1314,35 @@
return isup_send_message(ss7, &call, ISUP_GRA, greset_params);
}
-int isup_cgb(struct ss7 *ss7, int begincic, int endcic, unsigned char state[], int type)
+int isup_cgb(struct ss7 *ss7, int begincic, int endcic, unsigned int dpc, unsigned char state[], int type)
{
if (!ss7)
return -1;
- return isup_send_cicgroupmessage(ss7, ISUP_CGB, begincic, endcic, state, type);
-}
-
-int isup_cgu(struct ss7 *ss7, int begincic, int endcic, unsigned char state[], int type)
+ return isup_send_cicgroupmessage(ss7, ISUP_CGB, begincic, endcic, dpc, state, type);
+}
+
+int isup_cgu(struct ss7 *ss7, int begincic, int endcic, unsigned int dpc, unsigned char state[], int type)
{
if (!ss7)
return -1;
- return isup_send_cicgroupmessage(ss7, ISUP_CGU, begincic, endcic, state, type);
-}
-
-int isup_cgba(struct ss7 *ss7, int begincic, int endcic, unsigned char state[], int type)
+ return isup_send_cicgroupmessage(ss7, ISUP_CGU, begincic, endcic, dpc, state, type);
+}
+
+int isup_cgba(struct ss7 *ss7, int begincic, int endcic, unsigned int dpc, unsigned char state[], int type)
{
if (!ss7)
return -1;
- return isup_send_cicgroupmessage(ss7, ISUP_CGBA, begincic, endcic, state, type);
-}
-
-int isup_cgua(struct ss7 *ss7, int begincic, int endcic, unsigned char state[], int type)
+ return isup_send_cicgroupmessage(ss7, ISUP_CGBA, begincic, endcic, dpc, state, type);
+}
+
+int isup_cgua(struct ss7 *ss7, int begincic, int endcic, unsigned int dpc, unsigned char state[], int type)
{
if (!ss7)
return -1;
- return isup_send_cicgroupmessage(ss7, ISUP_CGUA, begincic, endcic, state, type);
+ return isup_send_cicgroupmessage(ss7, ISUP_CGUA, begincic, endcic, dpc, state, type);
}
int isup_iam(struct ss7 *ss7, struct isup_call *c)
@@ -1395,11 +1406,12 @@
return res;
}
-static int isup_send_message_ciconly(struct ss7 *ss7, int messagetype, int cic)
+static int isup_send_message_ciconly(struct ss7 *ss7, int messagetype, int cic, unsigned int dpc)
{
int res;
struct isup_call c;
c.cic = cic;
+ c.dpc = dpc;
res = isup_send_message(ss7, &c, messagetype, empty_params);
return res;
}
@@ -1413,43 +1425,43 @@
return isup_send_message(ss7, c, ISUP_CPG, cpg_params);
}
-int isup_rsc(struct ss7 *ss7, int cic)
+int isup_rsc(struct ss7 *ss7, int cic, unsigned int dpc)
{
if (!ss7)
return -1;
- return isup_send_message_ciconly(ss7, ISUP_RSC, cic);
-}
-
-int isup_blo(struct ss7 *ss7, int cic)
+ return isup_send_message_ciconly(ss7, ISUP_RSC, cic, dpc);
+}
+
+int isup_blo(struct ss7 *ss7, int cic, unsigned int dpc)
{
if (!ss7)
return -1;
- return isup_send_message_ciconly(ss7, ISUP_BLO, cic);
-}
-
-int isup_ubl(struct ss7 *ss7, int cic)
+ return isup_send_message_ciconly(ss7, ISUP_BLO, cic, dpc);
+}
+
+int isup_ubl(struct ss7 *ss7, int cic, unsigned int dpc)
{
if (!ss7)
return -1;
- return isup_send_message_ciconly(ss7, ISUP_UBL, cic);
-}
-
-int isup_bla(struct ss7 *ss7, int cic)
+ return isup_send_message_ciconly(ss7, ISUP_UBL, cic, dpc);
+}
+
+int isup_bla(struct ss7 *ss7, int cic, unsigned int dpc)
{
if (!ss7)
return -1;
- return isup_send_message_ciconly(ss7, ISUP_BLA, cic);
-}
-
-int isup_uba(struct ss7 *ss7, int cic)
+ return isup_send_message_ciconly(ss7, ISUP_BLA, cic, dpc);
+}
+
+int isup_uba(struct ss7 *ss7, int cic, unsigned int dpc)
{
if (!ss7)
return -1;
- return isup_send_message_ciconly(ss7, ISUP_UBA, cic);
+ return isup_send_message_ciconly(ss7, ISUP_UBA, cic, dpc);
}
/* Janelle is the bomb (Again) */
Modified: trunk/isup.h
URL: http://svn.digium.com/view/libss7/trunk/isup.h?view=diff&rev=77&r1=76&r2=77
==============================================================================
--- trunk/isup.h (original)
+++ trunk/isup.h Fri Mar 30 15:46:33 2007
@@ -137,6 +137,8 @@
unsigned short cic;
unsigned short slc;
struct isup_call *next;
+ /* set DPC according to CIC's DPC, not linkset */
+ unsigned int dpc;
};
int isup_receive(struct ss7 *ss7, struct mtp2 *sl, unsigned char *sif, int len);
Modified: trunk/libss7.h
URL: http://svn.digium.com/view/libss7/trunk/libss7.h?view=diff&rev=77&r1=76&r2=77
==============================================================================
--- trunk/libss7.h (original)
+++ trunk/libss7.h Fri Mar 30 15:46:33 2007
@@ -219,27 +219,29 @@
int isup_cpg(struct ss7 *ss7, struct isup_call *c, int event);
-int isup_gra(struct ss7 *ss7, int begincic, int endcic);
-
-int isup_grs(struct ss7 *ss7, int begincic, int endcic);
-
-int isup_cgb(struct ss7 *ss7, int begincic, int endcic, unsigned char state[], int type);
-
-int isup_cgu(struct ss7 *ss7, int begincic, int endcic, unsigned char state[], int type);
-
-int isup_cgba(struct ss7 *ss7, int begincic, int endcic, unsigned char state[], int type);
-
-int isup_cgua(struct ss7 *ss7, int begincic, int endcic, unsigned char state[], int type);
-
-int isup_blo(struct ss7 *ss7, int cic);
-
-int isup_ubl(struct ss7 *ss7, int cic);
-
-int isup_bla(struct ss7 *ss7, int cic);
-
-int isup_uba(struct ss7 *ss7, int cic);
-
-int isup_rsc(struct ss7 *ss7, int cic);
-
-void isup_init_call(struct ss7 *ss7, struct isup_call *c, int cic, char *calledpartynum, char *callingpartynum);
+int isup_gra(struct ss7 *ss7, int begincic, int endcic, unsigned int dpc);
+
+int isup_grs(struct ss7 *ss7, int begincic, int endcic, unsigned int dpc);
+
+int isup_cgb(struct ss7 *ss7, int begincic, int endcic, unsigned int dpc, unsigned char state[], int type);
+
+int isup_cgu(struct ss7 *ss7, int begincic, int endcic, unsigned int dpc, unsigned char state[], int type);
+
+int isup_cgba(struct ss7 *ss7, int begincic, int endcic, unsigned int dpc, unsigned char state[], int type);
+
+int isup_cgua(struct ss7 *ss7, int begincic, int endcic, unsigned int dpc, unsigned char state[], int type);
+
+int isup_blo(struct ss7 *ss7, int cic, unsigned int dpc);
+
+int isup_ubl(struct ss7 *ss7, int cic, unsigned int dpc);
+
+int isup_bla(struct ss7 *ss7, int cic, unsigned int dpc);
+
+int isup_uba(struct ss7 *ss7, int cic, unsigned int dpc);
+
+int isup_rsc(struct ss7 *ss7, int cic, unsigned int dpc);
+
+void isup_init_call(struct ss7 *ss7, struct isup_call *c, int cic, unsigned int dpc, char *calledpartynum, char *callingpartynum);
+
+void isup_set_call_dpc(struct isup_call *c, unsigned int dpc);
#endif /* _LIBSS7_H */
Modified: trunk/mtp3.c
URL: http://svn.digium.com/view/libss7/trunk/mtp3.c?view=diff&rev=77&r1=76&r2=77
==============================================================================
--- trunk/mtp3.c (original)
+++ trunk/mtp3.c Fri Mar 30 15:46:33 2007
@@ -352,6 +352,7 @@
struct ss7_msg *m;
struct routing_label drl;
unsigned char *layer4;
+ ss7_event *e;
int rllen;
m = ss7_msg_new();
@@ -380,6 +381,19 @@
ss7_msg_userpart_len(m, rllen + testpatsize + 2);
mtp3_transmit(ss7, (ss7->switchtype == SS7_ITU) ? SIG_STD_TEST : SIG_SPEC_TEST, mtp2->slc, m);
+
+ /* Update linkstate */
+
+ mtp3_setstate_mtp2link(ss7, mtp2, MTP2_LINKSTATE_UP);
+
+ if (ss7->state != SS7_STATE_UP) {
+ e = ss7_next_empty_event(ss7);
+ if (!e) {
+ mtp_error(ss7, "Event queue full\n");
+ return -1;
+ }
+ e->e = SS7_EVENT_UP;
+ }
return 0;
} else if (h1 == 2) {
Modified: trunk/ss7linktest.c
URL: http://svn.digium.com/view/libss7/trunk/ss7linktest.c?view=diff&rev=77&r1=76&r2=77
==============================================================================
--- trunk/ss7linktest.c (original)
+++ trunk/ss7linktest.c Fri Mar 30 15:46:33 2007
@@ -13,6 +13,9 @@
#include <zaptel/zaptel.h>
#include "libss7.h"
+#define OUR_PC 0x1
+#define THEIR_PC 0x2
+
struct linkset {
struct ss7 *ss7;
int linkno;
@@ -32,7 +35,7 @@
c = isup_new_call(ss7);
if (c) {
- isup_init_call(ss7, c, (callcount % 12) + 1, "12345", "7654321");
+ isup_init_call(ss7, c, (callcount % 12) + 1, THEIR_PC, "12345", "7654321");
isup_iam(ss7, c);
printf("Callcount = %d\n ", ++callcount);
}
@@ -132,8 +135,8 @@
break;
case ISUP_EVENT_GRS:
printf("Got GRS from cic %d to %d: Acknowledging\n", e->grs.startcic, e->grs.endcic);
- isup_gra(ss7, e->grs.startcic, e->grs.endcic);
- isup_grs(ss7, e->grs.startcic, e->grs.endcic);
+ isup_gra(ss7, e->grs.startcic, e->grs.endcic, THEIR_PC);
+ isup_grs(ss7, e->grs.startcic, e->grs.endcic, THEIR_PC);
break;
case ISUP_EVENT_RSC:
isup_rlc(ss7, e->rsc.call);
@@ -143,13 +146,13 @@
//ss7_call(ss7);
break;
case ISUP_EVENT_BLO:
- isup_bla(ss7, e->blo.cic);
+ isup_bla(ss7, e->blo.cic, THEIR_PC);
break;
case ISUP_EVENT_CGB:
- isup_cgba(ss7, e->cgb.startcic, e->cgb.endcic, e->cgb.status, e->cgb.type);
+ isup_cgba(ss7, e->cgb.startcic, e->cgb.endcic, THEIR_PC, e->cgb.status, e->cgb.type);
break;
case ISUP_EVENT_CGU:
- isup_cgua(ss7, e->cgu.startcic, e->cgu.endcic, e->cgu.status, e->cgu.type);
+ isup_cgua(ss7, e->cgu.startcic, e->cgu.endcic, THEIR_PC, e->cgu.status, e->cgu.type);
break;
case ISUP_EVENT_IAM:
printf("Got IAM for cic %d and number %s\n", e->iam.cic, e->iam.called_party_num);
@@ -242,9 +245,9 @@
exit(1);
}
- ss7_set_pc(ss7, 0x1);
- ss7_set_adjpc(ss7, fd, 0x2);
- ss7_set_default_dpc(ss7, 0x2);
+ ss7_set_pc(ss7, OUR_PC);
+ ss7_set_adjpc(ss7, fd, THEIR_PC);
+ ss7_set_default_dpc(ss7, THEIR_PC);
if (pthread_create(&tmp, NULL, ss7_run, &linkset[0])) {
perror("thread(0)");
More information about the libss7-commits
mailing list