sctplib changes

git-svn-id: http://svn.openzap.org/svn/openzap/trunk@448 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
Shane Burrell 2008-04-07 05:03:10 +00:00
parent 6abea14ca6
commit ffb15e0cbb
3 changed files with 54 additions and 11 deletions

View File

@ -164,7 +164,8 @@ typedef enum {
ZAP_SIGTYPE_ISDN,
ZAP_SIGTYPE_RBS,
ZAP_SIGTYPE_ANALOG,
ZAP_SIGTYPE_SS7BOOST
ZAP_SIGTYPE_SS7BOOST,
ZAP_SIGTYPE_M3UA
} zap_signal_type_t;
typedef enum {

View File

@ -46,16 +46,58 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/sctp.h>
#include <sctp.h>
//#include <netinet/sctp.h>
#include <arpa/inet.h>
#include <stdarg.h>
#include <netdb.h>
#include <sigboost.h>
//#include <sigboost.h>
#include <sys/time.h>
#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.
* 0..((CORE_MAX_SPANS * CORE_MAX_CHAN_PER_SPAN) - 1) */
#define CORE_MAX_SPANS 200
#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
typedef struct
{
uint32_t event_id;
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 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 redirection_string [SIZE_RDNIS]; /* it's a null terminated string */
} t_m3ua;
typedef t_m3ua m3uac_event_t;
typedef uint32_t m3uac_event_id_t;
typedef struct m3uac_ip_cfg
{
char local_ip[25];
@ -85,27 +127,27 @@ struct m3uac_connection {
typedef enum {
MSU_FLAG_EVENT = (1 << 0)
} ss7bc_flag_t;
} m3uac_flag_t;
typedef struct m3uac_connection m3uac_connection_t;
static inline void sctp_no_nagle(int socket)
{
int flag = 1;
setsockopt(socket, IPPROTO_SCTP, SCTP_NODELAY, (char *) &flag, sizeof(int));
//int flag = 1;
//setsockopt(socket, IPPROTO_SCTP, SCTP_NODELAY, (char *) &flag, sizeof(int));
}
int m3uac_connection_close(m3uac_connection_t *mcon);
int m3uac_connection_open(m3uac_connection_t *mcon, char *local_ip, int local_port, char *ip, int port);
m3uac_event_t *ss7bc_connection_read(m3uac_connection_t *mcon, int iteration);
m3uac_event_t *ss7bc_connection_readp(m3uac_connection_t *mcon, int iteration);
int m3uac_connection_write(m3uac_connection_t *mcon, ss7bc_event_t *event);
m3uac_event_t *m3uac_connection_read(m3uac_connection_t *mcon, int iteration);
m3uac_event_t *m3uac_connection_readp(m3uac_connection_t *mcon, int iteration);
int m3uac_connection_write(m3uac_connection_t *mcon, m3uac_event_t *event);
void m3uac_event_init(m3uac_event_t *event, m3uac_event_id_t event_id, int chan, int span);
void m3uac_call_init(m3uac_event_t *event, const char *calling, const char *called, int setup_id);
const char *m3uac_event_id_name(uint32_t event_id);
int m3uac_exec_command(m3uac_connection_t *mcon, int span, int chan, int id, int cmd, int cause);
#endif
/* For Emacs:

View File

@ -38,7 +38,7 @@
#include "openzap.h"
//#include "m3ua_client.h"
#include "m3ua_client.h"
#include "zap_m3ua.h"
struct general_config {