[Asterisk-cvs] libpri-matt pri_facility.c, 1.5, 1.6 pri_facility.h, 1.4, 1.5 q931.c, 1.6, 1.7

mattf at lists.digium.com mattf at lists.digium.com
Thu Dec 23 13:06:23 CST 2004


Update of /usr/cvsroot/libpri-matt
In directory mongoose.digium.com:/tmp/cvs-serv753

Modified Files:
	pri_facility.c pri_facility.h q931.c 
Log Message:
Organizing, got to run


Index: pri_facility.c
===================================================================
RCS file: /usr/cvsroot/libpri-matt/pri_facility.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- pri_facility.c	15 Dec 2004 21:09:03 -0000	1.5
+++ pri_facility.c	23 Dec 2004 18:02:00 -0000	1.6
@@ -156,3 +156,95 @@
 	return -1;
 }
 
+FUNC_SEND(transmit_facility)
+{
+	int i = 0;
+	struct rose_component *comp;
+	unsigned char namelen = strlen(call->callername);
+
+	if ((namelen > 0) && (pri->switchtype == PRI_SWITCH_QSIG)) {
+		ie->data[i] = ROSE_NETWORK_EXTENSION | 0x80 /* No extra octets */;
+		i++;
+		/* Interpretation component */
+		comp = (struct rose_component*)&ie->data[i];
+		comp->type = COMP_TYPE_INTERPRETATION;
+		comp->len = 0x01;
+		comp->data[0] = 0x00; /* Discard unrecognized invokes */
+
+		i += 3;
+		comp = (struct rose_component*)&ie->data[i];
+		/* Invoke ID */
+		comp->type = COMP_TYPE_INVOKE;
+		comp->len = 3 /* sizeof Invoke ID */
+			+ 3 /* sizeof Operation tag */
+			+ 2 /* first two bytes of the Arguement section */
+			+ namelen;
+
+		i += 2;
+		comp = (struct rose_component*)&ie->data[i];
+		/* Invoke component contents */
+		/*	Invoke ID */
+		comp->type = ASN1_INTEGER;
+		comp->len = 0x01;
+		comp->data[0] = 0x01; /* Invoke ID value */
+		i += 3;
+		comp = (struct rose_component*)&ie->data[i];
+		/*	Operation Tag */
+		comp->type = ASN1_INTEGER;
+		comp->len = 0x01;
+		comp->data[0] = 0x00; /* Calling name */
+		i += 3;
+		comp = (struct rose_component*)&ie->data[i];
+		/* Arugement Tag */
+		comp->type = ROSE_NAME_PRESENTATION_ALLOWED_SIMPLE;
+		comp->len = namelen;
+		i += 2;
+		memcpy(comp->data, call->callername, namelen);
+		i += namelen;
+		return i+2 /* 2 = length of IE header */;
+	}
+
+	return 0;
+}
+
+FUNC_RECV(receive_facility)
+{
+	int i = 0;
+	struct rose_component *comp = NULL;
+
+	if (ie->len < 1)
+		return -1;
+
+	if(ie->data[i] != 0x9F) {
+		if (pri->debug) pri_message("!! Don't know how to handle Service Discriminator of type 0x%X\n", ie->data[i]);
+		return -1;
+	}
+	i++;
+
+	if (ie->len < 3)
+		return -1;
+	
+	while ((i+1 < ie->len) && (&ie->data[i])) {
+		comp = (struct rose_component*)&ie->data[i];
+		if (comp->type) {
+			switch (comp->type) {
+				case COMP_TYPE_INTERPRETATION:
+					if (pri->debug) pri_message("Handle ROSE interpretation component\n");
+					break;
+				case COMP_TYPE_INVOKE:
+					rose_invoke_decode(call, comp->data, comp->len);
+					break;
+				case COMP_TYPE_NFE:
+					if (pri->debug) pri_message("Handle NFE component\n");
+					break;
+				default:
+					if (pri->debug) pri_message("Don't know how to handle ROSE component of type 0x%X\n", comp->type);
+					break;
+			}
+		}
+		i += (comp->len + 2);
+	}
+
+	return 0;
+}
+

Index: pri_facility.h
===================================================================
RCS file: /usr/cvsroot/libpri-matt/pri_facility.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- pri_facility.h	15 Dec 2004 16:21:48 -0000	1.4
+++ pri_facility.h	23 Dec 2004 18:02:00 -0000	1.5
@@ -14,6 +14,10 @@
 #ifndef _PRI_FACILITY_H
 #define _PRI_FACILITY_H
 
