Commit Graph

1223 Commits (3ff81b1a6b830d16803f3fc7356e9fd71162b6c6)

Author SHA1 Message Date
Harald Welte 3ff81b1a6b libctrl: autotools build system integration
Now we actually build the recently-imported libctrl
2014-08-21 15:34:18 +02:00
Harald Welte 7fd0c830d9 libctrl: Add DLCTRL as logging context for the control interface
... and make libctrl code use it
2014-08-21 15:34:18 +02:00
Harald Welte f3c7e85d05 libctrl: remove reference to bsc_replace_string()
... and rather introduce a general osmo_talloc_replace_string() to
2014-08-21 15:34:17 +02:00
Harald Welte c9df37d84a libctrl: Avoid using external tall_bsc_ctx
Instead of using one flat talloc context (and one that is specific to
openbsc), we should attach the objects to whatever parent context they
are being used in.
2014-08-21 15:34:17 +02:00
Harald Welte 1238cc64d7 libctrl: remove openbsc headers, convert from make_sock to libosmocore 2014-08-21 15:34:17 +02:00
Harald Welte e1a502b0df libctrl: Remove reference to 'DNAT' in favor of 'DCTRL' 2014-08-21 15:34:17 +02:00
Harald Welte dda4225153 libctr: rename/move control interface to libosmocore naming scheme 2014-08-21 15:34:17 +02:00
Holger Hans Peter Freyther 5ad742d56e ctrl: Allow the value to contain spaces. No need to split the string 2014-08-21 15:34:17 +02:00
Holger Hans Peter Freyther 0e7b67c3d9 ctrl: Use CTRL_CMD_DEFINE_STRUCT in CTRL_CMD_DEFINE_RANGE
Jacob pointed out that I didn't convert CTRL_CMD_DEFINE_RANGE.
This patch is doing it now.
2014-08-21 15:34:16 +02:00
Holger Hans Peter Freyther 6217930688 ctrl: Reduce code duplication and add a define to create the struct
This has been pointed out by Jacob and removes two more duplicates
of the struct. For the unused CTRL_CMD_DEFINE_STRING macro there
will be no verify command.
2014-08-21 15:34:16 +02:00
Holger Hans Peter Freyther 50059bb64f ctrl: Remove the param parameter as it was never used/implemented 2014-08-21 15:34:16 +02:00
Holger Hans Peter Freyther c08c55186f ctrl: Introduce a macro for read-only attributes and use it
Certain attributes are read-only. Add a macro to make it more
easy to define those.
2014-08-21 15:34:16 +02:00
Jacob Erlbeck 141de62b06 ipa: Use enhanced ipa_msg_recv_buffered() to cope with partioned IPA messages
The old ipa_msg_recv() implementation didn't support partial receive,
so IPA connections got disconnected when this happened.

This patch adds the handling of the temporary message buffers and uses

It has been successfully tested by jerlbeck with osmo-nitb and

Ticket: OW#768
Sponsored-by: On-Waves ehf
2014-08-21 15:34:16 +02:00
Holger Hans Peter Freyther ea62a38b5d ctrl: Move the lookup into a separate file in preparation for GPRS
For GPRS the look-up via bts/trx does not make any sense and would
introduce bad depdencies for the SGSN. Move the look-up code to a
new file and introduce new setup methods.
2014-08-21 15:34:16 +02:00
Holger Hans Peter Freyther 416e316564 ctrl: Make it possible to re-use the string get and set routine
This can be used for the description field that requires some
special handling for newlines.
2014-08-21 15:34:16 +02:00
Holger Hans Peter Freyther 05f655e2b0 ctrl: Make the int range set, get and verify methods available
For the max power reduction we will need to have a different range
method. It will need to check if the value is even. Make the set,
get and verify methods available through a macro.
2014-08-21 15:34:16 +02:00
Jacob Erlbeck e6d56159a6 ctrl: Set a generic reply when it hasn'n been set
When verification failed and the reply string was not updated, the
message "Someone forgot to fill in the reply." was shown instead
of the default "Value failed verification." message.

This patch changes the default reply handling in ctrl_cmd_handle()
by setting the reply to NULL initially and then checking it at the
end. If it hasn't been set, a generic message is assigned and an
error is logged.
2014-08-21 15:34:15 +02:00
Harald Welte 6d96dd7477 ctrlif: Flush/Clear write_queue when closing the control socket 2014-08-21 15:34:15 +02:00
Alexander Huemer 35f5653a18 Use AM_CPPFLAGS
Since automake 1.13 INCLUDES is depricates and causes a warning
2014-08-21 15:34:15 +02:00
Holger Hans Peter Freyther e9f7be16ac ctrl: Provide a reply in case the range check failed 2014-08-21 15:34:15 +02:00
Holger Hans Peter Freyther da5eded5ad ctrl: Make the commands static to not pollute the namespace
We do not need to access these commands from another compilation
unit and can just make it static.
2014-08-21 15:34:15 +02:00
Holger Hans Peter Freyther 17e7e5a869 ctrl: Work on the cmd->node instead of the data pointer passed
Make the macros use the cmd->node instead of the data pointer. The
naming of the variable inside the macro already indicates that it
should use the nodes data structure.
2014-08-21 15:34:15 +02:00
Holger Hans Peter Freyther 43a11db879 ctrl: Fix the signature of the string control commands
Like with all type unsafe callbacks we will need to cast from
void to the dtype. This addresses some compiler warnings.

