update boost

git-svn-id: http://svn.openzap.org/svn/openzap/trunk@507 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
Anthony Minessale
2008-07-30 22:15:28 +00:00
parent 15fe36a6d7
commit 96ddc322d8
6 changed files with 321 additions and 104 deletions

View File

@@ -595,6 +595,18 @@ static __inline__ void zap_set_state_all(zap_span_t *span, zap_channel_state_t s
zap_mutex_unlock(span->mutex);
}
static __inline__ int zap_check_state_all(zap_span_t *span, zap_channel_state_t state)
{
uint32_t j;
for(j = 1; j <= span->chan_count; j++) {
if (span->channels[j].state != state || zap_test_flag((&span->channels[j]), ZAP_CHANNEL_STATE_CHANGE)) {
return 0;
}
}
return 1;
}
static __inline__ void zap_set_flag_all(zap_span_t *span, uint32_t flag)
{
uint32_t j;

View File

@@ -1,5 +1,5 @@
/****************************************************************************
* sigboost.h $Revision: 1.3 $
* sigboost.h $Revision: 1.5 $
*
* Definitions for the sigboost interface.
*
@@ -33,12 +33,12 @@ enum e_sigboost_event_id_values
SIGBOOST_EVENT_INSERT_CHECK_LOOP = 0x8a, /*138*/
SIGBOOST_EVENT_REMOVE_CHECK_LOOP = 0x8b, /*139*/
SIGBOOST_EVENT_AUTO_CALL_GAP_ABATE = 0x8c, /*140*/
SIGBOOST_EVENT_DIGIT_IN = 0x8d, /*141*/
};
enum e_sigboost_release_cause_values
{
SIGBOOST_RELEASE_CAUSE_UNDEFINED = 0,
SIGBOOST_RELEASE_CAUSE_NORMAL = 16,
SIGBOOST_RELEASE_CAUSE_BUSY = 17,
/* probable elimination */
//SIGBOOST_RELEASE_CAUSE_BUSY = 0x91, /* 145 */
//SIGBOOST_RELEASE_CAUSE_CALLED_NOT_EXIST = 0x92, /* 146 */
@@ -59,7 +59,6 @@ enum e_sigboost_call_setup_ack_nack_cause_values
};
#define MAX_DIALED_DIGITS 31
#define MAX_CALLING_NAME 31
/* Next two defines are used to create the range of values for call_setup_id
* in the t_sigboost structure.
@@ -68,37 +67,63 @@ enum e_sigboost_call_setup_ack_nack_cause_values
#define CORE_MAX_CHAN_PER_SPAN 30
#define MAX_PENDING_CALLS CORE_MAX_SPANS * CORE_MAX_CHAN_PER_SPAN
/* 0..(MAX_PENDING_CALLS-1) is range of call_setup_id below */
#define SIZE_RDNIS 80
//#undef MSGWINDOW
#define MSGWINDOW
#define SIZE_RDNIS 128
#pragma pack(1)
typedef struct
{
uint32_t event_id;
/* delete sequence numbers - SCTP does not need them */
uint32_t fseqno;
#ifdef MSGWINDOW
uint32_t bseqno;
#endif
uint16_t call_setup_id;
uint32_t trunk_group;
uint32_t span;
uint32_t chan;
uint8_t span;
uint8_t chan;
struct timeval tv;
uint8_t called_number_digits_count;
char called_number_digits [MAX_DIALED_DIGITS + 1]; /* it's a null terminated string */
uint8_t calling_number_digits_count; /* it's an array */
char calling_number_digits [MAX_DIALED_DIGITS + 1]; /* it's a null terminated string */
uint8_t release_cause;
struct timeval tv;
/* ref. Q.931 Table 4-11 and Q.951 Section 3 */
uint8_t calling_number_screening_ind;
uint8_t calling_number_presentation;
char calling_name[MAX_DIALED_DIGITS + 1];
uint16_t redirection_string_size;
char redirection_string [SIZE_RDNIS]; /* it's a null terminated string */
/* redir string format:
* http://www.ss7box.com/wiki/tiki-index.php?page=Call+Redirection
* */
} t_sigboost;
} t_sigboost_callstart;
#define MIN_SIZE_CALLSTART_MSG (sizeof(t_sigboost_callstart) - SIZE_RDNIS)
typedef struct
{
uint32_t event_id;
/* delete sequence numbers - SCTP does not need them */
uint32_t fseqno;
uint32_t bseqno;
uint16_t call_setup_id;
uint32_t trunk_group;
uint8_t span;
uint8_t chan;
struct timeval tv;
uint8_t release_cause;
} t_sigboost_short;
#pragma pack()
static inline int boost_full_event(int event_id)
{
switch (event_id) {
case SIGBOOST_EVENT_CALL_START:
case SIGBOOST_EVENT_DIGIT_IN:
return 1;
default:
return 0;
}
return 0;
}
#endif