+#define FUNC_DUMP(name) void ((name))(int full_ie, q931_ie *ie, int len, char prefix)
+#define FUNC_RECV(name) int ((name))(int full_ie, struct pri *pri, q931_call *call, int msgtype, q931_ie *ie, int len)
+#define FUNC_SEND(name) int ((name))(int full_ie, struct pri *pri, q931_call *call, int msgtype, q931_ie *ie, int len)
+
 /* Protocol Profile field */
 #define ROSE_OPERATIONS		17	/* X.219 & X.229 */
 #define ROSE_CMIP		18	/* Q.941 */
@@ -105,6 +109,8 @@
 
 /* Decoder for the invoke part of a ROSE request
    It currently only support calling name decode */
+extern FUNC_SEND(transmit_facility);
+extern FUNC_RECV(receive_facility);
 extern int rose_invoke_decode(struct q931_call *call, unsigned char *data, int len);
 
 #endif /* _PRI_FACILITY_H */

Index: q931.c
===================================================================
RCS file: /usr/cvsroot/libpri-matt/q931.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- q931.c	15 Dec 2004 21:09:03 -0000	1.6
+++ q931.c	23 Dec 2004 18:02:00 -0000	1.7
@@ -1015,98 +1015,6 @@
 	return 0;
 }
 
-static FUNC_SEND(transmit_facility)
-{
-	int i = 0;
-	struct rose_component *comp;
-	unsigned char namelen = strlen(call->callername);
-
-	if ((namelen > 0) && (pri->switchtype == PRI_SWITCH_QSIG)) {
-		ie->data[i] = ROSE_NETWORK_EXTENSION | 0x80 /* No extra octets */;
-		i++;
-		/* Interpretation component */
-		comp = (struct rose_component*)&ie->data[i];
-		comp->type = COMP_TYPE_INTERPRETATION;
-		comp->len = 0x01;
-		comp->data[0] = 0x00; /* Discard unrecognized invokes */
-
-		i += 3;
-		comp = (struct rose_component*)&ie->data[i];
-		/* Invoke ID */
-		comp->type = COMP_TYPE_INVOKE;
-		comp->len = 3 /* sizeof Invoke ID */
-			+ 3 /* sizeof Operation tag */
-			+ 2 /* first two bytes of the Arguement section */
-			+ namelen;
-
-		i += 2;
-		comp = (struct rose_component*)&ie->data[i];
-		/* Invoke component contents */
-		/*	Invoke ID */
-		comp->type = ASN1_INTEGER;
-		comp->len = 0x01;
-		comp->data[0] = 0x01; /* Invoke ID value */
-		i += 3;
-		comp = (struct rose_component*)&ie->data[i];
-		/*	Operation Tag */
-		comp->type = ASN1_INTEGER;
-		comp->len = 0x01;
-		comp->data[0] = 0x00; /* Calling name */
-		i += 3;
-		comp = (struct rose_component*)&ie->data[i];
-		/* Arugement Tag */
-		comp->type = ROSE_NAME_PRESENTATION_ALLOWED_SIMPLE;
-		comp->len = namelen;
-		i += 2;
-		memcpy(comp->data, call->callername, namelen);
-		i += namelen;
-		return i+2 /* 2 = length of IE header */;
-	}
-
-	return 0;
-}
-
-static FUNC_RECV(receive_facility)
-{
-	int i = 0;
-	struct rose_component *comp = NULL;
-
-	if (ie->len < 1)
-		return -1;
-
-	if(ie->data[i] != 0x9F) {
-		if (pri->debug) pri_message("!! Don't know how to handle Service Discriminator of type 0x%X\n", ie->data[i]);
-		return -1;
-	}
-	i++;
-
-	if (ie->len < 3)
-		return -1;
-	
-	while ((i+1 < ie->len) && (&ie->data[i])) {
-		comp = (struct rose_component*)&ie->data[i];
-		if (comp->type) {
-			switch (comp->type) {
-				case COMP_TYPE_INTERPRETATION:
-					if (pri->debug) pri_message("Handle ROSE interpretation component\n");
-					break;
-				case COMP_TYPE_INVOKE:
-					rose_invoke_decode(call, comp->data, comp->len);
-					break;
-				case COMP_TYPE_NFE:
-					if (pri->debug) pri_message("Handle NFE component\n");
-					break;
-				default:
-					if (pri->debug) pri_message("Don't know how to handle ROSE component of type 0x%X\n", comp->type);
-					break;
-			}
-		}
-		i += (comp->len + 2);
-	}
-
-	return 0;
-}
-
 static FUNC_SEND(transmit_progress_indicator)
 {
 	/* Can't send progress indicator on GR-303 -- EVER! */




More information about the svn-commits mailing list