[libpri-commits] rmudgett: branch 1.4 r1836 - in /branches/1.4: libpri.h pri.c

SVN commits to the libpri project libpri-commits at lists.digium.com
Thu Jul 22 13:00:02 CDT 2010


Author: rmudgett
Date: Thu Jul 22 12:59:57 2010
New Revision: 1836

URL: http://svnview.digium.com/svn/libpri?view=rev&rev=1836
Log:
Add pri_new_bri_cb() API - Create BRI D-channel with user defined I/O callbacks and data

There currently exists a pri_new_cb() API call that allows you to create a
PRI with user-defined I/O read and write callbacks, and option userdata.

Add the same capability for BRI interfaces by adding a pri_new_bri_cb()
API function.

(closes issue #16477)
Reported by: nic_bellamy
Patches:
      pri_new_bri_cb_api.patch uploaded by nic bellamy (license 299) (with minor cosmetic changes)

Modified:
    branches/1.4/libpri.h
    branches/1.4/pri.c

Modified: branches/1.4/libpri.h
URL: http://svnview.digium.com/svn/libpri/branches/1.4/libpri.h?view=diff&rev=1836&r1=1835&r2=1836
==============================================================================
--- branches/1.4/libpri.h (original)
+++ branches/1.4/libpri.h Thu Jul 22 12:59:57 2010
@@ -1308,6 +1308,9 @@
 /* Create D-channel just as above with user defined I/O callbacks and data */
 struct pri *pri_new_cb(int fd, int nodetype, int switchtype, pri_io_cb io_read, pri_io_cb io_write, void *userdata);
 
+/* Create BRI D-channel just as above with user defined I/O callbacks and data */
+struct pri *pri_new_bri_cb(int fd, int ptpmode, int nodetype, int switchtype, pri_io_cb io_read, pri_io_cb io_write, void *userdata);
+
 /* Retrieve the user data associated with the D channel */
 void *pri_get_userdata(struct pri *pri);
 

Modified: branches/1.4/pri.c
URL: http://svnview.digium.com/svn/libpri/branches/1.4/pri.c?view=diff&rev=1836&r1=1835&r2=1836
==============================================================================
--- branches/1.4/pri.c (original)
+++ branches/1.4/pri.c Thu Jul 22 12:59:57 2010
@@ -457,6 +457,21 @@
 	return __pri_new_tei(fd, nodetype, switchtype, NULL, io_read, io_write, userdata, Q921_TEI_PRI, 0);
 }
 
+struct pri *pri_new_bri_cb(int fd, int ptpmode, int nodetype, int switchtype, pri_io_cb io_read, pri_io_cb io_write, void *userdata)
+{
+	if (!io_read) {
+		io_read = __pri_read;
+	}
+	if (!io_write) {
+		io_write = __pri_write;
+	}
+	if (ptpmode) {
+		return __pri_new_tei(fd, nodetype, switchtype, NULL, io_read, io_write, userdata, Q921_TEI_PRI, 1);
+	} else {
+		return __pri_new_tei(fd, nodetype, switchtype, NULL, io_read, io_write, userdata, Q921_TEI_GROUP, 1);
+	}
+}
+
 void *pri_get_userdata(struct pri *pri)
 {
 	return pri ? pri->userdata : NULL;




More information about the libpri-commits mailing list