Commit Graph

26 Commits

Author SHA1 Message Date
Harald Welte 6e831b72d7 Use osmo_fd_setup() wherever applicable
Change-Id: I5b369343cf708ddfcde347f218a10d5f72303aaa
2020-12-21 17:58:06 +01:00
Harald Welte de3959e62c Use OSMO_FD_* instead of deprecated BSC_FD_*
Change-Id: Ib676eda521f0e89a1f4d8f9eac810598a3c813b9
2020-10-18 22:30:07 +02:00
Pau Espin 3b9bebfa24 tests: Use API e1inp_line_put2 instead of deprecated e1inp_line_put
Change-Id: If3fb68fda1c109f6aa15aa68c5bce285054efda7
2020-07-15 15:49:44 +02:00
Pau Espin b5cfc6b019 ipaccess: Simplify handling of ipaccess e1line ts
Handle encoding specifics behind a macro to make code easier to
understand and follow.

Change-Id: Ibf251673bff95b7a0b066b19ef4dc6c0f94fff6b
2018-10-03 12:10:43 +02:00
Pau Espin c04d8d2274 use osmo_init_logging2
Change-Id: Iab9d111aba8f9b423e6a541e928f68b38d561067
2018-04-17 14:43:08 +02:00
Holger Hans Peter Freyther e6ad794cad test: Fix the compilation of the test
This test didn't compile as it called the wrong method. It is a
manual test anyway and tend to bitrot. I didn't execute the
resulting test binary. Hmm, now I did and it segfaults on something
that appears to have been introduced a long time ago. Manual
tests are as good as no tests (besides they take more time than
writing no test). ;)
2014-08-29 09:08:01 +02:00
Andreas Eversberg f422a753a7 Support for multiple RSL connections with ABIS/ipaccess (BTS side)
In order to support multiple TRX, multiple RSL connections can be
establised. e1inp_ipa_bts_rsl_connect() requires an additional parameter
to set the TRX number.

The ts[] array (member of struct e1inp_line) refers to OML and RSL.
ts[0] refers to OML link, ts[1] to RSL link of first TRX, ts[2] to
RSL link of second TRX (if exists) and so on.

The code was successfully tested with osmobts-trx and UmTRX with two
transceivers.

The user of e1inp_ipa_bts_rsl_connect() (which is osmo-bts) can use
the new function like this (backwards compatibility function provided):

src/common/oml.c
-	rc = e1inp_ipa_bts_rsl_connect(oml_link->ts->line, inet_ntoa(in), port);
+	rc = e1inp_ipa_bts_rsl_connect_n(oml_link->ts->line, inet_ntoa(in), port,
+		trx->nr);
2014-08-28 12:50:29 +02:00
Harald Welte b65f58f6f9 move various generic IPA related functions to libosmocore
libosmo-abis is about forming A-bis interfaces/lines by means
of E1 or the IPA multiplex (or possibly other link layers).

The IPA multiplex is used in other contexts, such as the Control
interface, or the A interface.  In that context, it makes sense to have
generic IPA related functions in libosmocore.
2014-08-20 23:41:07 +02:00
Harald Welte 84f67b2832 Don't establish RSL at same time as OML link on IPA type lines
If we have a BTS-side e1inp_line, we can only establish OML at the
time of line_update.  We have to wait with RSL until the BTS explicitly
tells us the RSL destination IP and port (received via OML from BSC).

This is now handled in a new function called
e1inp_ipa_bts_rsl_connect().
2013-10-06 11:54:38 +02:00
Pablo Neira Ayuso 7251604cce tests: e1inp_ipa_*_test: fix leak of msgb in ->sign_link path
Fix a leak in the tests: The ->sign_link callback is reponsible
for releasing the msgb.
2012-08-30 21:50:32 +02:00
Pablo Neira Ayuso 1fd93bbc6e tests: e1inp_ipa_*_test: add signal handling for process termination
This patch adds signal handling to release memory in the exit
path of the tests. This is good to check what memory we are
leaking in the exist path of the tests.
2012-08-30 21:50:32 +02:00
Pablo Neira Ayuso 7723b4e9a3 tests: fix CPU suckup e1inp_ipa_bts_test after test finish
We have to read from the eventfd, otherwise select keeps returning
the file descriptor as ready to read.
2012-08-30 21:50:32 +02:00
Pablo Neira Ayuso 18d6294efe tests: e1inp_ipa_bts_test: fix compilation warnings
CC     e1inp_ipa_bts_test.o
e1inp_ipa_bts_test.c: In function ‘sign_link_up’:
e1inp_ipa_bts_test.c:47:8: warning: variable ‘dst’ set but not used [-Wunused-but-set-variable]
e1inp_ipa_bts_test.c: In function ‘test_bts_gsm_12_21_cb’:
e1inp_ipa_bts_test.c:211:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
  CCLD   e1inp_ipa_bts_test
