From c5cdc66b723e9419f99abc889052d03b5729e6a8 Mon Sep 17 00:00:00 2001 From: Richard Mudgett Date: Thu, 25 Jun 2009 17:35:23 +0000 Subject: [PATCH] Convert PRI_TIMER_xxx to an enum so PRI_MAX_TIMERS can be automatically adjusted. git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@901 2fbb986a-6c06-0410-b554-c9c1f0a7f128 --- libpri.h | 67 ++++++++++++++++++++++++++++++-------------------------- 1 file changed, 36 insertions(+), 31 deletions(-) diff --git a/libpri.h b/libpri.h index 47cb6b4..c8efc26 100644 --- a/libpri.h +++ b/libpri.h @@ -722,41 +722,46 @@ int pri_set_timer(struct pri *pri, int timer, int value); int pri_get_timer(struct pri *pri, int timer); int pri_timer2idx(const char *timer_name); -#define PRI_MAX_TIMERS 32 +/* New configurable timers and counters must be added to the end of the list */ +enum PRI_TIMERS_AND_COUNTERS { + PRI_TIMER_N200, /* Maximum numer of Q.921 retransmissions */ + PRI_TIMER_N201, /* Maximum numer of octets in an information field */ + PRI_TIMER_N202, /* Maximum numer of transmissions of the TEI identity request message */ + PRI_TIMER_K, /* Maximum number of outstanding I-frames */ -#define PRI_TIMER_N200 0 /* Maximum numer of q921 retransmissions */ -#define PRI_TIMER_N201 1 /* Maximum numer of octets in an information field */ -#define PRI_TIMER_N202 2 /* Maximum numer of transmissions of the TEI identity request message */ -#define PRI_TIMER_K 3 /* Maximum number of outstanding I-frames */ + PRI_TIMER_T200, /* Time between SABME's */ + PRI_TIMER_T201, /* Minimum time between retransmissions of the TEI Identity check messages */ + PRI_TIMER_T202, /* Minimum time between transmission of TEI Identity request messages */ + PRI_TIMER_T203, /* Maximum time without exchanging packets */ -#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 /* maximum time without exchanging packets */ + PRI_TIMER_T300, + PRI_TIMER_T301, /* Maximum time to respond to an ALERT */ + PRI_TIMER_T302, + PRI_TIMER_T303, /* Maximum time to wait after sending a SETUP without a response */ + PRI_TIMER_T304, + PRI_TIMER_T305, /* Wait for DISCONNECT acknowledge */ + PRI_TIMER_T306, + PRI_TIMER_T307, + PRI_TIMER_T308, /* Wait for RELEASE acknowledge */ + PRI_TIMER_T309, /* Time active calls can tollerate data link layer being down before clearing. */ + PRI_TIMER_T310, /* Maximum time between receiving a CALL_PROCEEDING and receiving a ALERT/CONNECT/DISCONNECT/PROGRESS */ + PRI_TIMER_T313, /* Wait for CONNECT acknowledge, CPE side only */ + PRI_TIMER_T314, + PRI_TIMER_T316, /* Maximum time between transmitting a RESTART and receiving a RESTART ACK */ + PRI_TIMER_T317, + PRI_TIMER_T318, + PRI_TIMER_T319, + PRI_TIMER_T320, + PRI_TIMER_T321, + PRI_TIMER_T322, -#define PRI_TIMER_T300 8 -#define PRI_TIMER_T301 9 /* maximum time to respond to an ALERT */ -#define PRI_TIMER_T302 10 -#define PRI_TIMER_T303 11 /* maximum time to wait after sending a SETUP without a response */ -#define PRI_TIMER_T304 12 -#define PRI_TIMER_T305 13 -#define PRI_TIMER_T306 14 -#define PRI_TIMER_T307 15 -#define PRI_TIMER_T308 16 -#define PRI_TIMER_T309 17 -#define PRI_TIMER_T310 18 /* maximum time between receiving a CALLPROCEEDING and receiving a ALERT/CONNECT/DISCONNECT/PROGRESS */ -#define PRI_TIMER_T313 19 -#define PRI_TIMER_T314 20 -#define PRI_TIMER_T316 21 /* maximum time between transmitting a RESTART and receiving a RESTART ACK */ -#define PRI_TIMER_T317 22 -#define PRI_TIMER_T318 23 -#define PRI_TIMER_T319 24 -#define PRI_TIMER_T320 25 -#define PRI_TIMER_T321 26 -#define PRI_TIMER_T322 27 + PRI_TIMER_TM20, /* Maximum time awaiting XID response */ + PRI_TIMER_NM20, /* Number of XID retransmits */ -#define PRI_TIMER_TM20 28 /* maximum time awaiting XID response */ -#define PRI_TIMER_NM20 29 /* number of XID retransmits */ + /* Must be last in the enum list */ + _PRI_MAX_TIMERS, + PRI_MAX_TIMERS = (_PRI_MAX_TIMERS < 32) ? 32 : _PRI_MAX_TIMERS +}; /* Get PRI version */ const char *pri_get_version(void);