src: port openBSC over libosmo-abis

This is a big patch that ports openBSC over libosmo-abis.
Sorry, the changes that are included here are all dependent
of libosmo-abis, splitting them into smaller pieces would
leave the repository in some intermediate state, which is
not desired.

The main changes are:

- The directory libabis/ has been removed as it now lives in
  libosmo-abis.

- new configuration file format for nanoBTS and HSL femto, we
  need to define the virtual e1_line and attach it to the OML
  link.

- all the existing BTS drivers (nanoBTS, hsl femto, Nokia site,
  BS11 and rbs2000) now use the new libosmo-abis framework.

- use r232 input driver available in libosmo-abis for bs11_config.

- use ipa_msg_recv instead of old ipaccess_read_msg function.

- delete definition of gsm_e1_subslot and input_signal_data.
  These structures now lives in libosmo-abis.

Most of this patch are deletions of libabis/ which has been
moved to libosmo-abis.

This patch also modifies openBSC to use all the new definitions
available in libosmocore and libosmo-abis. In order to do that,
we have replaced the following:

- DINP, DMI, DMIB and DMUX by their respective DL* correspondences.
- SS_GLOBAL by SS_L_GLOBAL
- SS_INPUT by SS_L_INPUT
- S_GLOBAL_SHUTDOWN by S_L_GLOBAL_SHUTDOWN
- SS_INPUT by SS_L_INPUT
- S_INP_* by S_L_INP_* sub-signals
- E1INP_NODE by L_E1INP_NODE vty node

This patch has been tested with:
- one nanoBTS
- the HSL femto with the examples available under libosmo-abis
- BS11 with both dahdi and misdn drivers.
neels/jolly/new_handover 0.9.15-0-ged5cacb24
Pablo Neira Ayuso 12 years ago committed by Harald Welte
parent 7abecfcfc9
commit ed5cacb240
  1. 2
      openbsc/configure.ac
  2. 4
      openbsc/doc/examples/osmo-bsc/osmo-bsc.cfg
  3. 3
      openbsc/doc/examples/osmo-nitb/hsl/openbsc.cfg
  4. 4
      openbsc/doc/examples/osmo-nitb/nanobts/openbsc-multitrx.cfg
  5. 4
      openbsc/doc/examples/osmo-nitb/nanobts/openbsc.cfg
  6. 3
      openbsc/include/openbsc/Makefile.am
  7. 3
      openbsc/include/openbsc/abis_nm.h
  8. 4
      openbsc/include/openbsc/debug.h
  9. 200
      openbsc/include/openbsc/e1_input.h
  10. 4
      openbsc/include/openbsc/gsm_data.h
  11. 12
      openbsc/include/openbsc/gsm_data_shared.h
  12. 5
      openbsc/include/openbsc/ipaccess.h
  13. 2
      openbsc/include/openbsc/misdn.h
  14. 22
      openbsc/include/openbsc/signal.h
  15. 101
      openbsc/include/openbsc/subchan_demux.h
  16. 64
      openbsc/include/openbsc/trau_frame.h
  17. 3
      openbsc/include/openbsc/trau_mux.h
  18. 1
      openbsc/include/openbsc/vty.h
  19. 2
      openbsc/src/Makefile.am
  20. 2
      openbsc/src/gprs/gb_proxy_main.c
  21. 2
      openbsc/src/gprs/sgsn_main.c
  22. 7
      openbsc/src/ipaccess/Makefile.am
  23. 90
      openbsc/src/ipaccess/ipaccess-config.c
  24. 120
      openbsc/src/ipaccess/ipaccess-proxy.c
  25. 2
      openbsc/src/ipaccess/network_listen.c
  26. 14
      openbsc/src/libabis/Makefile.am
  27. 689
      openbsc/src/libabis/e1_input.c
  28. 264
      openbsc/src/libabis/e1_input_vty.c
  29. 527
      openbsc/src/libabis/input/dahdi.c
  30. 458
      openbsc/src/libabis/input/hsl.c
  31. 842
      openbsc/src/libabis/input/ipaccess.c
  32. 730
      openbsc/src/libabis/input/lapd.c
  33. 58
      openbsc/src/libabis/input/lapd.h
  34. 541
      openbsc/src/libabis/input/misdn.c
  35. 24
      openbsc/src/libbsc/abis_nm.c
  36. 2
      openbsc/src/libbsc/abis_om2000.c
  37. 2
      openbsc/src/libbsc/abis_rsl.c
  38. 21
      openbsc/src/libbsc/bsc_init.c
  39. 4
      openbsc/src/libbsc/bsc_msc.c
  40. 33
      openbsc/src/libbsc/bsc_vty.c
  41. 26
      openbsc/src/libbsc/bts_ericsson_rbs2000.c
  42. 155
      openbsc/src/libbsc/bts_hsl_femtocell.c
  43. 194
      openbsc/src/libbsc/bts_ipaccess_nanobts.c
  44. 52
      openbsc/src/libbsc/bts_nokia_site.c
  45. 18
      openbsc/src/libbsc/bts_siemens_bs11.c
  46. 125
      openbsc/src/libbsc/e1_config.c
  47. 20
      openbsc/src/libcommon/debug.c
  48. 4
      openbsc/src/libcommon/socket.c
  49. 4
      openbsc/src/libctrl/Makefile.am
  50. 32
      openbsc/src/libctrl/control_cmd.c
  51. 39
      openbsc/src/libctrl/control_if.c
  52. 4
      openbsc/src/libmsc/gsm_04_08.c
  53. 2
      openbsc/src/libmsc/vty_interface_layer3.c
  54. 6
      openbsc/src/libtrau/Makefile.am
  55. 46
      openbsc/src/libtrau/rtp_proxy.c
  56. 321
      openbsc/src/libtrau/subchan_demux.c
  57. 286
      openbsc/src/libtrau/trau_frame.c
  58. 26
      openbsc/src/libtrau/trau_mux.c
  59. 6
      openbsc/src/osmo-bsc/Makefile.am
  60. 4
      openbsc/src/osmo-bsc/osmo_bsc_main.c
  61. 17
      openbsc/src/osmo-bsc/osmo_bsc_msc.c
  62. 28
      openbsc/src/osmo-bsc/osmo_bsc_rf.c
  63. 5
      openbsc/src/osmo-bsc_nat/Makefile.am
  64. 2
      openbsc/src/osmo-bsc_nat/bsc_filter.c
  65. 33
      openbsc/src/osmo-bsc_nat/bsc_nat.c
  66. 6
      openbsc/src/osmo-bsc_nat/bsc_nat_utils.c
  67. 9
      openbsc/src/osmo-bsc_nat/bsc_ussd.c
  68. 10
      openbsc/src/osmo-nitb/Makefile.am
  69. 8
      openbsc/src/osmo-nitb/bsc_hack.c
  70. 10
      openbsc/src/utils/Makefile.am
  71. 58
      openbsc/src/utils/bs11_config.c
  72. 248
      openbsc/src/utils/rs232.c
  73. 7
      openbsc/tests/bsc-nat/Makefile.am
  74. 6
      openbsc/tests/db/Makefile.am

