diff options
Diffstat (limited to 'openbsc/include/openbsc')
-rw-r--r-- | openbsc/include/openbsc/Makefile.am | 4 | ||||
-rw-r--r-- | openbsc/include/openbsc/abis_rsl.h | 2 | ||||
-rw-r--r-- | openbsc/include/openbsc/bsc_api.h | 6 | ||||
-rw-r--r-- | openbsc/include/openbsc/chan_alloc.h | 24 | ||||
-rw-r--r-- | openbsc/include/openbsc/db.h | 4 | ||||
-rw-r--r-- | openbsc/include/openbsc/debug.h | 89 | ||||
-rw-r--r-- | openbsc/include/openbsc/gsm_04_08.h | 1 | ||||
-rw-r--r-- | openbsc/include/openbsc/gsm_04_11.h | 2 | ||||
-rw-r--r-- | openbsc/include/openbsc/gsm_data.h | 42 | ||||
-rw-r--r-- | openbsc/include/openbsc/signal.h | 13 | ||||
-rw-r--r-- | openbsc/include/openbsc/telnet_interface.h | 4 | ||||
-rw-r--r-- | openbsc/include/openbsc/transaction.h | 8 |
12 files changed, 74 insertions, 125 deletions
diff --git a/openbsc/include/openbsc/Makefile.am b/openbsc/include/openbsc/Makefile.am index 731bc76c4..25e3f4dd9 100644 --- a/openbsc/include/openbsc/Makefile.am +++ b/openbsc/include/openbsc/Makefile.am @@ -6,7 +6,7 @@ noinst_HEADERS = abis_nm.h abis_rsl.h db.h gsm_04_08.h gsm_data.h \ bsc_rll.h mncc.h transaction.h ussd.h gsm_04_80.h \ silent_call.h mgcp.h meas_rep.h rest_octets.h \ system_information.h handover.h mgcp_internal.h \ - bssap.h bsc_msc.h bsc_nat.h vty.h + vty.h bssap.h bsc_msc.h bsc_nat.h -openbsc_HEADERS = gsm_04_08.h meas_rep.h +openbsc_HEADERS = gsm_04_08.h meas_rep.h bsc_api.h openbscdir = $(includedir)/openbsc diff --git a/openbsc/include/openbsc/abis_rsl.h b/openbsc/include/openbsc/abis_rsl.h index 532382ead..c8ac1dead 100644 --- a/openbsc/include/openbsc/abis_rsl.h +++ b/openbsc/include/openbsc/abis_rsl.h @@ -59,7 +59,7 @@ int rsl_ipacc_crcx(struct gsm_lchan *lchan); int rsl_ipacc_mdcx(struct gsm_lchan *lchan, u_int32_t ip, u_int16_t port, u_int8_t rtp_payload2); int rsl_ipacc_mdcx_to_rtpsock(struct gsm_lchan *lchan); -int rsl_ipacc_pdch_activate(struct gsm_lchan *lchan); +int rsl_ipacc_pdch_activate(struct gsm_lchan *lchan, int act); int abis_rsl_rcvmsg(struct msgb *msg); diff --git a/openbsc/include/openbsc/bsc_api.h b/openbsc/include/openbsc/bsc_api.h new file mode 100644 index 000000000..51e344f5a --- /dev/null +++ b/openbsc/include/openbsc/bsc_api.h @@ -0,0 +1,6 @@ +/* GSM 08.08 like API for OpenBSC */ + +#include "gsm_data.h" + + +int gsm0808_submit_dtap(struct gsm_subscriber_connection *conn, struct msgb *msg, int link_id); diff --git a/openbsc/include/openbsc/chan_alloc.h b/openbsc/include/openbsc/chan_alloc.h index c2e05d6a7..2cf447c7f 100644 --- a/openbsc/include/openbsc/chan_alloc.h +++ b/openbsc/include/openbsc/chan_alloc.h @@ -27,20 +27,20 @@ * Refcounting for the lchan. If the refcount drops to zero * the channel will send a RSL release request. */ -#define use_lchan(lchan) \ - do { lchan->use_count++; \ - DEBUGP(DCC, "lchan (bts=%d,trx=%d,ts=%d,ch=%d) increases usage to: %d\n", \ - lchan->ts->trx->bts->nr, lchan->ts->trx->nr, lchan->ts->nr, \ - lchan->nr, lchan->use_count); \ +#define use_subscr_con(con) \ + do { (con)->use_count++; \ + DEBUGP(DREF, "lchan (bts=%d,trx=%d,ts=%d,ch=%d) increases usage to: %d\n", \ + (con)->lchan->ts->trx->bts->nr, (con)->lchan->ts->trx->nr, (con)->lchan->ts->nr, \ + (con)->lchan->nr, (con)->use_count); \ } while(0); -#define put_lchan(lchan, reason) \ - do { lchan->use_count--; \ - DEBUGP(DCC, "lchan (bts=%d,trx=%d,ts=%d,ch=%d) decreases usage to: %d\n", \ - lchan->ts->trx->bts->nr, lchan->ts->trx->nr, lchan->ts->nr, \ - lchan->nr, lchan->use_count); \ - if (lchan->use_count <= 0) \ - _lchan_release(lchan, reason); \ +#define put_subscr_con(con, reason) \ + do { (con)->use_count--; \ + DEBUGP(DREF, "lchan (bts=%d,trx=%d,ts=%d,ch=%d) decreases usage to: %d\n", \ + (con)->lchan->ts->trx->bts->nr, (con)->lchan->ts->trx->nr, (con)->lchan->ts->nr, \ + (con)->lchan->nr, (con)->use_count); \ + if ((con)->use_count <= 0) \ + _lchan_release((con)->lchan, reason); \ } while(0); diff --git a/openbsc/include/openbsc/db.h b/openbsc/include/openbsc/db.h index df664dbc1..d0a1278ef 100644 --- a/openbsc/include/openbsc/db.h +++ b/openbsc/include/openbsc/db.h @@ -55,8 +55,8 @@ int set_authtuple_for_subscr(struct gsm_auth_tuple *atuple, /* SMS store-and-forward */ int db_sms_store(struct gsm_sms *sms); -struct gsm_sms *db_sms_get_unsent(struct gsm_network *net, int min_id); -struct gsm_sms *db_sms_get_unsent_by_subscr(struct gsm_network *net, int min_subscr_id); +struct gsm_sms *db_sms_get_unsent(struct gsm_network *net, unsigned long long min_id); +struct gsm_sms *db_sms_get_unsent_by_subscr(struct gsm_network *net, unsigned long long min_subscr_id); struct gsm_sms *db_sms_get_unsent_for_subscr(struct gsm_subscriber *subscr); int db_sms_mark_sent(struct gsm_sms *sms); diff --git a/openbsc/include/openbsc/debug.h b/openbsc/include/openbsc/debug.h index 31e404d6c..c96d58922 100644 --- a/openbsc/include/openbsc/debug.h +++ b/openbsc/include/openbsc/debug.h @@ -5,6 +5,7 @@ #include <osmocore/linuxlist.h> #define DEBUG +#include <osmocore/logging.h> /* Debug Areas of the code */ enum { @@ -32,31 +33,6 @@ enum { Debug_LastEntry, }; -#ifdef DEBUG -#define DEBUGP(ss, fmt, args...) debugp(ss, __FILE__, __LINE__, 0, fmt, ## args) -#define DEBUGPC(ss, fmt, args...) debugp(ss, __FILE__, __LINE__, 1, fmt, ## args) -#else -#define DEBUGP(xss, fmt, args...) -#define DEBUGPC(ss, fmt, args...) -#endif - - -#define static_assert(exp, name) typedef int dummy##name [(exp) ? 1 : -1]; - -char *hexdump(const unsigned char *buf, int len); -void debugp(unsigned int subsys, char *file, int line, int cont, const char *format, ...) __attribute__ ((format (printf, 5, 6))); - -/* new logging interface */ -#define LOGP(ss, level, fmt, args...) debugp2(ss, level, __FILE__, __LINE__, 0, fmt, ##args) -#define LOGPC(ss, level, fmt, args...) debugp2(ss, level, __FILE__, __LINE__, 1, fmt, ##args) - -/* different levels */ -#define LOGL_DEBUG 1 /* debugging information */ -#define LOGL_INFO 3 -#define LOGL_NOTICE 5 /* abnormal/unexpected condition */ -#define LOGL_ERROR 7 /* error condition, requires user action */ -#define LOGL_FATAL 8 /* fatal, program aborted */ - /* context */ #define BSC_CTX_LCHAN 0 #define BSC_CTX_SUBSCR 1 @@ -66,67 +42,12 @@ void debugp(unsigned int subsys, char *file, int line, int cont, const char *for /* target */ enum { - DEBUG_FILTER_IMSI = 1 << 0, - DEBUG_FILTER_ALL = 1 << 1, -}; - -struct debug_category { - int enabled; - int loglevel; + //DEBUG_FILTER_ALL = 1 << 0, + LOG_FILTER_IMSI = 1 << 1, }; -struct debug_target { - int filter_map; - char *imsi_filter; - - - struct debug_category categories[Debug_LastEntry]; - int use_color; - int print_timestamp; - int loglevel; - - union { - struct { - FILE *out; - } tgt_stdout; - - struct { - int priority; - } tgt_syslog; - - struct { - void *vty; - } tgt_vty; - }; - - void (*output) (struct debug_target *target, const char *string); - - struct llist_head entry; -}; - -/* use the above macros */ -void debugp2(unsigned int subsys, unsigned int level, char *file, int line, int cont, const char *format, ...) __attribute__ ((format (printf, 6, 7))); -void debug_init(void); - -/* context management */ -void debug_reset_context(void); -void debug_set_context(int ctx, void *value); - -/* filter on the targets */ -void debug_set_imsi_filter(struct debug_target *target, const char *imsi); -void debug_set_all_filter(struct debug_target *target, int); -void debug_set_use_color(struct debug_target *target, int); -void debug_set_print_timestamp(struct debug_target *target, int); -void debug_set_log_level(struct debug_target *target, int log_level); -void debug_parse_category_mask(struct debug_target *target, const char* mask); -int debug_parse_level(const char *lvl); -int debug_parse_category(const char *category); -void debug_set_category_filter(struct debug_target *target, int category, int enable, int level); +void log_set_imsi_filter(struct log_target *target, const char *imsi); +extern const struct log_info log_info; -/* management of the targets */ -struct debug_target *debug_target_create(void); -struct debug_target *debug_target_create_stderr(void); -void debug_add_target(struct debug_target *target); -void debug_del_target(struct debug_target *target); #endif /* _DEBUG_H */ diff --git a/openbsc/include/openbsc/gsm_04_08.h b/openbsc/include/openbsc/gsm_04_08.h index 602658331..eb445d11a 100644 --- a/openbsc/include/openbsc/gsm_04_08.h +++ b/openbsc/include/openbsc/gsm_04_08.h @@ -25,7 +25,6 @@ int gsm48_tx_mm_auth_req(struct gsm_lchan *lchan, u_int8_t *rand, int key_seq); int gsm48_tx_mm_auth_rej(struct gsm_lchan *lchan); struct msgb *gsm48_msgb_alloc(void); int gsm48_sendmsg(struct msgb *msg, struct gsm_trans *trans); -int gsm48_mi_to_string(char *string, const int str_len, const u_int8_t *mi, const int mi_len); int gsm48_send_rr_release(struct gsm_lchan *lchan); int gsm48_send_rr_ciph_mode(struct gsm_lchan *lchan, int want_imeisv); diff --git a/openbsc/include/openbsc/gsm_04_11.h b/openbsc/include/openbsc/gsm_04_11.h index 9badd3659..8127af1ea 100644 --- a/openbsc/include/openbsc/gsm_04_11.h +++ b/openbsc/include/openbsc/gsm_04_11.h @@ -25,7 +25,7 @@ struct msgb; int gsm0411_rcv_sms(struct msgb *msg, u_int8_t link_id); -int gsm411_send_sms_lchan(struct gsm_lchan *lchan, struct gsm_sms *sms); +int gsm411_send_sms_lchan(struct gsm_subscriber_connection *conn, struct gsm_sms *sms); struct gsm_sms *sms_alloc(void); void sms_free(struct gsm_sms *sms); diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index 6005dee6a..303663f41 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -201,6 +201,27 @@ enum gsm_lchan_state { LCHAN_S_INACTIVE, /* channel is set inactive */ }; +/* the per subscriber data for lchan */ +struct gsm_subscriber_connection { + /* To whom we are allocated at the moment */ + struct gsm_subscriber *subscr; + + /* + * Operations that have a state and might be pending + */ + struct gsm_loc_updating_operation *loc_operation; + + /* use count. how many users use this channel */ + unsigned int use_count; + + /* Are we part of a special "silent" call */ + int silent_call; + + /* back pointers */ + struct gsm_lchan *lchan; + struct gsm_bts *bts; +}; + struct gsm_lchan { /* The TS that we're part of */ struct gsm_bts_trx_ts *ts; @@ -223,34 +244,21 @@ struct gsm_lchan { u_int8_t key_len; u_int8_t key[MAX_A5_KEY_LEN]; } encr; - /* Are we part of a special "silent" call */ - int silent_call; + + struct timer_list T3101; /* AMR bits */ struct gsm48_multi_rate_conf mr_conf; - /* To whom we are allocated at the moment */ - struct gsm_subscriber *subscr; - - struct timer_list T3101; - /* Established data link layer services */ u_int8_t sapis[8]; /* - * Operations that have a state and might be pending - */ - struct gsm_loc_updating_operation *loc_operation; - - /* * MSC handling... */ struct bss_sccp_connection_data *msc_data; - /* use count. how many users use this channel */ - unsigned int use_count; - /* cache of last measurement reports on this lchan */ struct gsm_meas_rep meas_rep[6]; int meas_rep_idx; @@ -268,6 +276,8 @@ struct gsm_lchan { u_int8_t speech_mode; struct rtp_socket *rtp_socket; } abis_ip; + + struct gsm_subscriber_connection conn; }; struct gsm_e1_subslot { @@ -279,7 +289,7 @@ struct gsm_e1_subslot { u_int8_t e1_ts_ss; }; -#define BTS_TRX_F_ACTIVATED 0x0001 +#define TS_F_PDCH_MODE 0x1000 /* One Timeslot in a TRX */ struct gsm_bts_trx_ts { struct gsm_bts_trx *trx; diff --git a/openbsc/include/openbsc/signal.h b/openbsc/include/openbsc/signal.h index 0c22869f6..1b974e288 100644 --- a/openbsc/include/openbsc/signal.h +++ b/openbsc/include/openbsc/signal.h @@ -42,6 +42,7 @@ enum signal_subsystems { SS_SUBSCR, SS_SCALL, SS_GLOBAL, + SS_CHALLOC, }; /* SS_PAGING signals */ @@ -93,6 +94,12 @@ enum signal_lchan { S_LCHAN_MEAS_REP, /* 08.58 Measurement Report */ }; +/* SS_CHALLOC signals */ +enum signal_challoc { + S_CHALLOC_ALLOC_FAIL, /* allocation of lchan has failed */ + S_CHALLOC_FREED, /* lchan has been successfully freed */ +}; + /* SS_SUBSCR signals */ enum signal_subscr { S_SUBSCR_ATTACHED, @@ -130,4 +137,10 @@ struct ipacc_ack_signal_data { u_int8_t msg_type; }; +struct challoc_signal_data { + struct gsm_bts *bts; + struct gsm_lchan *lchan; + enum gsm_chan_t type; +}; + #endif diff --git a/openbsc/include/openbsc/telnet_interface.h b/openbsc/include/openbsc/telnet_interface.h index 20e794b49..b8c36b6a1 100644 --- a/openbsc/include/openbsc/telnet_interface.h +++ b/openbsc/include/openbsc/telnet_interface.h @@ -22,7 +22,7 @@ #define TELNET_INTERFACE_H #include "gsm_data.h" -#include "debug.h" +#include <openbsc/debug.h> #include <osmocore/select.h> #include <vty/vty.h> @@ -32,7 +32,7 @@ struct telnet_connection { struct gsm_network *network; struct bsc_fd fd; struct vty *vty; - struct debug_target *dbg; + struct log_target *dbg; }; diff --git a/openbsc/include/openbsc/transaction.h b/openbsc/include/openbsc/transaction.h index 50c3cc5da..90a008bdc 100644 --- a/openbsc/include/openbsc/transaction.h +++ b/openbsc/include/openbsc/transaction.h @@ -20,8 +20,8 @@ struct gsm_trans { /* To whom we belong, unique identifier of remote MM entity */ struct gsm_subscriber *subscr; - /* The LCHAN that we're currently using to transmit messages */ - struct gsm_lchan *lchan; + /* The associated connection we are using to transmit messages */ + struct gsm_subscriber_connection *conn; /* reference from MNCC or other application */ u_int32_t callref; @@ -71,6 +71,6 @@ int trans_assign_trans_id(struct gsm_subscriber *subscr, /* update all transactions to use a different LCHAN, e.g. * after handover has succeeded */ -int trans_lchan_change(struct gsm_lchan *lchan_old, - struct gsm_lchan *lchan_new); +int trans_lchan_change(struct gsm_subscriber_connection *conn_old, + struct gsm_subscriber_connection *conn_new); #endif |