View File

@@ -70,7 +70,8 @@
(dest)->flags |= ((src)->flags & (flagz)); \
} while (0)
typedef t_sigboost ss7bc_event_t;
typedef t_sigboost_callstart ss7bc_event_t;
typedef t_sigboost_short ss7bc_short_event_t;
typedef uint32_t ss7bc_event_id_t;
typedef struct ss7bc_ip_cfg
@@ -117,14 +118,19 @@ static inline void sctp_no_nagle(int socket)
int ss7bc_connection_close(ss7bc_connection_t *mcon);
int ss7bc_connection_open(ss7bc_connection_t *mcon, char *local_ip, int local_port, char *ip, int port);
ss7bc_event_t *ss7bc_connection_read(ss7bc_connection_t *mcon, int iteration);
ss7bc_event_t *ss7bc_connection_readp(ss7bc_connection_t *mcon, int iteration);
ss7bc_event_t *__ss7bc_connection_read(ss7bc_connection_t *mcon, int iteration, const char *file, const char *func, int line);
ss7bc_event_t *__ss7bc_connection_readp(ss7bc_connection_t *mcon, int iteration, const char *file, const char *func, int line);
int __ss7bc_connection_write(ss7bc_connection_t *mcon, ss7bc_event_t *event, const char *file, const char *func, int line);
int __ss7bc_connection_writep(ss7bc_connection_t *mcon, ss7bc_event_t *event, const char *file, const char *func, int line);
#define ss7bc_connection_write(_m,_e) __ss7bc_connection_write(_m, _e, __FILE__, __func__, __LINE__)
void ss7bc_event_init(ss7bc_event_t *event, ss7bc_event_id_t event_id, int chan, int span);
#define ss7bc_connection_writep(_m,_e) __ss7bc_connection_writep(_m, _e, __FILE__, __func__, __LINE__)
#define ss7bc_connection_read(_m,_e) __ss7bc_connection_read(_m, _e, __FILE__, __func__, __LINE__)
#define ss7bc_connection_readp(_m,_e) __ss7bc_connection_readp(_m, _e, __FILE__, __func__, __LINE__)
void ss7bc_event_init(ss7bc_short_event_t *event, ss7bc_event_id_t event_id, int chan, int span);
void ss7bc_call_init(ss7bc_event_t *event, const char *calling, const char *called, int setup_id);
const char *ss7bc_event_id_name(uint32_t event_id);
int ss7bc_exec_command(ss7bc_connection_t *mcon, int span, int chan, int id, int cmd, int cause);
int ss7bc_exec_commandp(ss7bc_connection_t *pcon, int span, int chan, int id, int cmd, int cause);
#endif

View File

@@ -37,7 +37,8 @@
#include "openzap.h"
typedef enum {
ZAP_SS7_BOOST_RUNNING = (1 << 0)
ZAP_SS7_BOOST_RUNNING = (1 << 0),
ZAP_SS7_BOOST_RESTARTING = (1 << 1)
} zap_ss7_boost_flag_t;
typedef struct zap_ss7_boost_data {