2012-08-30 21:50:30 +02:00
Pablo Neira Ayuso 4e862cbf4b e1_input: rework configuration of virtual E1 line operations
struct e1inp_line_ops {
-       enum e1inp_line_role    role;
-       char                    *addr;
-       void                    *data;
+       union {
+               struct {
+                       enum e1inp_line_role role;      /* BSC or BTS mode. */
+                       const char *addr;               /* IP address .*/
+                       void *dev;                      /* device parameters. */
+               } ipa;
+               struct {
+                       const char *port;       /* e.g. /dev/ttyUSB0 */
+                       unsigned int delay;
+               } rs232;
+       } cfg;

Now this structure contains the configuration details for the
virtual E1 line, instead of using a pointer.

This also get the line_update callback to its original layout:

+       int (*line_update)(struct e1inp_line *line);
2011-08-19 18:43:38 +02:00
Pablo Neira Ayuso 6268416851 test: use site_id 1801 in ipa BTS example
Thus we can use it with the example file for openBSC under
doc/examples/nanobts/openbsc.cfg.
2011-08-17 23:25:38 +02:00
Harald Welte 71d87b2597 talloc: revert to use talloc inside libosmocore
It's not a good idea to confuse the two changes with each other.  Moving the
Abis part into a separate library is independent from the question whether we
have talloc inside libosmocore or use a stand-alone talloc library.
2011-07-18 14:51:16 +02:00
Pablo Neira Ayuso 2ad22b8699 tests: convert IPA BTS example to use event-oriented approach
Like the HSL BTS example. We use an event file descriptor
which is used to call the GSM 12.21 based function for
handling.
2011-07-08 18:35:45 +02:00
Pablo Neira Ayuso 009573aa5b tests: example BTS now sends an OML SW ACT REQ
This allows to test that the write path works and it allows
you to get an idea on how to implement the BTS side by means
of libosmo-abis.
2011-07-08 15:10:33 +02:00
Pablo Neira Ayuso fe8ab0af7a logging: use new harald's logging infrastructure in libosmocore
I can send patches to improve it later, better not to waste
much time at it by now so port libosmo-abis upon it.
2011-07-05 16:38:16 +02:00
Pablo Neira Ayuso dbd82fb5b1 e1_input: change prototype of ->sign_link(...)
This patch removes the struct e1inp_sign_link parameter since this
is already available in the msgb->dst field of the message.
2011-07-05 15:29:23 +02:00
Pablo Neira Ayuso 2b3520139a tests: use logging infrastructure to display messages
instead of using printf
2011-07-02 17:45:42 +02:00
Pablo Neira Ayuso dfafe68a05 ipaccess: put the ID_GET logic for the BTS mode into the driver
This patch moves the ID_GET logic from the example file to the
ipaccess driver in BTS mode.
2011-07-02 14:32:32 +02:00
Pablo Neira Ayuso c9c4fd3905 major updates in e1_input callback ops and IPA infrastructures
This patch is a major update of the callback infrastructure, now
the e1input_ops looks like the following:

struct e1inp_sign_link *        (*sign_link_up)(void *unit_info, struct e1inp_line *line, enum e1inp_sign_type type);

void    (*sign_link_down)(struct e1inp_line *line);

int     (*sign_link)(struct msgb *msg, struct e1inp_sign_link *link);

The sign_link_up and sign_link_down will be used by the A-bis over IP
input drivers.

The sign_link_up callback is used if we receive a ID_RESP message, in
that case, we have to set up the sign link for the corresponding new
OML/RSL signal link. The pointer to unit_info provides a data structure
that contains the BTS device details if we run as BSC, and the requested
device information from the BSC if we run as BTS. The sign_link_up
callback must return the new sign_link created.

The sign_link_down callback is invoked if the line does down, which
means that the counterpart has closed the socket.

The sign_link callback is used to handle all RSL/OML messages.

I have also added the following callback to the e1inp_driver:

+       void (*close)(struct e1inp_ts *ts);

Which is invoked if you call e1inp_sign_link_destroy(). This callback
is used to close the socket that is linked to that timeslot. This is
useful for A-bis over IP drivers since sockets are closed if the
OML/RSL signalling link is destroyed.

As you can notice, I have also added all the ID_RESP parsing into
libosmo-abis for both ipaccess and hsl drivers.

This patch also contains a rework of the ipa_client_link whose
integration with the e1_input infrastructure was broken (the
transmission path was broken).

This patch also contains more develop examples that act as BSC
and BTS for the ipaccess driver.

Sorry, I know it would be better to split all these changes into
logical pieces but many of them are tightly related.

This is under heavy development stage, it's anyway hard to track
changes until this becomes more stable.
2011-06-30 12:19:42 +02:00
Pablo Neira Ayuso f163d23bf6 e1_input: minor API changes to adapt it to openbsc
While working on the openbsc over libosmo-abis port, I noticed
several API changes that we need to perform for better adaptation.
2011-06-25 18:42:55 +02:00
Pablo Neira Ayuso c00ee7399d e1input: add address as parameter to e1inp_line_update(...)
This patch adds a new parameter to e1inp_line_update that allows to
specific the address for A-bis over IP BSC/BTS.
2011-06-21 12:22:49 +02:00
Pablo Neira Ayuso 96e8128061 input: ipaccess: add preliminary BTS-side for A-bis over IP
This patch adds the BTS-side for the ip.access driver for
A-bis over IP communications.

This patch adds one example under test/ so you can test the
existing BSC and BTS sides over ip.access.

Still incomplete, it requires to allow to register some
callback in the BTS side to perform some action once we
receive some message. This will come in next updates.
2011-06-14 18:47:09 +02:00