[libpri-commits] rmudgett: branch group/issue14292 r900 - /team/group/issue14292/
SVN commits to the libpri project
libpri-commits at lists.digium.com
Wed Jun 24 17:38:16 CDT 2009
Author: rmudgett
Date: Wed Jun 24 17:38:12 2009
New Revision: 900
URL: http://svn.asterisk.org/svn-view/libpri?view=rev&rev=900
Log:
Merged revisions 896 via svnmerge from
https://origsvn.digium.com/svn/libpri/team/group/issue14068
................
r896 | root | 2009-06-24 17:18:58 -0500 (Wed, 24 Jun 2009) | 9 lines
Merged revisions 894 via svnmerge from
file:///srv/subversion/repos/libpri/branches/1.4
........
r894 | rmudgett | 2009-06-24 16:45:04 -0500 (Wed, 24 Jun 2009) | 2 lines
Make it easier to add more timers/counters and vary the defaults based upon switchtype.
........
................
Removed:
team/group/issue14292/pri_timers.h
Modified:
team/group/issue14292/ (props changed)
team/group/issue14292/libpri.h
team/group/issue14292/pri.c
Propchange: team/group/issue14292/
------------------------------------------------------------------------------
automerge = *
Propchange: team/group/issue14292/
------------------------------------------------------------------------------
--- issue14292-integrated (original)
+++ issue14292-integrated Wed Jun 24 17:38:12 2009
@@ -1,1 +1,1 @@
-/team/group/issue14068:1-892
+/team/group/issue14068:1-899
Propchange: team/group/issue14292/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Jun 24 17:38:12 2009
@@ -1,1 +1,1 @@
-/branches/1.4:1-890
+/branches/1.4:1-895
Modified: team/group/issue14292/libpri.h
URL: http://svn.asterisk.org/svn-view/libpri/team/group/issue14292/libpri.h?view=diff&rev=900&r1=899&r2=900
==============================================================================
--- team/group/issue14292/libpri.h (original)
+++ team/group/issue14292/libpri.h Wed Jun 24 17:38:12 2009
@@ -953,7 +953,7 @@
#define PRI_GETSET_TIMERS
int pri_set_timer(struct pri *pri, int timer, int value);
int pri_get_timer(struct pri *pri, int timer);
-int pri_timer2idx(char *timer);
+int pri_timer2idx(const char *timer_name);
#define PRI_MAX_TIMERS 32
@@ -965,7 +965,7 @@
#define PRI_TIMER_T200 4 /* time between SABME's */
#define PRI_TIMER_T201 5 /* minimum time between retransmissions of the TEI Identity check messages */
#define PRI_TIMER_T202 6 /* minimum time between transmission of TEI Identity request messages */
-#define PRI_TIMER_T203 7 /* maxiumum time without exchanging packets */
+#define PRI_TIMER_T203 7 /* maximum time without exchanging packets */
#define PRI_TIMER_T300 8
#define PRI_TIMER_T301 9 /* maximum time to respond to an ALERT */
@@ -988,7 +988,7 @@
#define PRI_TIMER_T321 26
#define PRI_TIMER_T322 27
-#define PRI_TIMER_TM20 28 /* maximum time avaiting XID response */
+#define PRI_TIMER_TM20 28 /* maximum time awaiting XID response */
#define PRI_TIMER_NM20 29 /* number of XID retransmits */
#define PRI_TIMER_CCBST2 30 /* maximum time on completion of CC Call */
Modified: team/group/issue14292/pri.c
URL: http://svn.asterisk.org/svn-view/libpri/team/group/issue14292/pri.c?view=diff&rev=900&r1=899&r2=900
==============================================================================
--- team/group/issue14292/pri.c (original)
+++ team/group/issue14292/pri.c Wed Jun 24 17:38:12 2009
@@ -42,7 +42,6 @@
#include "pri_facility.h"
#include "pri_q921.h"
#include "pri_q931.h"
-#include "pri_timers.h"
char *pri_node2str(int node)
{
@@ -84,13 +83,33 @@
}
}
-static void pri_default_timers(struct pri *pri, int switchtype)
-{
- static const int defaulttimers[20][PRI_MAX_TIMERS] = PRI_TIMERS_ALL;
- int x;
-
- for (x = 0; x<PRI_MAX_TIMERS; x++) {
- pri->timers[x] = defaulttimers[switchtype][x];
+static void pri_default_timers(struct pri *ctrl, int switchtype)
+{
+ unsigned idx;
+
+ /* Initialize all timers/counters to unsupported/disabled. */
+ for (idx = 0; idx < PRI_MAX_TIMERS; ++idx) {
+ ctrl->timers[idx] = -1;
+ }
+
+ /* Set timer values to standard defaults. Time is in ms. */
+ ctrl->timers[PRI_TIMER_N200] = 3; /* Max numer of Q.921 retransmissions */
+ ctrl->timers[PRI_TIMER_N202] = 3; /* Max numer of transmissions of the TEI identity request message */
+ ctrl->timers[PRI_TIMER_K] = 7; /* Max number of outstanding I-frames */
+ ctrl->timers[PRI_TIMER_T200] = 1000; /* Time between SABME's */
+ ctrl->timers[PRI_TIMER_T202] = 10000; /* Min time between transmission of TEI Identity request messages */
+ ctrl->timers[PRI_TIMER_T203] = 10000; /* Max time without exchanging packets */
+ ctrl->timers[PRI_TIMER_T305] = 30000; /* Wait for DISCONNECT acknowledge */
+ ctrl->timers[PRI_TIMER_T308] = 4000; /* Wait for RELEASE acknowledge */
+ ctrl->timers[PRI_TIMER_T313] = 4000; /* Wait for CONNECT acknowledge, CPE side only */
+ ctrl->timers[PRI_TIMER_TM20] = 2500; /* Max time awaiting XID response - Q.921 Appendix IV */
+ ctrl->timers[PRI_TIMER_NM20] = 3; /* Number of XID retransmits - Q.921 Appendix IV */
+ ctrl->timers[PRI_TIMER_CCBST2] = 45 * 60 * 1000;/* Q.SIG CC-Timer2 45 min */
+
+ /* Set any switch specific override default values */
+ switch (switchtype) {
+ default:
+ break;
}
}
@@ -119,66 +138,55 @@
return 0;
}
-int pri_timer2idx(char *timer)
-{
- if (!strcasecmp(timer, "N200"))
- return PRI_TIMER_N200;
- else if (!strcasecmp(timer, "N201"))
- return PRI_TIMER_N201;
- else if (!strcasecmp(timer, "N202"))
- return PRI_TIMER_N202;
- else if (!strcasecmp(timer, "K"))
- return PRI_TIMER_K;
- else if (!strcasecmp(timer, "T200"))
- return PRI_TIMER_T200;
- else if (!strcasecmp(timer, "T202"))
- return PRI_TIMER_T202;
- else if (!strcasecmp(timer, "T203"))
- return PRI_TIMER_T203;
- else if (!strcasecmp(timer, "T300"))
- return PRI_TIMER_T300;
- else if (!strcasecmp(timer, "T301"))
- return PRI_TIMER_T301;
- else if (!strcasecmp(timer, "T302"))
- return PRI_TIMER_T302;
- else if (!strcasecmp(timer, "T303"))
- return PRI_TIMER_T303;
- else if (!strcasecmp(timer, "T304"))
- return PRI_TIMER_T304;
- else if (!strcasecmp(timer, "T305"))
- return PRI_TIMER_T305;
- else if (!strcasecmp(timer, "T306"))
- return PRI_TIMER_T306;
- else if (!strcasecmp(timer, "T307"))
- return PRI_TIMER_T307;
- else if (!strcasecmp(timer, "T308"))
- return PRI_TIMER_T308;
- else if (!strcasecmp(timer, "T309"))
- return PRI_TIMER_T309;
- else if (!strcasecmp(timer, "T310"))
- return PRI_TIMER_T310;
- else if (!strcasecmp(timer, "T313"))
- return PRI_TIMER_T313;
- else if (!strcasecmp(timer, "T314"))
- return PRI_TIMER_T314;
- else if (!strcasecmp(timer, "T316"))
- return PRI_TIMER_T316;
- else if (!strcasecmp(timer, "T317"))
- return PRI_TIMER_T317;
- else if (!strcasecmp(timer, "T318"))
- return PRI_TIMER_T318;
- else if (!strcasecmp(timer, "T319"))
- return PRI_TIMER_T319;
- else if (!strcasecmp(timer, "T320"))
- return PRI_TIMER_T320;
- else if (!strcasecmp(timer, "T321"))
- return PRI_TIMER_T321;
- else if (!strcasecmp(timer, "T322"))
- return PRI_TIMER_T322;
- else if (!strcasecmp(timer, "CCT2"))
- return PRI_TIMER_CCBST2;
- else
- return -1;
+int pri_timer2idx(const char *timer_name)
+{
+ static const struct {
+ const char *name;
+ int number;
+ } timer[] = {
+/* *INDENT-OFF* */
+ { "N200", PRI_TIMER_N200 },
+ { "N201", PRI_TIMER_N201 },
+ { "N202", PRI_TIMER_N202 },
+ { "K", PRI_TIMER_K },
+ { "T200", PRI_TIMER_T200 },
+ { "T202", PRI_TIMER_T202 },
+ { "T203", PRI_TIMER_T203 },
+ { "T300", PRI_TIMER_T300 },
+ { "T301", PRI_TIMER_T301 },
+ { "T302", PRI_TIMER_T302 },
+ { "T303", PRI_TIMER_T303 },
+ { "T304", PRI_TIMER_T304 },
+ { "T305", PRI_TIMER_T305 },
+ { "T306", PRI_TIMER_T306 },
+ { "T307", PRI_TIMER_T307 },
+ { "T308", PRI_TIMER_T308 },
+ { "T309", PRI_TIMER_T309 },
+ { "T310", PRI_TIMER_T310 },
+ { "T313", PRI_TIMER_T313 },
+ { "T314", PRI_TIMER_T314 },
+ { "T316", PRI_TIMER_T316 },
+ { "T317", PRI_TIMER_T317 },
+ { "T318", PRI_TIMER_T318 },
+ { "T319", PRI_TIMER_T319 },
+ { "T320", PRI_TIMER_T320 },
+ { "T321", PRI_TIMER_T321 },
+ { "T322", PRI_TIMER_T322 },
+ { "CCT2", PRI_TIMER_CCBST2 },
+/* *INDENT-ON* */
+ };
+
+ unsigned idx;
+ int timer_number;
+
+ timer_number = -1;
+ for (idx = 0; idx < ARRAY_LEN(timer); ++idx) {
+ if (!strcasecmp(timer_name, timer[idx].name)) {
+ timer_number = timer[idx].number;
+ break;
+ }
+ }
+ return timer_number;
}
static int __pri_read(struct pri *pri, void *buf, int buflen)
More information about the libpri-commits
mailing list