@ -46,6 +46,7 @@ AM_CONDITIONAL(BUILD_BSC, test "x$osmo_ac_build_bsc" = "xyes")
PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.3.2)
PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.3.0)
PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.3.0)
PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.0.2)
dnl checks for header files
AC_HEADER_STDC
@ -90,7 +91,6 @@ AC_OUTPUT(
include/Makefile
src/Makefile
src/libtrau/Makefile
src/libabis/Makefile
src/libbsc/Makefile
src/libctrl/Makefile
src/libmsc/Makefile

@ -39,6 +39,8 @@ log stderr
line vty
no login
!
e1_input
e1_line 0 driver ipa
network
network country code 1
mobile network code 1
@ -86,7 +88,7 @@ network
rach tx integer 9
rach max transmission 7
ip.access unit_id 0 0
oml ip.access stream_id 255
oml ip.access stream_id 255 line 0
neighbor-list mode manual-si5
neighbor-list add arfcn 100
neighbor-list add arfcn 200

@ -6,6 +6,8 @@ password foo
line vty
no login
!
e1_input
e1_line 0 driver hsl
network
network country code 262
mobile network code 42
@ -54,6 +56,7 @@ network
rach max transmission 1
hsl serial-number 8303701
neighbor-list mode automatic
oml hsl line 0
gprs mode none
trx 0
rf_locked 0

@ -6,6 +6,8 @@ password foo
line vty
no login
!
e1_input
e1_line 0 driver ipa
network
network country code 1
mobile network code 1
@ -49,7 +51,7 @@ network
rach tx integer 9
rach max transmission 7
ip.access unit_id 1800 0
oml ip.access stream_id 255
oml ip.access stream_id 255 line 0
gprs mode none
trx 0
rf_locked 0

@ -6,6 +6,8 @@ password foo
line vty
no login
!
e1_input
e1_line 0 driver ipa
network
network country code 1
mobile network code 1
@ -49,7 +51,7 @@ network
rach tx integer 9
rach max transmission 7
ip.access unit_id 1801 0
oml ip.access stream_id 255
oml ip.access stream_id 255 line 0
gprs mode none
trx 0
rf_locked 0

@ -1,8 +1,7 @@
noinst_HEADERS = abis_nm.h abis_rsl.h db.h gsm_04_08.h gsm_data.h \
gsm_subscriber.h gsm_04_11.h debug.h signal.h \
misdn.h chan_alloc.h paging.h \
subchan_demux.h trau_frame.h e1_input.h trau_mux.h \
ipaccess.h rs232.h openbscdefines.h rtp_proxy.h \
trau_mux.h rs232.h openbscdefines.h rtp_proxy.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 \

@ -160,5 +160,8 @@ int abis_nm_vty_init(void);
void abis_nm_clear_queue(struct gsm_bts *bts);
int _abis_nm_sendmsg(struct msgb *msg, int to_trx_oml);
void abis_nm_queue_send_next(struct gsm_bts *bts); /* for bs11_config. */
#endif /* _NM_H */

@ -19,10 +19,6 @@ enum {
DSMS,
DPAG,
DMEAS,
DMI,
DMIB,
DMUX,
DINP,
DSCCP,
DMSC,
DMGCP,

@ -1,200 +0,0 @@
#ifndef _E1_INPUT_H
#define _E1_INPUT_H
#include <stdlib.h>
#include <netinet/in.h>
#include <osmocom/core/linuxlist.h>
#include <openbsc/gsm_data.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/select.h>
#include <osmocom/core/rate_ctr.h>
#include <openbsc/subchan_demux.h>
#define NUM_E1_TS 32
enum e1inp_sign_type {
E1INP_SIGN_NONE,
E1INP_SIGN_OML,
E1INP_SIGN_RSL,
};
const char *e1inp_signtype_name(enum e1inp_sign_type tp);
enum e1inp_ctr {
E1I_CTR_HDLC_ABORT,
E1I_CTR_HDLC_BADFCS,
E1I_CTR_HDLC_OVERR,
E1I_CTR_ALARM,
E1I_CTR_REMOVED,
};
struct e1inp_ts;
struct e1inp_sign_link {
/* list of signalling links */
struct llist_head list;
/* to which timeslot do we belong? */
struct e1inp_ts *ts;
enum e1inp_sign_type type;
/* trx for msg->trx of received msgs */
struct gsm_bts_trx *trx;
/* msgb queue of to-be-transmitted msgs */
struct llist_head tx_list;
/* SAPI and TEI on the E1 TS */
uint8_t sapi;
uint8_t tei;
union {
struct {
uint8_t channel;
} misdn;
} driver;
};
enum e1inp_ts_type {
E1INP_TS_TYPE_NONE,
E1INP_TS_TYPE_SIGN,
E1INP_TS_TYPE_TRAU,
};
const char *e1inp_tstype_name(enum e1inp_ts_type tp);
/* A timeslot in the E1 interface */
struct e1inp_ts {
enum e1inp_ts_type type;
int num;
/* to which line do we belong ? */
struct e1inp_line *line;
union {
struct {
/* list of all signalling links on this TS */
struct llist_head sign_links;
/* delay for the queue */
int delay;
/* timer when to dequeue next frame */
struct osmo_timer_list tx_timer;
} sign;
struct {
/* subchannel demuxer for frames from E1 */
struct subch_demux demux;
/* subchannel muxer for frames to E1 */
struct subch_mux mux;
} trau;
};
union {
struct {
/* mISDN driver has one fd for each ts */
struct osmo_fd fd;
} misdn;
struct {
/* ip.access driver has one fd for each ts */
struct osmo_fd fd;
} ipaccess;
struct {
/* DAHDI driver has one fd for each ts */
struct osmo_fd fd;
struct lapd_instance *lapd;
} dahdi;
} driver;
};
struct e1inp_driver {
struct llist_head list;
const char *name;
int (*want_write)(struct e1inp_ts *ts);
int (*line_update)(struct e1inp_line *line);
int default_delay;
};
struct e1inp_line {
struct llist_head list;
unsigned int num;
const char *name;
struct rate_ctr_group *rate_ctr;
/* array of timestlots */
struct e1inp_ts ts[NUM_E1_TS];
struct e1inp_driver *driver;
void *driver_data;
};
/* register a driver with the E1 core */
int e1inp_driver_register(struct e1inp_driver *drv);
/* fine a previously registered driver */
struct e1inp_driver *e1inp_driver_find(const char *name);
/* register a line with the E1 core */
int e1inp_line_register(struct e1inp_line *line);
/* get a line by its ID */
struct e1inp_line *e1inp_line_get(uint8_t e1_nr);
/* create a line in the E1 input core */
struct e1inp_line *e1inp_line_create(uint8_t e1_nr, const char *driver_name);
/* find a sign_link for given TEI and SAPI in a TS */
struct e1inp_sign_link *
e1inp_lookup_sign_link(struct e1inp_ts *ts, uint8_t tei,
uint8_t sapi);
/* create a new signalling link in a E1 timeslot */
struct e1inp_sign_link *
e1inp_sign_link_create(struct e1inp_ts *ts, enum e1inp_sign_type type,
struct gsm_bts_trx *trx, uint8_t tei,
uint8_t sapi);
/* configure and initialize one e1inp_ts */
int e1inp_ts_config(struct e1inp_ts *ts, struct e1inp_line *line,
enum e1inp_ts_type type);
/* Call from the Stack: configuration of this TS has changed */
int e1inp_update_ts(struct e1inp_ts *ts);
/* Receive a packet from the E1 driver */
int e1inp_rx_ts(struct e1inp_ts *ts, struct msgb *msg,
uint8_t tei, uint8_t sapi);
/* called by driver if it wants to transmit on a given TS */
struct msgb *e1inp_tx_ts(struct e1inp_ts *e1i_ts,
struct e1inp_sign_link **sign_link);
/* called by driver in case some kind of link state event */
int e1inp_event(struct e1inp_ts *ts, int evt, uint8_t tei, uint8_t sapi);
/* Write LAPD frames to the fd. */
void e1_set_pcap_fd(int fd);
/* called by TRAU muxer to obtain the destination mux entity */
struct subch_mux *e1inp_get_mux(uint8_t e1_nr, uint8_t ts_nr);
void e1inp_sign_link_destroy(struct e1inp_sign_link *link);
int e1inp_line_update(struct e1inp_line *line);
/* e1_config.c */
int e1_reconfig_ts(struct gsm_bts_trx_ts *ts);
int e1_reconfig_trx(struct gsm_bts_trx *trx);
int e1_reconfig_bts(struct gsm_bts *bts);
int ia_config_connect(struct gsm_bts *bts, struct sockaddr_in *sin);
int ipaccess_setup(struct gsm_network *gsmnet);
int hsl_setup(struct gsm_network *gsmnet);
extern struct llist_head e1inp_driver_list;
extern struct llist_head e1inp_line_list;
int e1inp_vty_init(void);
void e1inp_init(void);
int _abis_nm_sendmsg(struct msgb *msg, int to_trx_oml);
int abis_sendmsg(struct msgb *msg);
#endif /* _E1_INPUT_H */

@ -7,6 +7,7 @@
#include <osmocom/core/select.h>
#include <openbsc/rest_octets.h>
#include <osmocom/abis/e1_input.h>
#define OBSC_NM_W_ACK_CB(__msgb) (__msgb)->cb[3]
@ -382,4 +383,7 @@ void gsm_trx_lock_rf(struct gsm_bts_trx *trx, int locked);
int gsm_bts_has_feature(struct gsm_bts *bts, enum gsm_bts_features feat);
struct gsm_bts_trx *gsm_bts_trx_by_nr(struct gsm_bts *bts, int nr);
/* generic E1 line operations for all ISDN-based BTS. */
extern struct e1inp_line_ops bts_isdn_e1inp_line_ops;
#endif /* _GSM_DATA_H */

@ -225,16 +225,6 @@ struct gsm_lchan {
#endif
};
struct gsm_e1_subslot {
/* Number of E1 link */
uint8_t e1_nr;
/* Number of E1 TS inside E1 link */
uint8_t e1_ts;
/* Sub-slot within the E1 TS, 0xff if full TS */
uint8_t e1_ts_ss;
};
#define TS_F_PDCH_MODE 0x1000
/* One Timeslot in a TRX */
struct gsm_bts_trx_ts {
@ -341,6 +331,8 @@ struct gsm_bts_model {
int (*start)(struct gsm_network *net);
int (*oml_rcvmsg)(struct msgb *msg);
void (*e1line_bind_ops)(struct e1inp_line *line);
void (*config_write_bts)(struct vty *vty, struct gsm_bts *bts);
void (*config_write_trx)(struct vty *vty, struct gsm_bts_trx *trx);
void (*config_write_ts)(struct vty *vty, struct gsm_bts_trx_ts *ts);

@ -1,7 +1,7 @@
#ifndef _IPACCESS_H
#define _IPACCESS_H
#include "e1_input.h"
#include <osmocom/abis/e1_input.h>
#include "gsm_subscriber.h"
#include <osmocom/core/linuxlist.h>
#include <osmocom/gsm/protocol/ipaccess.h>
@ -26,13 +26,10 @@ struct ipac_ext_lac_cmd {
uint8_t data[0];
} __attribute__((packed));
int ipaccess_connect(struct e1inp_line *line, struct sockaddr_in *sa);
/*
* methods for parsing and sending a message
*/
int ipaccess_rcvmsg_base(struct msgb *msg, struct osmo_fd *bfd);
struct msgb *ipaccess_read_msg(struct osmo_fd *bfd, int *error);
void ipaccess_prepend_header(struct msgb *msg, int proto);
void ipaccess_prepend_header_ext(struct msgb *msg, int proto);
int ipaccess_send_pong(int fd);

@ -19,7 +19,7 @@
#ifndef MISDN_H
#define MISDN_H
#include "e1_input.h"
#include <osmocom/abis/e1_input.h>
int mi_setup(int cardnr, struct e1inp_line *line, int release_l2);
int mi_e1_line_update(struct e1inp_line *line);

@ -40,14 +40,12 @@ enum signal_subsystems {
SS_LCHAN,
SS_SUBSCR,
SS_SCALL,
SS_GLOBAL,
SS_CHALLOC,
SS_NS,
SS_IPAC_NWL,
SS_RF,
SS_MSC,
SS_HO,
SS_INPUT,
};
/* SS_PAGING signals */
@ -129,7 +127,6 @@ enum signal_ipaccess {
};
enum signal_global {
S_GLOBAL_SHUTDOWN,
S_GLOBAL_BTS_CLOSE_OM,
};
@ -140,17 +137,6 @@ enum signal_rf {
S_RF_GRACE,
};
/* SS_INPUT signals */
enum signal_input {
S_INP_NONE,
S_INP_TEI_UP,
S_INP_TEI_DN,
S_INP_TEI_UNKNOWN,
S_INP_LINE_INIT,
S_INP_LINE_ALARM,
S_INP_LINE_NOALARM,
};
struct gsm_subscriber;
struct paging_signal_data {
@ -261,12 +247,4 @@ struct ho_signal_data {
struct gsm_lchan *new_lchan;
};
struct input_signal_data {
int link_type;
uint8_t tei;
uint8_t sapi;
struct gsm_bts_trx *trx;
struct e1inp_line *line;
};
#endif

@ -1,101 +0,0 @@
#ifndef _SUBCH_DEMUX_H
#define _SUBCH_DEMUX_H
/* A E1 sub-channel (de)multiplexer with TRAU frame sync */
/* (C) 2009 by Harald Welte <laforge@gnumonks.org>
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include <stdint.h>
#include <osmocom/core/linuxlist.h>
#define NR_SUBCH 4
#define TRAU_FRAME_SIZE 40
#define TRAU_FRAME_BITS (TRAU_FRAME_SIZE*8)
/***********************************************************************/
/* DEMULTIPLEXER */
/***********************************************************************/
struct demux_subch {
uint8_t out_bitbuf[TRAU_FRAME_BITS];
uint16_t out_idx; /* next bit to be written in out_bitbuf */
/* number of consecutive zeros that we have received (for sync) */
unsigned int consecutive_zeros;
/* are we in TRAU frame sync or not? */
unsigned int in_sync;
};
struct subch_demux {
/* bitmask of currently active subchannels */
uint8_t chan_activ;
/* one demux_subch struct for every subchannel */
struct demux_subch subch[NR_SUBCH];
/* callback to be called once we have received a complete
* frame on a given subchannel */
int (*out_cb)(struct subch_demux *dmx, int ch, uint8_t *data, int len,
void *);
/* user-provided data, transparently passed to out_cb() */
void *data;
};
/* initialize one demultiplexer instance */
int subch_demux_init(struct subch_demux *dmx);
/* feed 'len' number of muxed bytes into the demultiplexer */
int subch_demux_in(struct subch_demux *dmx, uint8_t *data, int len);
/* activate decoding/processing for one subchannel */
int subch_demux_activate(struct subch_demux *dmx, int subch);
/* deactivate decoding/processing for one subchannel */
int subch_demux_deactivate(struct subch_demux *dmx, int subch);
/***********************************************************************/
/* MULTIPLEXER */
/***********************************************************************/
/* one element in the tx_queue of a muxer sub-channel */
struct subch_txq_entry {
struct llist_head list;
unsigned int bit_len; /* total number of bits in 'bits' */
unsigned int next_bit; /* next bit to be transmitted */
uint8_t bits[0]; /* one bit per byte */
};
struct mux_subch {
struct llist_head tx_queue;
};
/* structure representing one instance of the subchannel muxer */
struct subch_mux {
struct mux_subch subch[NR_SUBCH];
};
/* initialize a subchannel muxer instance */
int subchan_mux_init(struct subch_mux *mx);
/* request the output of 'len' multiplexed bytes */
int subchan_mux_out(struct subch_mux *mx, uint8_t *data, int len);
/* enqueue some data into one sub-channel of the muxer */
int subchan_mux_enqueue(struct subch_mux *mx, int s_nr, const uint8_t *data,
int len);
#endif /* _SUBCH_DEMUX_H */

@ -1,64 +0,0 @@
#ifndef _TRAU_FRAME_H
#define _TRAU_FRAME_H
/* TRAU frame handling according to GSM TS 08.60 */
/* (C) 2009 by Harald Welte <laforge@gnumonks.org>
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include <stdint.h>
/* 21 for FR/EFR, 25 for AMR, 15 for OM, 15 for data, 13 for E-data, 21 idle */
#define MAX_C_BITS 25
/* 260 for FR/EFR, 256 for AMR, 264 for OM, 288 for E-data */
#define MAX_D_BITS 288
/* for all speech frames */
#define MAX_T_BITS 4
/* for OM */
#define MAX_S_BITS 6
/* for E-data */
#define MAX_M_BITS 2
struct decoded_trau_frame {
uint8_t c_bits[MAX_C_BITS];
uint8_t d_bits[MAX_D_BITS];
uint8_t t_bits[MAX_T_BITS];
uint8_t s_bits[MAX_S_BITS];
uint8_t m_bits[MAX_M_BITS];
};
#define TRAU_FT_FR_UP 0x02 /* 0 0 0 1 0 - 3.5.1.1.1 */
#define TRAU_FT_FR_DOWN 0x1c /* 1 1 1 0 0 - 3.5.1.1.1 */
#define TRAU_FT_EFR 0x1a /* 1 1 0 1 0 - 3.5.1.1.1 */
#define TRAU_FT_AMR 0x06 /* 0 0 1 1 0 - 3.5.1.2 */
#define TRAU_FT_OM_UP 0x07 /* 0 0 1 0 1 - 3.5.2 */
#define TRAU_FT_OM_DOWN 0x1b /* 1 1 0 1 1 - 3.5.2 */
#define TRAU_FT_DATA_UP 0x08 /* 0 1 0 0 0 - 3.5.3 */
#define TRAU_FT_DATA_DOWN 0x16 /* 1 0 1 1 0 - 3.5.3 */
#define TRAU_FT_D145_SYNC 0x14 /* 1 0 1 0 0 - 3.5.3 */
#define TRAU_FT_EDATA 0x1f /* 1 1 1 1 1 - 3.5.4 */
#define TRAU_FT_IDLE_UP 0x10 /* 1 0 0 0 0 - 3.5.5 */
#define TRAU_FT_IDLE_DOWN 0x0e /* 0 1 1 1 0 - 3.5.5 */
int decode_trau_frame(struct decoded_trau_frame *fr, const uint8_t *trau_bits);
int encode_trau_frame(uint8_t *trau_bits, const struct decoded_trau_frame *fr);
int trau_frame_up2down(struct decoded_trau_frame *fr);
uint8_t *trau_idle_frame(void);
#endif /* _TRAU_FRAME_H */

@ -50,3 +50,6 @@ int trau_recv_lchan(struct gsm_lchan *lchan, uint32_t callref);
/* send trau from application */
int trau_send_frame(struct gsm_lchan *lchan, struct gsm_data_frame *frame);
/* callback invoked if we receive TRAU frames */
int subch_cb(struct subch_demux *dmx, int ch, uint8_t *data, int len, void *_priv);

@ -29,7 +29,6 @@ enum bsc_vty_node {
NS_NODE,
BSSGP_NODE,
OML_NODE,
E1INP_NODE,
NAT_NODE,
NAT_BSC_NODE,
MSC_NODE,

@ -2,7 +2,7 @@ INCLUDES = $(all_includes) -I$(top_srcdir)/include -I$(top_builddir)
AM_CFLAGS=-Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOVTY_CFLAGS) $(COVERAGE_CFLAGS)
AM_LDFLAGS = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(COVERAGE_LDFLAGS)
SUBDIRS = libcommon libabis libmgcp libbsc libmsc libtrau libctrl osmo-nitb osmo-bsc_mgcp utils ipaccess libgb gprs
SUBDIRS = libcommon libmgcp libbsc libmsc libtrau libctrl osmo-nitb osmo-bsc_mgcp utils ipaccess libgb gprs
# Conditional modules
if BUILD_NAT

@ -97,7 +97,7 @@ static void signal_handler(int signal)
switch (signal) {
case SIGINT:
osmo_signal_dispatch(SS_GLOBAL, S_GLOBAL_SHUTDOWN, NULL);
osmo_signal_dispatch(SS_L_GLOBAL, S_L_GLOBAL_SHUTDOWN, NULL);
sleep(1);
exit(0);
break;

@ -105,7 +105,7 @@ static void signal_handler(int signal)
switch (signal) {
case SIGINT:
osmo_signal_dispatch(SS_GLOBAL, S_GLOBAL_SHUTDOWN, NULL);
osmo_signal_dispatch(SS_L_GLOBAL, S_L_GLOBAL_SHUTDOWN, NULL);
sleep(1);
exit(0);
break;

@ -1,12 +1,11 @@
INCLUDES = $(all_includes) -I$(top_srcdir)/include -I$(top_builddir)
AM_CFLAGS=-Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(COVERAGE_CFLAGS)
AM_LDFLAGS = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(COVERAGE_LDFLAGS)
AM_CFLAGS=-Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOABIS_CFLAGS) $(COVERAGE_CFLAGS)
AM_LDFLAGS = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(LIBOSMOABIS_LIBS) $(COVERAGE_LDFLAGS)
bin_PROGRAMS = ipaccess-find ipaccess-config ipaccess-proxy
ipaccess_find_LDADD = $(top_builddir)/src/libbsc/libbsc.a \
$(top_builddir)/src/libmsc/libmsc.a \
$(top_builddir)/src/libabis/libabis.a \
$(top_builddir)/src/libbsc/libbsc.a \
$(top_builddir)/src/libtrau/libtrau.a \
$(top_builddir)/src/libcommon/libcommon.a
@ -17,7 +16,6 @@ ipaccess_config_SOURCES = ipaccess-config.c ipaccess-firmware.c network_listen.c
# FIXME: resolve the bogus dependencies patched around here:
ipaccess_config_LDADD = $(top_builddir)/src/libbsc/libbsc.a \
$(top_builddir)/src/libmsc/libmsc.a \
$(top_builddir)/src/libabis/libabis.a \
$(top_builddir)/src/libbsc/libbsc.a \
$(top_builddir)/src/libtrau/libtrau.a \
$(top_builddir)/src/libcommon/libcommon.a \
@ -26,7 +24,6 @@ ipaccess_config_LDADD = $(top_builddir)/src/libbsc/libbsc.a \
ipaccess_proxy_SOURCES = ipaccess-proxy.c
ipaccess_proxy_LDADD = $(top_builddir)/src/libbsc/libbsc.a \
$(top_builddir)/src/libmsc/libmsc.a \
$(top_builddir)/src/libabis/libabis.a \
$(top_builddir)/src/libbsc/libbsc.a \
$(top_builddir)/src/libtrau/libtrau.a \
$(top_builddir)/src/libcommon/libcommon.a

@ -39,12 +39,19 @@
#include <osmocom/core/timer.h>
#include <openbsc/ipaccess.h>
#include <openbsc/gsm_data.h>
#include <openbsc/e1_input.h>
#include <osmocom/abis/e1_input.h>
#include <openbsc/abis_nm.h>
#include <openbsc/signal.h>
#include <openbsc/debug.h>
#include <openbsc/network_listen.h>
#include <osmocom/abis/ipaccess.h>
#include <openbsc/gsm_data.h>
#include <openbsc/abis_nm.h>
#include <openbsc/signal.h>
#include <openbsc/debug.h>
#include <openbsc/network_listen.h>
#include <osmocom/core/talloc.h>
#include <osmocom/abis/abis.h>
static struct gsm_network *gsmnet;
@ -80,6 +87,86 @@ static uint8_t prim_oml_attr[] = { 0x95, 0x00, 7, 0x88, 192, 168, 100, 11, 0x00,
static uint8_t unit_id_attr[] = { 0x91, 0x00, 9, '2', '3', '4', '2', '/' , '0', '/', '0', 0x00 };
*/
extern int ipaccess_fd_cb(struct osmo_fd *bfd, unsigned int what);
extern struct e1inp_line_ops ipaccess_e1inp_line_ops;
/* Actively connect to a BTS. Currently used by ipaccess-config.c */
static int ipaccess_connect(struct e1inp_line *line, struct sockaddr_in *sa)
{
struct e1inp_ts *e1i_ts = &line->ts[0];
struct osmo_fd *bfd = &e1i_ts->driver.ipaccess.fd;
int ret, on = 1;
bfd->fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
bfd->cb = ipaccess_fd_cb;
bfd->when = BSC_FD_READ | BSC_FD_WRITE;
bfd->data = line;
bfd->priv_nr = E1INP_SIGN_OML;
if (bfd->fd < 0) {
LOGP(DLINP, LOGL_ERROR, "could not create TCP socket.\n");
return -EIO;
}
setsockopt(bfd->fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
ret = connect(bfd->fd, (struct sockaddr *) sa, sizeof(*sa));
if (ret < 0) {
LOGP(DLINP, LOGL_ERROR, "could not connect socket\n");
close(bfd->fd);
return ret;
}
ret = osmo_fd_register(bfd);
if (ret < 0) {
close(bfd->fd);
return ret;
}
return ret;
//return e1inp_line_register(line);
}
/* configure pseudo E1 line in ip.access style and connect to BTS */
static int ia_config_connect(struct gsm_bts *bts, struct sockaddr_in *sin)
{
struct e1inp_line *line;
struct e1inp_ts *sign_ts, *rsl_ts;
struct e1inp_sign_link *oml_link, *rsl_link;
line = talloc_zero(tall_bsc_ctx, struct e1inp_line);
if (!line)
return -ENOMEM;
line->driver = e1inp_driver_find("ipa");
if (!line->driver) {
fprintf(stderr, "cannot `ipa' driver, giving up.\n");
return -EINVAL;
}
line->ops = &ipaccess_e1inp_line_ops;
/* create E1 timeslots for signalling and TRAU frames */
e1inp_ts_config_sign(&line->ts[1-1], line);
e1inp_ts_config_sign(&line->ts[2-1], line);
/* create signalling links for TS1 */
sign_ts = &line->ts[1-1];
rsl_ts = &line->ts[2-1];
oml_link = e1inp_sign_link_create(sign_ts, E1INP_SIGN_OML,
bts->c0, 0xff, 0);
rsl_link = e1inp_sign_link_create(rsl_ts, E1INP_SIGN_RSL,
bts->c0, 0, 0);
/* create back-links from bts/trx */
bts->oml_link = oml_link;
bts->c0->rsl_link = rsl_link;
/* default port at BTS for incoming connections is 3006 */
if (sin->sin_port == 0)
sin->sin_port = htons(3006);
return ipaccess_connect(line, sin);
}
/*
* Callback function for NACK on the OML NM
*
@ -891,6 +978,7 @@ int main(int argc, char **argv)
fprintf(stderr, "you have to specify the IP address of the BTS. Use --help for more information\n");
exit(2);
}
libosmo_abis_init(tall_ctx_config);
gsmnet = gsm_network_init(1, 1, NULL);
if (!gsmnet)

@ -210,12 +210,12 @@ static int handle_udp_read(struct osmo_fd *bfd)
ret = recv(bfd->fd, msg->data, msg->data_len, 0);
if (ret < 0) {
if (errno != EAGAIN)
LOGP(DINP, LOGL_ERROR, "recv error %s\n", strerror(errno));
LOGP(DLINP, LOGL_ERROR, "recv error %s\n", strerror(errno));
msgb_free(msg);
return ret;
}
if (ret == 0) {
DEBUGP(DINP, "UDP peer disappeared, dead socket\n");
DEBUGP(DLINP, "UDP peer disappeared, dead socket\n");
osmo_fd_unregister(bfd);
close(bfd->fd);
bfd->fd = -1;
@ -223,16 +223,16 @@ static int handle_udp_read(struct osmo_fd *bfd)
return -EIO;
}
if (ret < sizeof(*hh)) {
DEBUGP(DINP, "could not even read header!?!\n");
DEBUGP(DLINP, "could not even read header!?!\n");
msgb_free(msg);
return -EIO;
}
msgb_put(msg, ret);
msg->l2h = msg->data + sizeof(*hh);
DEBUGP(DMI, "UDP RX: %s\n", osmo_hexdump(msg->data, msg->len));
DEBUGP(DLMI, "UDP RX: %s\n", osmo_hexdump(msg->data, msg->len));
if (hh->len != msg->len - sizeof(*hh)) {
DEBUGP(DINP, "length (%u/%u) disagrees with header(%u)\n",
DEBUGP(DLINP, "length (%u/%u) disagrees with header(%u)\n",
msg->len, msg->len - 3, hh->len);
msgb_free(msg);
return -EIO;
@ -247,7 +247,7 @@ static int handle_udp_read(struct osmo_fd *bfd)
other_conn = ipbc->rsl_conn[0];
break;
default:
DEBUGP(DINP, "Unknown protocol 0x%02x, sending to "
DEBUGP(DLINP, "Unknown protocol 0x%02x, sending to "
"OML FD\n", hh->proto);
/* fall through */
case IPAC_PROTO_IPACCESS:
@ -264,7 +264,7 @@ static int handle_udp_read(struct osmo_fd *bfd)
other_conn = ipbc->bsc_rsl_conn[0];
break;
default:
DEBUGP(DINP, "Unknown protocol 0x%02x, sending to "
DEBUGP(DLINP, "Unknown protocol 0x%02x, sending to "
"OML FD\n", hh->proto);
case IPAC_PROTO_IPACCESS:
case IPAC_PROTO_OML:
@ -273,7 +273,7 @@ static int handle_udp_read(struct osmo_fd *bfd)
}
break;
default:
DEBUGP(DINP, "Unknown filedescriptor priv_nr=%04x\n", bfd->priv_nr);
DEBUGP(DLINP, "Unknown filedescriptor priv_nr=%04x\n", bfd->priv_nr);
break;
}
@ -323,12 +323,12 @@ static int ipbc_alloc_connect(struct ipa_proxy_conn *ipc, struct osmo_fd *bfd,
sin.sin_family = AF_INET;
inet_aton(bsc_ipaddr, &sin.sin_addr);
DEBUGP(DINP, "(%u/%u/%u) New BTS connection: ",
DEBUGP(DLINP, "(%u/%u/%u) New BTS connection: ",
site_id, bts_id, trx_id);
/* OML needs to be established before RSL */
if ((bfd->priv_nr & 0xff) != OML_FROM_BTS) {
DEBUGPC(DINP, "Not a OML connection ?!?\n");
DEBUGPC(DLINP, "Not a OML connection ?!?\n");
return -EIO;
}
@ -339,7 +339,7 @@ static int ipbc_alloc_connect(struct ipa_proxy_conn *ipc, struct osmo_fd *bfd,
goto err_out;
}
DEBUGPC(DINP, "Created BTS Conn data structure\n");
DEBUGPC(DLINP, "Created BTS Conn data structure\n");
ipbc->ipp = ipp;
ipbc->unit_id.site_id = site_id;
ipbc->unit_id.bts_id = bts_id;
@ -360,7 +360,7 @@ static int ipbc_alloc_connect(struct ipa_proxy_conn *ipc, struct osmo_fd *bfd,
goto err_bsc_conn;
}
DEBUGP(DINP, "(%u/%u/%u) OML Connected to BSC\n",
DEBUGP(DLINP, "(%u/%u/%u) OML Connected to BSC\n",
site_id, bts_id, trx_id);
/* Create UDP socket for BTS packet injection */
@ -369,7 +369,7 @@ static int ipbc_alloc_connect(struct ipa_proxy_conn *ipc, struct osmo_fd *bfd,
UDP_TO_BTS, udp_fd_cb, ipbc);
if (ret < 0)
goto err_udp_bts;
DEBUGP(DINP, "(%u/%u/%u) Created UDP socket for injection "
DEBUGP(DLINP, "(%u/%u/%u) Created UDP socket for injection "
"towards BTS at port %u\n", site_id, bts_id, trx_id, udp_port);
/* Create UDP socket for BSC packet injection */
@ -378,7 +378,7 @@ static int ipbc_alloc_connect(struct ipa_proxy_conn *ipc, struct osmo_fd *bfd,
UDP_TO_BSC, udp_fd_cb, ipbc);
if (ret < 0)
goto err_udp_bsc;
DEBUGP(DINP, "(%u/%u/%u) Created UDP socket for injection "
DEBUGP(DLINP, "(%u/%u/%u) Created UDP socket for injection "
"towards BSC at port %u\n", site_id, bts_id, trx_id, udp_port);
@ -394,13 +394,13 @@ static int ipbc_alloc_connect(struct ipa_proxy_conn *ipc, struct osmo_fd *bfd,
ret = make_sock(&ipbc->gprs_ns_fd, IPPROTO_UDP, ip, 0, 0,
gprs_ns_cb, ipbc);
if (ret < 0) {
LOGP(DINP, LOGL_ERROR, "Creating the GPRS socket failed.\n");
LOGP(DLINP, LOGL_ERROR, "Creating the GPRS socket failed.\n");
goto err_udp_bsc;
}
ret = getsockname(ipbc->gprs_ns_fd.fd, (struct sockaddr* ) &sock, &len);
ipbc->gprs_local_port = ntohs(sock.sin_port);
LOGP(DINP, LOGL_NOTICE,
LOGP(DLINP, LOGL_NOTICE,
"Created GPRS NS Socket. Listening on: %s:%d\n",
inet_ntoa(sock.sin_addr), ipbc->gprs_local_port);
@ -445,17 +445,17 @@ static int ipaccess_rcvmsg(struct ipa_proxy_conn *ipc, struct msgb *msg,
ret = ipaccess_send_pong(bfd->fd);
break;
case IPAC_MSGT_PONG:
DEBUGP(DMI, "PONG!\n");
DEBUGP(DLMI, "PONG!\n");
break;
case IPAC_MSGT_ID_RESP:
DEBUGP(DMI, "ID_RESP ");
DEBUGP(DLMI, "ID_RESP ");
/* parse tags, search for Unit ID */
ipaccess_idtag_parse(&tlvp, (uint8_t *)msg->l2h + 2,
msgb_l2len(msg)-2);
DEBUGP(DMI, "\n");
DEBUGP(DLMI, "\n");
if (!TLVP_PRESENT(&tlvp, IPAC_IDTAG_UNIT)) {
LOGP(DINP, LOGL_ERROR, "No Unit ID in ID RESPONSE !?!\n");
LOGP(DLINP, LOGL_ERROR, "No Unit ID in ID RESPONSE !?!\n");
return -EIO;
}
@ -479,17 +479,17 @@ static int ipaccess_rcvmsg(struct ipa_proxy_conn *ipc, struct msgb *msg,
sin.sin_family = AF_INET;
inet_aton(bsc_ipaddr, &sin.sin_addr);
DEBUGP(DINP, "Identified BTS %u/%u/%u\n",
DEBUGP(DLINP, "Identified BTS %u/%u/%u\n",
site_id, bts_id, trx_id);
if ((bfd->priv_nr & 0xff) != RSL_FROM_BTS) {
LOGP(DINP, LOGL_ERROR, "Second OML connection from "
LOGP(DLINP, LOGL_ERROR, "Second OML connection from "
"same BTS ?!?\n");
return 0;
}
if (trx_id >= MAX_TRX) {
LOGP(DINP, LOGL_ERROR, "We don't support more "
LOGP(DLINP, LOGL_ERROR, "We don't support more "
"than %u TRX\n", MAX_TRX);
return -EINVAL;
}
@ -505,30 +505,30 @@ static int ipaccess_rcvmsg(struct ipa_proxy_conn *ipc, struct msgb *msg,
connect_bsc(&sin, RSL_TO_BSC | (trx_id << 8), ipbc);
if (!ipbc->bsc_oml_conn)
return -EIO;
DEBUGP(DINP, "(%u/%u/%u) Connected RSL to BSC\n",
DEBUGP(DLINP, "(%u/%u/%u) Connected RSL to BSC\n",
site_id, bts_id, trx_id);
}
break;
case IPAC_MSGT_ID_GET:
DEBUGP(DMI, "ID_GET\n");
DEBUGP(DLMI, "ID_GET\n");
if ((bfd->priv_nr & 0xff) != OML_TO_BSC &&
(bfd->priv_nr & 0xff) != RSL_TO_BSC) {
DEBUGP(DINP, "IDentity REQuest from BTS ?!?\n");
DEBUGP(DLINP, "IDentity REQuest from BTS ?!?\n");
return -EIO;
}
ipbc = ipc->bts_conn;
if (!ipbc) {
DEBUGP(DINP, "ID_GET from BSC before we have ID_RESP from BTS\n");
DEBUGP(DLINP, "ID_GET from BSC before we have ID_RESP from BTS\n");
return -EIO;
}
ret = write(bfd->fd, ipbc->id_resp, ipbc->id_resp_len);
break;
case IPAC_MSGT_ID_ACK:
DEBUGP(DMI, "ID_ACK? -> ACK!\n");
DEBUGP(DLMI, "ID_ACK? -> ACK!\n");
ret = ipaccess_send_id_ack(bfd->fd);
break;
default:
LOGP(DMI, LOGL_ERROR, "Unhandled IPA type; %d\n", msg_type);
LOGP(DLMI, LOGL_ERROR, "Unhandled IPA type; %d\n", msg_type);
return 1;
break;
}
@ -551,7 +551,7 @@ struct msgb *ipaccess_proxy_read_msg(struct osmo_fd *bfd, int *error)
ret = recv(bfd->fd, msg->data, 3, 0);
if (ret < 0) {
if (errno != EAGAIN)
LOGP(DINP, LOGL_ERROR, "recv error: %s\n", strerror(errno));
LOGP(DLINP, LOGL_ERROR, "recv error: %s\n", strerror(errno));
msgb_free(msg);
*error = ret;
return NULL;
@ -568,7 +568,7 @@ struct msgb *ipaccess_proxy_read_msg(struct osmo_fd *bfd, int *error)
len = ntohs(hh->len);
ret = recv(bfd->fd, msg->l2h, len, 0);
if (ret < len) {
LOGP(DINP, LOGL_ERROR, "short read!\n");
LOGP(DLINP, LOGL_ERROR, "short read!\n");
msgb_free(msg);
*error = -EIO;
return NULL;
@ -611,7 +611,7 @@ static void reconn_tmr_cb(void *data)
struct sockaddr_in sin;
int i;
DEBUGP(DINP, "Running reconnect timer\n");
DEBUGP(DLINP, "Running reconnect timer\n");
memset(&sin, 0, sizeof(sin));
sin.sin_family = AF_INET;
@ -621,13 +621,13 @@ static void reconn_tmr_cb(void *data)
/* if OML to BSC is dead, try to restore it */
if (ipbc->oml_conn && !ipbc->bsc_oml_conn) {
sin.sin_port = htons(IPA_TCP_PORT_OML);
logp_ipbc_uid(DINP, LOGL_NOTICE, ipbc, 0);
LOGPC(DINP, LOGL_NOTICE, "OML Trying to reconnect\n");
logp_ipbc_uid(DLINP, LOGL_NOTICE, ipbc, 0);
LOGPC(DLINP, LOGL_NOTICE, "OML Trying to reconnect\n");
ipbc->bsc_oml_conn = connect_bsc(&sin, OML_TO_BSC, ipbc);
if (!ipbc->bsc_oml_conn)
goto reschedule;
logp_ipbc_uid(DINP, LOGL_NOTICE, ipbc, 0);
LOGPC(DINP, LOGL_NOTICE, "OML Reconnected\n");
logp_ipbc_uid(DLINP, LOGL_NOTICE, ipbc, 0);
LOGPC(DLINP, LOGL_NOTICE, "OML Reconnected\n");
}
/* if we (still) don't have a OML connection, skip RSL */
if (!ipbc->oml_conn || !ipbc->bsc_oml_conn)
@ -644,13 +644,13 @@ static void reconn_tmr_cb(void *data)
priv_nr &= ~0xff;
priv_nr |= RSL_TO_BSC;
sin.sin_port = htons(IPA_TCP_PORT_RSL);
logp_ipbc_uid(DINP, LOGL_NOTICE, ipbc, priv_nr >> 8);
LOGPC(DINP, LOGL_NOTICE, "RSL Trying to reconnect\n");
logp_ipbc_uid(DLINP, LOGL_NOTICE, ipbc, priv_nr >> 8);
LOGPC(DLINP, LOGL_NOTICE, "RSL Trying to reconnect\n");
ipbc->bsc_rsl_conn[i] = connect_bsc(&sin, priv_nr, ipbc);
if (!ipbc->bsc_rsl_conn)
goto reschedule;
logp_ipbc_uid(DINP, LOGL_NOTICE, ipbc, priv_nr >> 8);
LOGPC(DINP, LOGL_NOTICE, "RSL Reconnected\n");
logp_ipbc_uid(DLINP, LOGL_NOTICE, ipbc, priv_nr >> 8);
LOGPC(DLINP, LOGL_NOTICE, "RSL Reconnected\n");
}
}
return;
@ -778,8 +778,8 @@ static int handle_tcp_read(struct osmo_fd *bfd)
msg = ipaccess_proxy_read_msg(bfd, &ret);
if (!msg) {
if (ret == 0) {
logp_ipbc_uid(DINP, LOGL_NOTICE, ipbc, bfd->priv_nr >> 8);
LOGPC(DINP, LOGL_NOTICE, "%s disappeared, "
logp_ipbc_uid(DLINP, LOGL_NOTICE, ipbc, bfd->priv_nr >> 8);
LOGPC(DLINP, LOGL_NOTICE, "%s disappeared, "
"dead socket\n", btsbsc);
handle_dead_socket(bfd);
}
@ -787,8 +787,8 @@ static int handle_tcp_read(struct osmo_fd *bfd)
}
msgb_put(msg, ret);
logp_ipbc_uid(DMI, LOGL_DEBUG, ipbc, bfd->priv_nr >> 8);
DEBUGPC(DMI, "RX<-%s: %s\n", btsbsc, osmo_hexdump(msg->data, msg->len));
logp_ipbc_uid(DLMI, LOGL_DEBUG, ipbc, bfd->priv_nr >> 8);
DEBUGPC(DLMI, "RX<-%s: %s\n", btsbsc, osmo_hexdump(msg->data, msg->len));
hh = (struct ipaccess_head *) msg->data;
if (hh->proto == IPAC_PROTO_IPACCESS) {
@ -809,7 +809,7 @@ static int handle_tcp_read(struct osmo_fd *bfd)
}
if (!ipbc) {
LOGP(DINP, LOGL_ERROR,
LOGP(DLINP, LOGL_ERROR,
"received %s packet but no ipc->bts_conn?!?\n", btsbsc);
msgb_free(msg);
return -EIO;
@ -824,8 +824,8 @@ static int handle_tcp_read(struct osmo_fd *bfd)
/* mark respective filedescriptor as 'we want to write' */
bsc_conn->fd.when |= BSC_FD_WRITE;
} else {
logp_ipbc_uid(DINP, LOGL_INFO, ipbc, bfd->priv_nr >> 8);
LOGPC(DINP, LOGL_INFO, "Dropping packet from %s, "
logp_ipbc_uid(DLINP, LOGL_INFO, ipbc, bfd->priv_nr >> 8);
LOGPC(DLINP, LOGL_INFO, "Dropping packet from %s, "
"since remote connection is dead\n", btsbsc);
msgb_free(msg);
}
@ -858,16 +858,16 @@ static int handle_tcp_write(struct osmo_fd *bfd)
llist_del(lh);
msg = llist_entry(lh, struct msgb, list);
logp_ipbc_uid(DMI, LOGL_DEBUG, ipbc, bfd->priv_nr >> 8);
DEBUGPC(DMI, "TX %04x: %s\n", bfd->priv_nr,
logp_ipbc_uid(DLMI, LOGL_DEBUG, ipbc, bfd->priv_nr >> 8);
DEBUGPC(DLMI, "TX %04x: %s\n", bfd->priv_nr,
osmo_hexdump(msg->data, msg->len));
ret = send(bfd->fd, msg->data, msg->len, 0);
msgb_free(msg);
if (ret == 0) {
logp_ipbc_uid(DINP, LOGL_NOTICE, ipbc, bfd->priv_nr >> 8);
LOGP(DINP, LOGL_NOTICE, "%s disappeared, dead socket\n", btsbsc);
logp_ipbc_uid(DLINP, LOGL_NOTICE, ipbc, bfd->priv_nr >> 8);
LOGP(DLINP, LOGL_NOTICE, "%s disappeared, dead socket\n", btsbsc);
handle_dead_socket(bfd);
}
@ -907,7 +907,7 @@ static int listen_fd_cb(struct osmo_fd *listen_bfd, unsigned int what)
perror("accept");
return ret;
}
DEBUGP(DINP, "accept()ed new %s link from %s\n",
DEBUGP(DLINP, "accept()ed new %s link from %s\n",
(listen_bfd->priv_nr & 0xff) == OML_FROM_BTS ? "OML" : "RSL",
inet_ntoa(sa.sin_addr));
@ -925,7 +925,7 @@ static int listen_fd_cb(struct osmo_fd *listen_bfd, unsigned int what)
bfd->when = BSC_FD_READ;
ret = osmo_fd_register(bfd);
if (ret < 0) {
LOGP(DINP, LOGL_ERROR, "could not register FD\n");
LOGP(DLINP, LOGL_ERROR, "could not register FD\n");
close(bfd->fd);
talloc_free(ipc);
return ret;
@ -950,7 +950,7 @@ static void send_ns(int fd, const char *buf, int size, struct in_addr ip, int po
ret = sendto(fd, buf, size, 0, (struct sockaddr *) &addr, len);
if (ret < 0) {
LOGP(DINP, LOGL_ERROR, "Failed to forward GPRS message.\n");
LOGP(DLINP, LOGL_ERROR, "Failed to forward GPRS message.\n");
}
}
@ -965,7 +965,7 @@ static int gprs_ns_cb(struct osmo_fd *bfd, unsigned int what)
/* 1. get the data... */
ret = recvfrom(bfd->fd, buf, sizeof(buf),