[Asterisk-cvs] libpri-matt pri_facility.h, 1.6, 1.7 pri_internal.h, 1.7, 1.8 prisched.c, 1.1.1.1, 1.2

mattf at lists.digium.com mattf at lists.digium.com
Wed Dec 29 13:14:58 CST 2004


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

Modified Files:
	pri_facility.h pri_internal.h prisched.c 
Log Message:
Beginning ADPU scheduling mechanism for intersting protocols link ROSE, GFT,
etc


Index: pri_facility.h
===================================================================
RCS file: /usr/cvsroot/libpri-matt/pri_facility.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- pri_facility.h	27 Dec 2004 21:43:08 -0000	1.6
+++ pri_facility.h	29 Dec 2004 18:09:45 -0000	1.7
@@ -14,10 +14,8 @@
 #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)
 
+/* ROSE stuff */
 /* Protocol Profile field */
 #define ROSE_OPERATIONS		17	/* X.219 & X.229 */
 #define ROSE_CMIP		18	/* Q.941 */
@@ -110,6 +108,9 @@
 		break; \
 	}
 
+#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)
 extern FUNC_SEND(transmit_facility);
 extern FUNC_RECV(receive_facility);
 

Index: pri_internal.h
===================================================================
RCS file: /usr/cvsroot/libpri-matt/pri_internal.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- pri_internal.h	27 Dec 2004 21:43:08 -0000	1.7
+++ pri_internal.h	29 Dec 2004 18:09:45 -0000	1.8
@@ -140,6 +140,16 @@
 #define MWI_STATE_INTER_SEND		5
 #define MWI_STATE_INTER_SEND_RESULT	6
 
+/* For scheduling the sending and receiving of invokes, etc */
+struct adpu_event {
+	int message;
+	void (*callback)(void *data);
+	void *data;
+	void *adpu;
+	int adpu_len;
+	struct adpu_event *next;
+};
+
 /* q931_call datastructure */
 struct q931_call {
 	struct pri *pri;	/* PRI */
@@ -217,6 +227,8 @@
 
 	int justsignalling;		/* For establishment of Call Independent Signalling Connections */
 	int mwi_state;			/* More MWI related stuff */
+
+	struct adpu_event *adpus;	/* For dynamic scheduling of ADPUs in facility messages */
 };
 
 extern int pri_schedule_event(struct pri *pri, int ms, void (*function)(void *data), void *data);
@@ -231,4 +243,6 @@
 
 extern void pri_error(char *fmt, ...);
 
+int pri_call_adpu_queue(q931_call *call, int messagetype, void *adpu, int adpu_len, void (*function)(void *data), void *data);
+
 #endif

Index: prisched.c
===================================================================
RCS file: /usr/cvsroot/libpri-matt/prisched.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- prisched.c	5 Nov 2004 19:23:16 -0000	1.1.1.1
+++ prisched.c	29 Dec 2004 18:09:45 -0000	1.2
@@ -25,6 +25,8 @@
 #include "libpri.h"
 #include "pri_internal.h"
 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 
 
 static int maxsched = 0;
@@ -116,3 +118,38 @@
 		pri_error("Asked to delete sched id %d???\n", id);
 	pri->pri_sched[id].callback = NULL;
 }
+
+int pri_call_adpu_queue(q931_call *call, int messagetype, void *adpu, int adpu_len, void (*function)(void *data), void *data)
+{
+	struct adpu_event *cur = NULL;
+	struct adpu_event *new_event = NULL;
+
+	if (!call || !messagetype || !adpu || (adpu_len < 1))
+		return -1;
+
+	new_event = malloc(sizeof(struct adpu_event));
+	memset(new_event, 0, sizeof(struct adpu_event));
+
+	if (new_event) {
+		new_event->message = messagetype;
+		new_event->callback = function;
+		new_event->data = data;
+		new_event->adpu = adpu;
+		new_event->adpu_len = adpu_len;
+	} else {
+		pri_error("malloc failed\n");
+		return -1;
+	}
+	
+	if (call->adpus) {
+		cur = call->adpus;
+		while (cur->next) {
+			cur = cur->next;
+		}
+		cur->next = new_event;
+	} else
+		call->adpus = new_event;
+
+	return 0;
+}
+




More information about the svn-commits mailing list