Commit Graph

20 Commits

Author SHA1 Message Date
Pau Espin c04d8d2274 use osmo_init_logging2
Change-Id: Iab9d111aba8f9b423e6a541e928f68b38d561067
2018-04-17 14:43:08 +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 5a8cca3a1c tests: e1inp_ipa_bsc_test: fix crash
The sequence to trigger the crash was:

1) establish a full A-bis IPA link (both OML and RSL correctly established
and ID_RESP received from BTS).
2) nc 127.0.0.1 3002 # establish OML link only

I forgot to set to NULL the oml and rsl links we're using. Otherwise,
the test calls e1inp_sign_link_destroy(rsl) which does not exists.
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
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 49bc872b48 tests: close OML and RSL if set for the BSC example
We only close the OML and RSL links if they are indeed up.
2011-07-08 15:25:44 +02:00
Pablo Neira Ayuso 1ca98b9e9d tests: use the virtual E1 line used by OML for RSL link
The ipaccess driver is tricky. Since it uses two ports for OML
and RSL links, the link for RSL needs to be done in the same
line that the OML link.

Now the BSC examples uses the virtual E1 line where the OML
link is for the RSL one.

This patch also verifies that the OML link is up before the
someone tries to get the RSL link up.
2011-07-08 15:05:42 +02:00
Pablo Neira Ayuso 904d8f2d38 tests: support OML software activate request ack message
This patch steals some code from openBSC to implement the
OML software activate request ack message which is delivered
to the BTS.

This allows to test the ->sign_link(...) path.
2011-07-05 18:33:39 +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 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 e19c70a9ed src: add support for logging infrastructure in libosmo-abis
This patch uses the new libosmocore logging infrastructure
that allows to invoke log_init(&my_log_info) multiple times
so we can register categories from libraries and applications.
2011-06-12 15:15:30 +02:00
Pablo Neira Ayuso 5a4b7c54c6 e1input: rework generic (virtual and real) E1 line operations
struct e1inp_line_ops {
       int     (*sign_link_up)(struct msgb *msg, struct e1inp_line *line);
       int     (*sign_link)(struct msgb *msg, struct e1inp_sign_link *link);
       int     (*error)(struct msgb *msg, int error);
};

The description of the operations is the following:

* sign_link_up is invoked if the signalling link becomes up. In A-bis
over IP, we have to wait until the other peer identifies itself as
a BTS/BSC device, then this function is invoked. This function is not
used by ISDN drivers, the signalling link can be set up just after
the line is created.

* sign_link is called if we receive OML/RSL message. This function
is used both by ISDN and A-bis over IP drivers.

* error is called if we receive a malformed message. It is used both
by ISDN and A-bis over IP drivers.
2011-06-07 17:28:53 +02:00
Pablo Neira Ayuso 54b4979de6 src: add libosmo_abis_init(void *ctx) to set the talloc context
This function is called during initialization, so we can set what's
the talloc context for the application and the library.
2011-06-07 12:36:42 +02:00
Pablo Neira Ayuso 177094b4c9 src: use include/osmocom/abis instead of include/osmocom/gsm/abis
Harald prefers short paths.

This patch also remove commented includes in several files.
2011-06-07 12:21:51 +02:00
Pablo Neira Ayuso 0ba77d53a9 initial commit of libosmo-abis
still many things to get fixed
2011-06-05 18:32:44 +02:00