Make it possible to only include the control_cmd.h to use the
macros defined in this file.
2014-08-21 15:34:15 +02:00
Daniel Willmann 9c97493c5c libctrl, osmo-bsc: Get rid of net prefix
net is now implicit in the root node
2014-08-21 15:34:15 +02:00
Daniel Willmann 3463941c72 ctrl: Use strtol instead of atoi to detect conversion errors 2014-08-21 15:34:14 +02:00
Daniel Willmann 5d9b203db6 ctrl: Improve error messages in ctrl_cmd_handle 2014-08-21 15:34:14 +02:00
Daniel Willmann bed515f5d6 ctrl: Change the paths to bts.%i. instead of bts%i 2014-08-21 15:34:14 +02:00
Daniel Willmann 9f97316fcf ctrl: Improve error handling if controlif setup fails 2014-08-21 15:34:14 +02:00
Daniel Willmann 35a1b3b493 libctrl: Add function ctrl_cmd_send_to_all
Sends a command to all ctrl connections except the one it originated
2014-08-21 15:34:14 +02:00
Daniel Willmann f2e75d4371 libctrl: Add trap helper function 2014-08-21 15:34:14 +02:00
Daniel Willmann 782974b6c9 libctrl: Change controlif_setup so it returns the ctrl handle
nat: Catch up with controlif_setup API change
We now save a control handle reference in the nat
osmo-bsc: Catch up with controlif_setup API change
We now save a control handle reference in the gsm network
2014-08-21 15:34:14 +02:00
Daniel Willmann 0e0cf37c44 libctrl: Keep track of connections in struct ctrl_handle 2014-08-21 15:34:13 +02:00
Holger Hans Peter Freyther ad6451fc98 misc: Use other size modifiers to fix compiler warnings
control_if.c:521:2: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint64_t’ [-Wformat]
osmo_bsc_bssap.c:473:3: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 7 has type ‘unsigned int’ [-Wformat]
mgcp_main.c:162:4: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘unsigned int’ [-Wformatt]
2014-08-21 15:34:13 +02:00
Alexander Huemer 1d3634e0cb libctrl: only free() msgb if it was alloc()ed
Before this patch a SIGABRT was caused when doing e.g.:
$ ncat 4249
2014-08-21 15:34:13 +02:00
Alexander Huemer 4376bcc1b0 fix some "implicit declaration" warnings in osmo-nitb 2014-08-21 15:34:13 +02:00
Holger Hans Peter Freyther a6b34015af libctrl: Add a function to create the cmd 2014-08-21 15:34:13 +02:00
Daniel Willmann 9225ab1ecc libctrl: Don't overwrite error reply if the verify function sets one 2014-08-21 15:34:13 +02:00
Daniel Willmann f7c74e5879 libctrl: Mark the cmd set/get/verify functions static 2014-08-21 15:34:13 +02:00
Daniel Willmann b06dd3010f libctrl: Bind control interface to localhost 2014-08-21 15:34:13 +02:00
Holger Hans Peter Freyther 19abc95970 libctrl: Use DCTRL as logging destination in libctrl 2014-08-21 15:34:12 +02:00
Pablo Neira Ayuso 10dfc26e8f 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

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

- 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.
- 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.
2014-08-21 15:34:12 +02:00
Daniel Willmann 0834a34063 libctrl: Use inttypes.h macros to make uint64_t printfs portable. 2014-08-21 15:34:12 +02:00
Harald Welte 18b70b5b81 controlif: declare controlif_setup() in control_cmd.h
this avoids us to copy+paste external declarations over all 'main'
2014-08-21 15:34:12 +02:00
Daniel Willmann 8b7a9626a2 libctrl: Add ctrl_cmd_cpy() to copy a command 2014-08-21 15:34:12 +02:00
Daniel Willmann e9f5894e2c libctrl: Add commands to query counters and rate_cntr
These commands are installed in controlif_setup. Query them like this:
"rate_ctr.<interval>.<counter group>.<index>.<counter name>" for rate
counters and "counter.<counter name>" for regular counters. <interval>
may be either "abs" for absolute values or one or

It is possible to query all rate counters in a group (regardless of
index) or all counters in a group and with a certain index if you omit
<counter name> and <index> or just <counter name>.
2014-08-21 15:34:12 +02:00
Daniel Willmann fcf010f721 libctrl: Add macros to help define commands 2014-08-21 15:34:12 +02:00
Daniel Willmann 1264cb404f Add libctrl, an SNMP-like control interface
In contrast to the VTY interface the control interface is meant to be
used by programs.
This patch adds basic support, no commands are defined.
2014-08-21 15:34:11 +02:00
Harald Welte 28570a4e62 new <osmocom/vty/ports.h> file listing VTY tcp ports
imported from
2014-08-21 15:34:11 +02:00
Holger Hans Peter Freyther 715e945055 gsm0808: Fix copy and paste pointed out by clang
The element following the identifier list was the
GSM0808_IE_LSA_INFORMATION. It is a TLV type as well
and the issue got introduced in

gsm0808.c:316:40: warning: initializer overrides prior initialization of this subobject
                [GSM0808_IE_LSA_IDENTIFIER_LIST]        = { TLV_TYPE_TLV },
gsm0808.c:315:40: note: previous initialization is here
                [GSM0808_IE_LSA_IDENTIFIER_LIST]        = { TLV_TYPE_TLV },
2014-08-21 14:19:37 +02:00
Holger Hans Peter Freyther efe0100189 macaddr: Add some code for FreeBSD (it should work on the others too)
There doesn't seem to be a way to share this code with Linux as
it doesn't have the sockaddr_dl concept inside the getifaddrs.

I manually verified this on a FreeBSD10 box and hex decoding gave
me the correct mac address and rc was 0.
2014-08-21 14:19:37 +02:00