Commit Graph

574 Commits

Author SHA1 Message Date
Jacob Erlbeck bc4f7ae512 stats: Add log reporter
This reporter passes the measurement values to the logging subsystem
as DSTATS (which is currently DLGLOBAL) level INFO messages.

Sponsored-by: On-Waves ehf
2015-10-29 01:10:07 +01:00
Jacob Erlbeck 490b38f57a stats: Use function pointers in reporter objects
Currently case statements are used to select the right reporter
functions. This makes it difficult to add new reporter types,
especially if they are not going to reside in the same file.

This commit introduces per reporter function pointer for
open, close, send_count, and send_item. They are checked for
non-NULL before being called or skipped.

Sponsored-by: On-Waves ehf
2015-10-29 01:10:07 +01:00
Jacob Erlbeck ed197fd4f9 stats: Make net config optional
To support reporters without network configuration, this commit
introduces the have_net_config flag to provide corresponding error
messages.

Sponsored-by: On-Waves ehf
2015-10-29 01:10:06 +01:00
Jacob Erlbeck d01acfcc75 stats: Support statsd Multi-Metric Packets
If the MTU is given, combine several messages into a single UDP
packet until the limit is reached. Flush all reporters after the
values have been scanned.

New vty commands (node config-stats):
  mtu <100-65535>     Enable multi-metric packets and set the maximum
                      packet size (in byte)
  no mtu              Disable multi-metric packets

Note that single messages that are longer than the given MTU (minus
28 octets protocol overhead) will be dropped.

Sponsored-by: On-Waves ehf
2015-10-29 01:10:06 +01:00
Jacob Erlbeck 80db4ec387 core: Add difference function to osmo_counter
The osmo_counter_difference returns the counter value difference
since the last call of this function with the given counter object.

Sponsored-by: On-Waves ehf
2015-10-29 01:10:06 +01:00
Jacob Erlbeck b1dbfb4c41 stats: Implement timer based reporting
This calls stats_flush in regular intervals which polls the
statistical values and calls the active reporters when values have
changed.

Sponsored-by: On-Waves ehf
2015-10-29 01:10:06 +01:00
Jacob Erlbeck adc900e0e3 stats/vty: Add stats configuration
This commit provides stats configuration similar to the log
configuration.

The following vty commands are added to the config node:
  stats reporter statsd          Create/Modify a statsd reporter
  no stats reporter statsd       Remove a statsd reporter

To actually configure a reporter, the config-stats node is entered
when the "stats reporter" command has succeeded. The following new
vty commands are available there:
  local-ip ADDR          Set the IP address to which we bind locally
  no local-ip            Do not bind to a certain IP address
  remote-ip ADDR         Set the remote IP address to which we connect
  remote-port <1-65535>  Set the remote port to which we connect
  prefix PREFIX          Set the item/counter name prefix
  no prefix              Do not use a prefix
  enable                 Enable the reporter
  disable                Disable the reporter

Sponsored-by: On-Waves ehf
2015-10-29 01:10:06 +01:00
Jacob Erlbeck 95bf828003 stats: Add the reporting framework
This commit provides the stats reporting framework that can manage
several types of measurement reporters. Initially support for
rate_ctr and the statsd protocol is included.

Sponsored-by: On-Waves ehf
2015-10-29 01:10:03 +01:00
Jacob Erlbeck 45513e6040 stats/vty: Add stats_vty.c
This file will contain the VTY code related to statistics.

This commit adds a minimal file with just as single VTY command:

- show stats    This command shows all statistical values

To enable this and future commands, the main program needs to call
stats_vty_add_cmds().

Sponsored-by: On-Waves ehf
2015-10-29 00:09:04 +01:00
Jacob Erlbeck 7211fe157e stat/vty: Add vty_out_statistics_full to show all statistics
This functions shows the state of all osmo_counters, stat_item
groups, and counter groups.

Sponsored-by: On-Waves ehf
2015-10-28 23:53:46 +01:00
Jacob Erlbeck e5b0fe2e3c core: Update osmo_counters_for_each doc
Fix type and add a note about the semantics of the handler's return
code.

Sponsored-by: On-Waves ehf
2015-10-28 23:53:45 +01:00
Jacob Erlbeck c6a7108828 stats: Add stat_item_for_each functions
This commit adds the following functions:

  stat_item_for_each_group     Call a handler for each group
  stat_item_for_each_item      Call a handler for each item of a
                               group

Sponsored-by: On-Waves ehf
2015-10-28 23:51:24 +01:00
Jacob Erlbeck 423c1e5a4f core: Extend rate_ctr by helper functions
For global value reporting, some additional helper functions are
needed. The statsd protocol expects differential counter values,
which are currently not provided by rate_ctr (except for s/m/h/d
intervals).

This commit adds several helper functions to rate_ctr:

- rate_ctr_difference  returns the counter delta since the last
                       call to this function for a given counter
- rate_ctr_for_each_counter
                       iterates through each counter of a group
- rate_ctr_for_each_group
                       iterates through all globally registered
                       counter groups

Note that the rate_ctr_difference function can only be used by a
single backend, since it modifies the 'previous' field in the
rate_ctr obj.

Sponsored-by: On-Waves ehf
2015-10-28 23:51:24 +01:00
Jacob Erlbeck b27b352e93 stats: Use a global index for stat item values
Currently each stat item has a separate index value which basically
counts each single value added to the item and which can be used by
a reporter to get all new values that have not been reported yet.
The drawback is, that such an index must be stored for each stat
item.

This commit introduces a global index which is incremented for each
new stat item value. This index is then stored together with the item
value. So a single stored index per reporter is sufficient to make
sure that only new values are reported.

Sponsored-by: On-Waves ehf
2015-10-28 23:51:24 +01:00
Jacob Erlbeck 0a1400fc83 ns: Add statistics for some events
The following counters are added to the ns.nsvc counter group:
  lost.alive             The number of missing ALIVE ACK messages
  lost.reset             The number of missing RESET ACK messages

The following items are added to the ns.nsvc stat item group:
  alive.delay            The time in ms between sending ALIVE and
                         receiving the next ALIVE ACK

Sponsored-by: On-Waves ehf
2015-10-28 23:51:24 +01:00
Jacob Erlbeck 738d9e2210 stats: Add vty_out_stat_item_group
This functions dumps a whole stat item group to the VTY.

Sponsored-by: On-Waves ehf
2015-10-28 23:51:12 +01:00
Jacob Erlbeck 9732cb4a92 stats: Add stat_item for value monitoring
This commit adds instrumentation function to gather measurement
and statistical values similar to counter groups.

Multiple values can be stored per item, which can be retrieved in
FIFO order. Getting values from the item does not modify its state to
allow for multiple independant backends (e.g. VTY and statd).

When a new value is set, the oldest value gets silently overwritten.
Lost values are skipped when getting values from the item.

Sponsored-by: On-Waves ehf
2015-10-28 23:51:04 +01:00
Neels Hofmeyr c84851bccc comments 2015-10-09 00:01:06 +02:00
Neels Hofmeyr 5eeb17a017 ipaccess: add OAP proto_ext (in design). 2015-09-23 23:18:15 +02:00
Harald Welte 1a8c4e05fb Introduce gsm48_mi_type_name() function 2015-08-18 19:32:33 +02:00
Harald Welte 1f6aad1c04 Add G-RNTI derived TLLI types defined in 23.003 2015-08-18 19:32:33 +02:00
Holger Hans Peter Freyther a9e5252128 vty: Change API to have node installation be done by int
We are mixing enums and hope that no short-enums are used. This
is leading to a lot compiler warnings generated by clang. Change
the API to work with integers.

Porting:
The go_parent_cb implementations in the applications need to be
fixed. The API change leads to a compile time warning.

Fixes:
abis_om2000_vty.c:46:2: warning: implicit conversion from enumeration type 'enum bsc_vty_node' to
      different enumeration type 'enum node_type' [-Wenum-conversion]
        OM2K_NODE,
        ^~~~~~~~~
2015-08-05 04:22:56 +00:00
Holger Hans Peter Freyther f558ed4bb9 ipa: Properly parse LV stream of a ID_GET request
For some reason the structure is closer to be a LV (length
and value). The value is actually a tag but it is counted
inside the length. Introduce an overload of the parse function
to provide an offset for the length. This will be taken from
the returned length.
2015-06-02 15:52:06 +02:00
Harald Welte 908085ccbc Add APN utility function to libosmogsm
The current functions are used to 'qualify' an APN from the
user-supplied APN name (name identifier) towards the fully-qualified
APN name which is used in the .grps DNS zone.
2015-05-25 11:12:16 +08:00
Jacob Erlbeck 9385d1e01b bssgp: Fix bssgp_tx_fc_bvc parameter type
Currently large values for Bmax default MS get sliced since a uint16_t is
used as the type of the corresponding parameter of bssgp_tx_fc_bvc.
GSM 48.018, 11.3.2 which in turn refers to 11.3.5 specifies a maximum
of 6MB (0xffff * 100).

This commit changes the type to uint32_t to cover the full value
range.

Sponsored-by: On-Waves ehf
2015-05-06 17:55:55 +02:00
Holger Hans Peter Freyther 780bba625d linuxlist: Remove casting of ptr from container_of macro
The cast is not present in the original macro and was added
in OpenBSC with commit (be68f6fc6cde1367a4481d2e774a64e2cd657267)
to help using the header with C++. Due the recent issue in
the bssgp flow control code, let's remove the cast to see
wrong pointer usage. In case C++ code doesn't compile anymore
we can see how to add a cast back to it.

Change was proposed by Michael McTernan
2015-05-02 07:59:00 +02:00
Holger Hans Peter Freyther 0f40ae12c8 osmo_static_assert: Put back the typedef in the code
In OSX the int declares linkage and for libosmo-abis we have
two static asserts with the same name in two different compilation
units. When adding the "unused" attribute I removed the typedef.
I verified with a gcc 4.9.2 that no new warnings will be shown
when compiling libosmo-abis.
2015-04-13 09:21:05 +02:00
Holger Hans Peter Freyther c2b4458e07 sim: Use extern for these structs to generate a linkage
Fixes:
duplicate symbol _ts102221_fcp_vals in:
    .libs/core.o
    .libs/card_fs_usim.o
duplicate symbol _pcsc_reader_ops in:
    .libs/reader.o
    .libs/card_fs_usim.o
2015-04-11 19:31:03 +02:00
Jacob Erlbeck 8d192d7153 ns: Log when sending fails (Coverity)
Currently the return value of the gprs_ns_tx family of functions is
often ignored. This is not a serious issue, since the successful
delivery of the messages is neither guaranteed nor acknowledged by
the network layer anyway.

Nevertheless this commit adds logging (level INFO) to gprs_ns_tx and
gprs_ns_msgb_alloc. The definition of the latter has been moved from
the header file to gprs_ns.c.

Fixes: Coverity CID 1040678, 1040679, 1040680, 1040681, 1040682,
   1040683, 1040684, 1040686, 1040687, 1040688, 1111545,
   1240203, 1240204
Sponsored-by: On-Waves ehf
2015-04-07 20:10:23 +02:00
Max f8699ca51e gsm: Add A5/3-4 cipher support
Signed-off-by: Max <max.suraev@fairwaves.co>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2015-03-28 18:07:05 +01:00
Holger Hans Peter Freyther 249a81b7ff endian: Be able to detect endian on GNU and BSD
On GNU __BYTE_ORDER and __LITTLE_ENDIAN is defined and
the include is "endian.h" on FreeBSD it is "sys/endian.h"
and LITTLE_ENDIAN/_LITTLE_ENDIAN and BYTE_ORDER/_BYTE_ORDER
is defined.

Create a header file that defines OSMO_IS_LITTLE_ENDIAN
and OSMO_IS_BIG_ENDIAN and can be used as

 #if OSMO_IS_LITTLE_ENDIAN
   do_little_endian
 #elif OSMO_IS_BIG_ENDIAN
   do_big_endian
 #else
   #error "Unknown endian"
 #endif
2015-03-22 09:03:42 +01:00
Jacob Erlbeck 36153dc61a bssgp: Handle BSSGP STATUS messages
Currently incoming BSSGP STATUS messages are just logged and no other
action is taken. This makes it impossible for higher layers to react
to failures which are indicated by corresponding STATUS messages
unless a timeout is triggered as a result of that failure later on.

This commit adds a bssgp_rx_status() function and calls it on
incoming STATUS messages. That function logs a message, increments the
new BSSGP_CTR_STATUS counter if the bctx context exists and invokes
an NM_STATUS status indication. The latter will allow the application
to handle failures immediately. Since all STATUS messages should be
handled, the function is already called in bssgp_rcvmsg and the
message is no longer handled in (and will not reach) bssgp_rx_sign
and bssgp_rx_ptp.

Ticket: OW#1414
Sponsored-by: On-Waves ehf
2015-03-18 21:54:37 +01:00
altaf f6a0ceb92f core/gsmtap: LTE RRC message types and LTE MAC define
Submitted-by: altaf <altaf329@gmail.com>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2015-01-18 23:16:03 +01:00
Tobias Engel 419684e30c Supplementary Services (de)activation, interrogation added
These patches enhance the Supplementary Service (SS) processing from
only being able to handle USSD to other SS, specifically activation,
deactivation and interrogation of those SS. Registration is not yet
implemented.

include/osmocom/gsm/protocol/gsm_09_02.h has been added with needed
values for SS.

Modified by Harald Welte to keep the old ussd-only functiosn for API/ABI
stability.
2015-01-01 14:19:17 +01:00
Harald Welte c13cf8bbd3 SMS-CB: introduce and use GSM341_7BIT_PADDING 2014-12-30 13:25:44 +01:00
Harald Welte 61ced83a70 SMS-CB: Add #defines for maximum block/msg size and payload chars 2014-12-30 13:18:26 +01:00
Harald Welte be4bbeb01b add missing gsm0341.h 2014-12-30 01:22:26 +01:00
Harald Welte a19717a7c5 Add Cell Broadcast MSGIDs from TS 23.041 v12.6.0 Release 12 2014-12-29 13:14:48 +01:00
Holger Hans Peter Freyther c8c33094af bitvec: Fix typo in the csn1 encoding code
We can curse about CSN.1 and 3GPP but I think we want to call
it cursor here.
2014-12-28 18:22:48 +01:00
Harald Welte 1b12d16c4c libosmo-gsm: Add PCHAN/LCHAN types for CBCH 2014-12-28 13:37:01 +01:00
Jacob Erlbeck 3cd6753a11 ipa: Add forward declaration of struct osmo_fd
A pointer to struct osmo_fd is used in a few prototypes declared in
gsm/ipa.h, but is neither declared explicitly nor is such a
declaration reachable via the given include directives.

This patch adds a forward declaration of this type to ensure proper
compilation.

Sponsored-by: On-Waves ehf
2014-12-22 14:44:52 +01:00
Holger Hans Peter Freyther 4448048828 ipa: Make a reservation for the GSUP protocol
GSUP is a protocol to have the OpenBSC SGSN talk
to an exterbal system for 3GPP MAP connectivity.
2014-12-14 19:01:14 +01:00
Holger Hans Peter Freyther 2d6ad13d8d logging: Make it possible to print category/subsys and timestamps
We want to see from which category/subsystem a certain log message
is coming from and use a different timestamp format as well. Add
two new bitfields. This doesn't change the size of the structure
and on 32bit we still have 27bits left.

The extended timestamp will take preference over the current and
default timestamp format.

Fixes: SYS#602
2014-12-05 10:23:28 +01:00
Holger Hans Peter Freyther a5dc19dc40 gtp: Add a global region for the gtp library of OpenGGSN
We want to use libosmocore/libosmovty in the GGSN sourcecode
and reserve a global region here.
2014-12-04 14:39:14 +01:00
Holger Hans Peter Freyther 9f0f978c8d vty: Check with the application before writing the config
For the BSC/NITB application we see that people modify the band
without modifying the ARFCN. This creates an unbootable config.
Using the new hook the BSC/NITB can check if the config is
consistent and prevent the config file being written.

Related: SYS#739
2014-12-04 14:39:14 +01:00
Harald Welte 7b74dda31b remove references to u_char type, use 'unsigned char' instead
... u_char not being defined on Nuttx.
2014-11-14 15:22:14 +01:00
Harald Welte 33e940b862 sttrb / loggingrb: Use GPLv2+ as license, not AGPLv3+
according to Holger, using AGPLv3+ at the time was a mistake and the
license should always have indicated GPLv2+.
2014-10-26 20:52:25 +01:00
Harald Welte 7fa89c2e88 Change license of libosmogb from AGPLv3+ to GPLv2+
The copyright holders Harald Welte, Holger Freyther, Andreas Eversberg
and sysmocom - s.f.m.c. GmbH (represented by Holger and Harald) agree
that the license of libosmogb should be GPLv2+ and not AGPLv3+.

The reason the source files stated AGPLv3+ is due to the history, as
they were moved from OpenBSC to libosmocore at the time we needed to use
them from osmo-pcu.  It was an oversight back then to not re-license
them accordingly.
2014-10-26 20:50:19 +01:00
Harald Welte 6729a9776a make sure to register DF.TELECOM and DF.GSM for SIM, USIM + TSIM
before we only did it partially, and by exporting data from sim,
rather than the new osim_int_cprof_add_{gsm,telecom}() functions.
2014-10-26 19:50:55 +01:00
Harald Welte 67354b1b4e sim: add missing const to reader_ops member of reader_handle 2014-10-26 19:50:55 +01:00
Harald Welte 55790aa09a sim: Prepare infrastructure for protocols != T=0 and other drivers 2014-10-26 19:50:51 +01:00
Harald Welte 586d710e05 sim: More comments in sim.h 2014-10-26 19:09:24 +01:00
Harald Welte aad7e0664b sim: Make TETRA SIM (TSIM) support compile 2014-10-26 19:09:24 +01:00
Harald Welte e8dd2bd4b5 sim: mark osim_msgb_cb as __may_alias__ to avoid gcc warnings 2014-10-26 19:09:23 +01:00
Harald Welte 2656e65bed sim: Add sfi to EF_*() macros 2014-10-26 19:09:23 +01:00
Harald Welte 1e0dfdad69 sim: Add minimal/recommended size of file / record 2014-10-26 19:09:23 +01:00
Harald Welte d83d29610a sim: further updates/fixes 2014-10-26 19:09:23 +01:00
Harald Welte 7674960ffa sim: add decoding of status words 2014-10-26 19:09:23 +01:00
Kevin Redon 43eabeeeaa sim: replaced function/structure comments with doxygen comments
affected files: sim.h, sim/core.c
affected funtions/strucutres: osim_new_apdumsg, osim_apdu_case,osim_apdu_cmd_hdr, osim_msgb_cb
2014-10-26 19:09:23 +01:00
Kevin Redon dede831fcd sim: add comment/explaination for structure osim_msgb_cb 2014-10-26 19:09:23 +01:00
Kevin Redon 1707306da5 sim: add comment/explaination for structure osim_apdu_cmd_hdr 2014-10-26 19:09:23 +01:00
Kevin Redon e07967f689 sim: renamed case to the one defined in ISO7816-3
APDU_CASE_2 becomes APDU_CASE_2S
APDU_CASE_2_EXT becmoes APDU_CASE_2E
APDU_CASE_3 becomes APDU_CASE_3S
APDU_CASE_3_EXT becmoes APDU_CASE_3E
APDU_CASE_4 becomes APDU_CASE_4S
APDU_CASE_4_EXT becmoes APDU_CASE_4E
2014-10-26 19:09:23 +01:00
Kevin Redon 6956ee1ba1 sim: add comment/explaination for structure osim_apdu_case 2014-10-26 19:09:22 +01:00
Harald Welte d54c2ee8c5 initial checkin of 'libosmosim' 2014-10-26 19:09:22 +01:00
Harald Welte cac3cd6fcd msgb: make msgb_get() finally work as expected 2014-10-26 19:08:43 +01:00
Jacob Erlbeck 0540d839ac gprs-ns: Let gprs_nsvc_reset return a value
Currently gprs_nsvc_reset does not return any value.

This patch changes the function to return an integer, where a value
less than zero indicates an error. The value is taken from the
gprs_ns_tx_reset function. In case of failure, an error message is logged.

Sponsored-by: On-Waves ehf
2014-10-09 07:47:20 +02:00
Harald Welte fb84f325b8 logging: Add ability to save/print current log filters
This enables the persistent configuration of let's say
'log filter imsi 012345678' for a given log file in the config
file.
2014-08-25 10:09:42 +02:00
Harald Welte 276ca4b172 gsm48.h: define the reserved TMSI in libosmocore, not openbsc 2014-08-24 17:35:19 +02:00
Harald Welte f39aed6942 add port number 4238 for BTS control interface 2014-08-24 16:52:54 +02:00
Harald Welte 39c9e7b471 libctrl: Add support for 'deferred control commands'
Sometimes a control interface command cannot be processed
and responded immediately, but we need to process it asynchronously.

In order to support this, we introduce the 'ctrl_cmd_def', which
represents such a deferred command.  It is created by the service
implementing the command using ctrl_cmd_def_make(), and a response is
later sent using ctrl_cmd_def_send().

ctrl_cmd_def_is_zombie() must be called to handle the case where
the control connection has disconnected/died between receiving the
command and sending the response.
2014-08-24 16:52:54 +02:00
Harald Welte 5ddd435919 Convert recently-introduced header files to #pragma once 2014-08-21 15:42:44 +02:00
Harald Welte c7947ed1f6 New <osmocom/ctrl/ports.h> file listing tcp ports for CTRL interface 2014-08-21 15:34:19 +02:00
Harald Welte ae2fcb22cf rename controlif_setup() to ctrl_interface_setup()
which means that all control interface related functions now have
the common ctrl_ prefix.
2014-08-21 15:34:19 +02:00
Harald Welte 528134b01c libctrl: Move bulk of control node lookup inti libosmoctrl
The control interface user now only has to register a very short
node lookup function callback.  This function is optional, and only
required if hierarchical command lookup should be supported.
2014-08-21 15:34:18 +02:00
Harald Welte c78e74e3d0 libctrl: remove 'struct gsm_network' references
libctrl doesn't need any knowledge about the type of the user-private
data that it gets passed upon setup time and includes on callbacks.
2014-08-21 15:34:18 +02:00
Harald Welte d8db92c578 libctrl: remove bsc-specific declaration
this was moved by accident when importing the code from openbsc.
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
libosmocore.
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 dda4225153 libctr: rename/move control interface to libosmocore naming scheme 2014-08-21 15:34:17 +02:00
Harald Welte 28570a4e62 new <osmocom/vty/ports.h> file listing VTY tcp ports
imported from http://openbsc.osmocom.org/trac/wiki/PortNumbers
2014-08-21 15:34:11 +02:00
Harald Welte e391996947 ipa: rename functions for consistency
As we are breaking builds by moving functions from libosmo-abis to
libosmocore anyway, we might as well give functions more appropriate
names.  ipaccess is a company, while IPA is the multiplex protocol, and
CCM is the protocol used for establishing identities on the IPA
multiplex.
2014-08-20 23:16:36 +02:00
Harald Welte 28aa991c2f import various generic IPA related functions from libosmo-abis
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:16:34 +02:00
Harald Welte fe3e42bdcb Add osmo_get_macaddr() function to obtain etherent mac address
This used to be private in osmo-bts/common/abis.c, where it really
didn't belong.
2014-08-18 19:19:45 +02:00
Harald Welte 40d56f96b9 osmocore: Add function osmo_macaddr_parse() to parse ETH MAC address 2014-08-18 19:03:40 +02:00
Harald Welte cc27fa6479 TLV: add TLVP_PRES_LEN() definition to check for existance + minimum length
This is an import from osmo-bts where it was introduced in
6b561bb7ba5f10c5fd96542a7e42de2822352a67
2014-08-18 15:31:04 +02:00
Harald Welte 900e180f91 ipaccess.h: Add IPAC_PROTO_EXT_ORC for OML Router Control 2014-08-18 11:34:17 +02:00
Harald Welte 8d5180e003 abis_nm: add abis_nm_msg_disc_names[] value_string 2014-08-17 19:36:26 +02:00
Harald Welte 604d552e49 abis_nm: introduce abis_nm_{osmo,ipa}_magic[]
... used to be oml_{osmo,ipa}_magic in osmo-bts
2014-08-17 18:42:58 +02:00
Harald Welte 92107dfd3b update TS 08.08 header + TLV definitions to TS 48.008 / 11.7.0
This adds support for A-over-IP and LCLS related message/IEI
definitions.

Old definitions are in decimal, which is very hard (at least for me)
to compare with the binary tables in the spec.  Hex is much easier
to manually compare for completeness/correctness.  I didn't touch
the existing definitions, but think they should move to hex, too.
2014-06-21 23:16:20 +02:00
Harald Welte c8585cf408 update gsm_08_08.h to Release 11 2014-06-21 22:28:12 +02:00
Sylvain Munaut 5469ef837a core/bitXXgen: Don't do 'return' in functions returning void
ISO C forbids 'return' with expression, in function returning void

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-06-16 16:39:08 +02:00
Sylvain Munaut 3baa0d6ab5 core/bitXXgen: Use explicit cast of void* to uint8_t
Turns out we use this header in C++ code ...

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-06-16 16:38:31 +02:00
Sylvain Munaut 579a7103a1 gsm: Add Kasumi cipher implementation
Submitted-by: Max <max.suraev@fairwaves.co>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-06-16 14:59:30 +02:00
Max e2c1390d1b bits: Add left circular shift function
Submitted-by: Max <max.suraev@fairwaves.co>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-06-16 14:36:37 +02:00
Max 5377701746 core: Add generic LE/BE load/store uint type convertors and use them in msgb
Submitted-by: Max <max.suraev@fairwaves.co>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-06-16 14:33:27 +02:00
Sylvain Munaut 12ba778afd include: Switch to #pragma once pattern
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-06-16 10:17:27 +02:00
Max b0a3c2f1de gsmtap: add LTE defines to GSMTAP v2
Submitted-by: Max <max.suraev@fairwaves.co>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-06-15 18:52:55 +02:00
Álvaro Neira Ayuso 550b06c04c abis_nm: Add the abis_nm_osmo_att_tlvdef to the abis header
Avoid compiler warnings and declare the presence of the new
tlv_description.

Signed-off-by: Alvaro Neira Ayuso <anayuso@sysmocom.de>
2014-05-20 08:45:59 +02:00
Harald Welte 5b5650f3de Fix introducing osmocom speficic OML attributes
Rename NM_ATT_O_REDUCEPOWER to NM_ATT_OSMO_REDUCEPOWER, which
makes it more clear that this is an osmcoom specific attribute.

Also, we cannot simply overload 0x01 as an already defined OML
attribute.  The problem is quite simple: When we use abis_nm_att_tlvdef
during the TLV parse, 0x01 will match to NM_ATT_ABIS_CHANNEL,
which is defined as { TLV_TYPE_FIXED, 3 }.

So instead, we need to introduce a new abis_nm_osmo_att_tlvdef[],
which has to be patched into abis_nm_att_tlvdef[] by the means of
tlv_def_patch(), exactly how we do it for bs-11 and nanobts specific
attributes.

I'm using 0xfe for the attribute, as 0xfe doesn't overlap with the IPA
specific attribues (and we might want to combine/merge the 12.21 plus
IPA plus osmocom spefici attributes)
2014-05-19 11:25:46 +02:00
Álvaro Neira Ayuso c22d72cded protocol/gsm_12_21.h: Add the Manufacturer Attribute ID O_REDUCEPOWER.
Signed-off-by: Alvaro Neira Ayuso <anayuso@sysmocom.de>
2014-05-15 21:40:59 +02:00
Álvaro Neira Ayuso 5ade61a4f4 src/socket: Adding unix domain socket support
Added some function for adding the unix domain socket support.

Signed-off-by: Alvaro Neira Ayuso <anayuso@sysmocom.de>
2014-03-26 19:50:46 +01:00
Daniel Willmann 3dc4e16786 gsm/lapdm: Prevent LAPD tx_queue from filling up in polling mode
If LAPDm receives an I-Frame while there already is an I-Frame in the
tx_queue the code generates an additional RR (to acknowledge the
received I-Frame). Instead, N(R) of the I-Frame in the tx_queue should
be updated to ACK the data.
2014-03-26 18:11:07 +01:00
Daniel Willmann 55405fb40b lapdm: Make lapdm_datalink_for_sapi public
This API allows you to get the lapdm_datalink for a SAPI. It's needed in
the lapdm_test, so make it public.
2014-03-26 13:52:27 +01:00
Alexander Chemeris e47523874d sms: Fix typo in a macros name: GSM340_SMS_RESSERVED -> GSM340_SMS_RESERVED. 2014-03-12 13:33:01 +01:00
Jacob Erlbeck 8dac4159ad ladpm: Fix msgb handling and SAPI=3 establishment delay
Currently it takes 3s to establish a SAPI 3 SACCH connection with
osmo-bts. This is due to the fact, that a broken SABME request is
sent first and and is ignored by the MS. Then, after a T200 timeout
(2s) the SABME command is sent again (this time correctly) and
answered by the MS.

The first SABME message is broken (it has a length field of 3 and
ends with 3 bytes from the tail of the original RSL message),
because of it is expected throughout lapdm.c that msg buffers
containing RSL have msg->l2h == msg->data. Some abis input drivers
fulfill this but IPA doesn't, thus the 3 bytes of the IPA header
are still part of the msg and confuse length computation.

Since internal fields of the msg are modified directly, this is
difficult to see.

This patch adds a new function msgb_pull_to_l3() that explicitely
skips over all headers prepending L3 and therefore resets l1h and
l2h. This function is then used instead of msgb_pull_l2h() which
only worked correctly when msg->l2h == msg->data. In addition,
code manipulating msg->tail and msg->len directly has been replaced
by calls to msgb_trim().

Note that this patch does not fix all issues of this case in the LADP
related code.

Ticket: SYS#192
Sponsored-by: On-Waves ehf
2014-03-10 14:57:26 +01:00
Jacob Erlbeck baa225ed86 msgb: Add msgb_hexdump() function
This function works like osmo_hexdump() and returns a static buffer
containing hex bytes along with markers for the layers.

Note that it uses osmo_hexdump() internally, thus a call to
msgb_hexdump() invalidates the buffer that has been returned by an
earlier call to osmo_hexdump(). In short: don't mix them in a single
call printf().

Sponsored-by: On-Waves ehf
2014-03-04 13:30:12 +01:00
Jacob Erlbeck 26cbd459fc sms: Fix gsm_7bit legacy functions return value
The legacy 7bit conversion functions (those without the '_n_' in the
name) gave wrong return values on 64 bit platforms due to unproper
signed/unsigned conversions and the usage of SIZE_MAX.

This patch fixes this by using a smaller max size (see
GSM_7BIT_LEGACY_MAX_BUFFER_SIZE, currently set to 64k) for the legacy
wrappers and by using unsigned int for max_septets.
In addition, there are tests now that check the return values of
legacy encoding and decoding.

Sponsored-by: On-Waves ehf
2014-01-09 08:22:14 +01:00
Holger Hans Peter Freyther d4d87c5427 abis: Use the right return value for abis_nm_pchan4chcomb
abis_nm_pchan4chcomb will return a pchan for a given channel
combination but returned a value of the channel combination.

Fix it to return the physical channel combination.

Fixes: Coverity CID 1040767
2014-01-02 14:10:25 +01:00
Max 4f0abc0e3e Refactor COMP128v23 implementation and add test suit 2013-12-07 18:10:38 +01:00
Kevin Redon be355cd78a implement COMP128 version 2 and 3 A3/A8 algorithm
simple copy into C from reversed code from www.hackingprojects.net
2013-11-03 15:05:25 +01:00
Jacob Erlbeck 5405a104bb gb: Fix NS RESET/RESET_ACK abnormal cases
This changes the implementations for the reception of RESET and
RESET_ACK to be compatible with 3GPP TS 08.16, 7.3.1:

- Just send a RESET_ACK with correct values back to the SGSN when a
  RESET with an invalid NSVCI or NSEI has been received.
- Check RESET_ACK for matching NSEI and NSVCI.
- Ignore unexpected RESET_ACKs.

In addition, use RESET_ACK from a BSS to update the BSS source
address based on the NSVCI to be tolerant with changing UDP source
addresses/ports.

Sponsored-by: On-Waves ehf
2013-10-24 10:01:18 +02:00
Jacob Erlbeck 5e6d679df3 gb: Fix gprs_ns_rx_reset to not create NS-VC duplicates
Under special circumstances (see below) receiving a NS-RESET leads to
duplicated NS-VC entries.

This happens when the source port of a NS-VC changes to a new one
that has already been used by another NS-VC.

This patch changes gprs_ns_rx_reset() to check for this case and to
use the existing NS-VC object. The NS-VC object that was associated
with the source address before is detached from this source but kept
in the NS-VC list so that it can be reattached when a correspondent
NS-RESET is received later on. Meanwhile it will have a cleared link
layer address which will not match a real link info.

A new counter NS_CTR_REPLACED is incremented each time when the NS-VC
object is replacing another one. A new signal S_NS_REPLACED is added
which gets dispatched in this case, too.

Another new counter NS_CTR_NSEI_CHG is incremented each time when the
NSEI of a NS-VC object (with fixed NSVCI) changes.

Ticket: OW#874
Sponsored-by: On-Waves ehf
2013-10-15 10:20:34 +02:00
Jacob Erlbeck 96550e0321 gb: Add functions to access the LL part of the NS-VC objects
Adds the functions gprs_ns_ll_copy() and gprs_ns_ll_clear(). Renames
gprs_ns_format_peer() to gprs_ns_ll_str(). All of these functions
uniformly access the link layer part within the NS-VC objects.

Sponsored-by: On-Waves ehf
2013-10-15 09:48:41 +02:00
Jacob Erlbeck 34fc4701c7 tests/gb: Show invoked signals in test output
Register an osmo signal handler to print a short notice about every
SS_L_NS signal that is generated while processing the tests.

Sponsored-by: On-Waves ehf
2013-10-11 14:41:40 +02:00
Holger Hans Peter Freyther 2c9168cf34 vty: Make vty_event dispatch signals and use it in the testcase
The testcase didn't work on Ubuntu 12.04 because vty_create will
directly call vty_event (e.g. not through the plt). This means
that the approach to override vty_event in the testcase failed.

Use the signal interface of libosmocore and make the testcase
use it. The signals can be generally useful as well.
2013-10-10 20:21:33 +02:00
Jacob Erlbeck 84cdc70e0b gb: Separate nsvc creation from NS message processing
This patch refactors gprs_ns_rcvmsg() by moving the parts relevant to
the NS messages into the new functions gprs_ns_vc_create() (nsvc
object creation) and gprs_ns_process_msg() (main NS automaton). These
do not contain code that directly depends on the link layer (they
call other functions that still do). This reduces the gprs_ns_rcvmsg()
function to calling these two functions and optionally setting up the
link layer specific fields of the nsvc.

Sponsored-by: On-Waves ehf
2013-10-08 14:50:46 +02:00
Jacob Erlbeck 42e0dc0cc3 msgb: Add may_alias attribute to struct libgb_msgb_cb
This explicitely allows aliasing of this struct to avoid the warning
shown below. Note, that this warning isn't show when
'-fno-strict-aliasing' is used.

Addresses:
gb/gprs_ns_test.c:85:54: warning: dereferencing type-punned pointer will
break strict-aliasing rules [-Wstrict-aliasing]
2013-10-08 14:00:24 +02:00
Jacob Erlbeck 1c3f088c1f gsm48: Added 'Network Daylight Saving Time' info element
This information element has been added to the MM Information
message in GSM24.008. This patch adds it to the tlv_definition
to keep the TLV parser from breaking.

Ticket: OW#978
2013-09-16 14:11:36 +02:00
Jacob Erlbeck 0c987bd83b vty: Add vty_install_default() and use for the vty nodes
This adds the vty_install_default() function that is basically the
install_default() function plus the registration of the commands
'exit' and 'end'. The latter is only provided in subnodes of
ENABLED_NODE and CONFIG_NONE.

The VTY test program is extended to check these commands.

Ticket: OW#952
2013-09-08 10:49:52 +02:00
Holger Hans Peter Freyther 6145a2569f misc: Include time.h for time_t on FreeBSD
Fix the build after I changed the order of header files in the
SMS test.
2013-09-04 12:12:58 +02:00
Holger Hans Peter Freyther 4d7e49bc0a sms: Implement encoding the address as alphanumeric type
The number of digits is the number of used octets times two (two
digits per octet). The result has been successfully dissected by
wireshark. It has not been tested with real phones.
2013-09-04 10:41:07 +02:00
Jacob Erlbeck c4cc924074 core: Remove defined() check for OSMO_DEPRECATE
This reverts commit bf991bc0f3 and
fixes the bug instead. It's just sufficient to remove the defined()
test, since identifiers that aren't macros are just considered as
0 when used with #if. (see cpp info page, section 4.2.2 'If'
in cpp-4.6.info)
2013-08-15 15:48:26 +02:00
Holger Hans Peter Freyther bf991bc0f3 core: Fix-up the OSMO_DEPRECATED for older compilers
The code started to use #if defined(...) but the value was always
for GCC/Clang. The only difference was that for older compilers
the value of the definition was 0. Conditionally define these
macros.
2013-08-14 20:40:31 +02:00
Jacob Erlbeck 3f74d9e767 core: Support clang with OSME_DEPRECATED
Separate feature checking from implementation. Supported are clang and
gcc.
2013-08-14 18:25:09 +02:00
Jacob Erlbeck 6b2621883f core: Move OSMO_DEPRECATED to new core/defs.h file
Add a new core/defs.h file for definitions that can be used from
within header files without including prototypes and extern
declarations. It's primarily meant for macro definitions and basic
typedefs.

Move the definition of OSMO_DEPRECATED there and use compiler version
info to avoid compiler errors.
2013-08-14 15:31:38 +02:00
Jacob Erlbeck 3f69ceb3a4 sms: Disable deprecated message
This is a workaround to make the FreeBSD8.4 and Debian6.0 target
build again. The deprecated attribute doesn't have arguments.
2013-08-12 18:46:25 +02:00
Jacob Erlbeck 1d7f3b5eb2 sms: Added result buffer size parameter to 7bit conv funs
The 7bit<->8bit encoding/decoding functions didn't check whether
there is still enough space in the destination buffer. Therefore a
buffer size parameter has been added to each of the functions which
is used to truncate the output if the buffer is too small.

In addition, the return value of the decoding functions has been
changed to number of characters written (excluding \0), so this
value is always equal to strlen(decoded).

The old functions are still available as wrapper functions.
2013-08-12 17:22:27 +02:00
Andreas Eversberg 9597555a36 Add special 7-bit encoding and decoding functions for USSD coding
Handling 7-bit coding is a little different for USSD, as TS 03.38
states:

To avoid the situation where the receiving entity confuses 7 binary
zero pad bits as the @ character, the carriage return or <CR>
character shall be used for padding in this situation [...].

If <CR> is intended to be the last character and the message
(including the wanted <CR>) ends on an octet boundary, then another
<CR> must be added together with a padding bit 0. The receiving entity
will perform the carriage return function twice, but this will not
result in misoperation as the definition of <CR> [...] is identical to
the definition of <CR><CR>.

The receiving entity shall remove the final <CR> character where the
message ends on an octet boundary with <CR> as the last character.

Jacob has verified the fix with fakeBTS and the wireshark dissector.

Fixes: OW#947
Reviewed-by: Jacob Erlbeck <jerlbeck@sysmocom.de>
2013-08-08 14:27:13 +02:00
Holger Hans Peter Freyther 6bfa7445fc encoding: Provide an overload for the gsm_7bit_encode and a simple test
This is required for encoding the SMS header using the alpha numeric
rules.

Reviewed-by: Jacob Erlbeck <jerlbeck@sysmocom.de>
2013-08-08 14:25:09 +02:00
Holger Hans Peter Freyther 94b2f64ae7 gsm: Try to clarify why we have gsm_septet_encode in the header file
These functions are not meant to be used by applications and are
only here for the unit tests. Try to document that.
2013-08-07 11:10:57 +02:00
Harald Welte b8add369e3 utils.h: we need to include utils.h for osmo_generate_backtrace()
this causes compiler warnings in user code ever since commit
55cf02221f
2013-07-06 23:50:36 +02:00
Holger Hans Peter Freyther c62a1bf4d5 libosmogb: Add function to close NS instance without destroying it 2013-07-06 23:36:16 +02:00
Andreas Eversberg c8cac64abb Fix RR cause values 2013-07-06 23:36:16 +02:00
Andreas Eversberg 610517c8bd Add chan_nr to RACH info at L1SAP interface
The chan_nr is required to locate timeslot and subslot of access bursts
during handover procedure.
2013-07-06 23:36:15 +02:00
Andreas Eversberg 15b8057085 Add RSSI to l1sap 2013-07-06 23:36:15 +02:00
Andreas Eversberg 227a9de51e Add MPH and TCH primitives to layer 1 SAP
In order to control layer 1 via primitives, MPH primitives are required.
There is only one (MPH-INFO) primitive defined in TS 04.04 for all control
and measurement functions. A type identifier inside this primitive is used
to differentiate between different functions.

The TCH primitives are used to carry traffic. TCH primitives carry voice
or data traffic, whereas PH-DATA primitives carry FACCH data.

PH_RTS and TCH_RTS (ready-to-send) primitives are used to poll requests
from upper layers.
2013-07-06 23:36:15 +02:00
Andreas Eversberg aa85a2d4b4 Remove osmo_phsap_prim from lapdm.h and move to a seperate header file 2013-07-06 23:36:15 +02:00
Holger Hans Peter Freyther b3b955bef2 misc: Fix compiler warnings about the static_assert macro with gcc 4.8
The modified macro is still working on a gcc 4.7 and gcc 4.8 after the
removal of the typedef and addition of the unused attribute.

include/osmocom/core/msgb.h: In function ‘msgb_alloc_headroom’:
include/osmocom/core/utils.h:40:51: warning: typedef ‘dummyheadroom_bigger’ locally defined but not used [-Wunused-local-typedefs]
 #define osmo_static_assert(exp, name) typedef int dummy##name [(exp) ? 1 : -1];
                                                   ^
include/osmocom/core/msgb.h:386:2: note: in expansion of macro ‘osmo_static_assert’
  osmo_static_assert(size > headroom, headroom_bigger);
  ^
2013-07-01 09:33:07 +02:00
Harald Welte a62fe31d69 introduce gsm0808_create_reset_ack() 2013-06-29 10:53:33 +02:00
Bhaskar e6b45d8164 gsm_04_08.h: GSM48_MT_RR_VGCS_UPL_GRANT value corrected 2013-05-23 07:57:27 +02:00
Bhaskar 31e844bfe2 gsm_04_08.h: Fix GSM48_CMODE_DATA_3k6 as per 3GPP TS 04.08 / 10.5.2.6. 2013-05-23 07:56:34 +02:00
Bhaskar 6b30f925e2 gsm_utils: refer to ETSI TS 05.08 instead of TS 08.05 2013-05-23 07:53:57 +02:00
Holger Hans Peter Freyther 2c3393d9e3 gprs_ns: Allow to set the DSCP for the UDP socket.
Allow to tag the NS service with a custom DSCP.
2013-03-25 12:06:36 +01:00
Katerina Barone-Adesi 55cf02221f utils: Use fprintf to print the assertion and generate a backtrace
This is changing the semantic of the assert. The regression tests
now either need to check the stderr result, the exit status or print
a message when all tests are completed.

This is not that bad as the osmo_generate_backtrace is printing to
the stdout right now.
2013-03-25 12:06:15 +01:00
Harald Welte 4de854dcf0 logging: add new log_targets_reopen() function
This function will re-open all existing log files in the application,
praticularly useful for SIGHUP handlers in case of logrotate
2013-03-18 19:05:46 +01:00
Harald Welte e128f46631 add new gsm/meas_rep.h file for shared/common measurement report stuff 2013-03-13 15:16:48 +01:00
Harald Welte 533f63f15a Add smpp34_osmocom.h for Osmocom SMPP vendor additions 2013-03-13 15:16:48 +01:00
Harald Welte ca69388be8 gsm_septets2octets(): Input parameter should be const 2013-03-13 15:16:47 +01:00
Katerina Barone-Adesi 008e53baae utils: Introduce OSMO_ASSERT in the utils and use it in the unit tests
The tests should unconditionally assert, regardless of debug settings.
This uses the OSMO_ prefix as it's in the global namespace.
2013-03-09 23:52:29 +01:00
Katerina Barone-Adesi 3309a43ef5 Added a ring buffer log target to store the last N log messages.
The log target can be used via log alarms and show alarms.
Why? This feature was proposed/requested at
http://openbsc.osmocom.org/trac/wiki/Tasks/ErrorLogTarget
All messages use the same amount of space, prioritizing simplicity.
2013-02-27 15:13:45 +01:00
Holger Hans Peter Freyther efd2bd691f Revert "Added a ring buffer log target to store the last N log messages."
I noticed some more issues and it is the easiest to revert and include
the fixed version.

This reverts commit 73377229bb.
2013-02-27 14:51:33 +01:00
Katerina Barone-Adesi 73377229bb Added a ring buffer log target to store the last N log messages.
The log target can be used via log alarms and show alarms.
Why? This feature was proposed/requested at
http://openbsc.osmocom.org/trac/wiki/Tasks/ErrorLogTarget
All messages use the same amount of space, prioritizing simplicity.
2013-02-27 14:45:48 +01:00
Tobias Engel 24e5e05b6f Add UMTS RRC message types 2013-02-21 11:17:10 +01:00
Katerina Barone-Adesi c28c6a02d2 misc: Doxygen tweaks: fixed some typos and minor errors
Doxygen generates quite a lot of warnings on libosmocore. Some of them
are obvious typos - this patch aims to fix such low-hanging fruit.
2013-02-15 13:27:59 +01:00
Harald Welte 647e39f172 abis_nm: add parenthesis for new abis_nm_debugp_foh() macro
without this, we break e.g. the openbsc build...
2013-02-10 17:02:18 +01:00
Harald Welte 868a5c4782 turn abis_nm_debugp_foh() into a macro
this will avoid printing 'abis_nm.c' as the filename in the log, which
is pretty useless during debugging.  We want to know where
abis_nm_debugp_foh() is being used from, not where it is implemented.
2013-02-10 09:30:28 +01:00
Andreas Eversberg 0167596c2b Add tlvp_val16_unal() / tlvp_val32_unal() to align 16 and 32 bit values
This is required for CPUs < armv6, to access 16 and 32 values at right
memory locations.
2012-12-18 23:47:45 +01:00
Sylvain Munaut 5572031749 gsm: Add method to find ARFCN based on frequency
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2012-12-11 23:44:41 +01:00
Holger Hans Peter Freyther 0357e9b375 rsl: Add the 9.3.20 release mode enum to be used in OpenBSC 2012-12-06 11:58:33 +01:00
Sylvain Munaut c1e9be95c2 gsm/a5: Return -ENOTSUP if the selected cipher is not supported
Extracted from a patch by Max Suraev Max.Suraev@fairwaves.ru>

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2012-12-06 08:23:02 +01:00
Holger Hans Peter Freyther bcf125c524 smr: Introduce an id and prefix all log messages with SMR(ID)
When OpenBSC is handling more than one message at a time it is difficult
to see which log message belongs to which SMR instance. Introduce a
uint64_t id that can be set to the row_id/message_id and prefix all
log messages with SMR(ID).

This change is ABI and API incompatible with previous versions of
libosmogsm.
2012-11-22 00:41:50 +01:00
Holger Hans Peter Freyther 33e8a87cd7 smc: Introduce an id and prefix all log messages with SMC(ID)
When OpenBSC is handling more than one message at a time it is difficult
to see which log message belongs to which SMC. Introduce a uint64_t id
that can be set to the row_id/message_id and prefix all log messages
with SMC(ID).

This change is ABI and API incompatible with previous versions of
libosmogsm.

Example:
SMC(100) instance created
SMC(100) message MNSMS-EST-REQ received in state IDLE
2012-11-22 00:41:49 +01:00
Steve Markgraf 5905d5be60 msgb: fix msgb_pull_u*()
msgb_pull returns a pointer to the new begin of the
buffer, unlike msgb_get(), where those functions
were originally taken from.

Signed-off-by: Steve Markgraf <steve@steve-m.de>
2012-11-14 20:14:33 +01:00
Holger Hans Peter Freyther d38e0ef82a smc: Make it possible to include gsm0411_smc.h as first header file
The code embeds the timer so one needs to include the header file.
2012-11-14 17:20:33 +01:00
Tobias Engel 6ad25f290e Add "extern" keywords
Without the "extern" keyword the variables in this header file will be
seen as empty definitions when compiled on OSX.
2012-10-27 10:03:12 +02:00
Harald Welte 8ec7f901bb logging: Make sure to install standard "end" command in VTY node
When you are in the config-log VTY node, you expect "end" to work
like in any other sub-node of config.
2012-10-22 19:43:26 +02:00
Andreas Eversberg f44ed8cf92 Fix: Correcting bssgp_tx_fc_bvc, bssgp_tx_fc_ms, bssgp_tx_ul_ud 2012-09-30 14:38:20 +02:00
Holger Hans Peter Freyther 7c7d39adac vty: Include osmocom/core/utils.h for the value_string struct 2012-09-11 12:27:03 +02:00
Holger Hans Peter Freyther db1533651f logging: Introduce a print_filename flag for the logtarget
Introduce a print_filename attribute for each logtarget. Initialize it
with 1 to be backward compatible with earlier versions. The bit is taken
from an existint bitfield. There were at least six bits left of the byte.
2012-09-11 11:24:51 +02:00
Holger Hans Peter Freyther 06f645542c logging: Mark the log_info_cat pointer as consts
Applications should keep the log area in a static const area. Mark
the pointer as const to address compiler warnings in OpenBSC, cast
the const away for the osmo_log_info as it is not declared as const.
2012-09-11 10:31:29 +02:00
Harald Welte e92866bbb1 Gb: Add functions for sending flow control messages from BSS side 2012-09-10 08:56:04 +02:00
Harald Welte 30fabdf61d Gb: Add header file for BSS-side BSSGP functions
.. not sure how we could have missed that so far.
2012-09-10 08:54:35 +02:00
Harald Welte 972b502eca msgb: msgb_get() is supposed to get bytes from END, msgb_pull() from HEAD
msgb_get() has been wrong all the time, despite the documentation being
correct.  If you've used the broken msgb_get() before, you have to
change your code now, sorry.
2012-09-08 20:01:00 +02:00
Harald Welte d8b476988d BSSGP: make bvc_ctx->fc a dynamic talloc allocation
this ensures that we can talloc the flow-control queue entries
as siblings off the bvc_ctx.
2012-09-07 12:07:54 +02:00
Harald Welte bb8262275f BSSGP flow-control: various fixes
* add more comments on units of struct members
* make sure to parsre FC-BVC message correctly
* add error message in case user passes PDU larger than bucket size
* add new function to initialize flow control struct
2012-09-07 12:07:54 +02:00
Harald Welte d11c059502 libosmogb: Port BSSGP flow control from openbsc/laforge/bssgp_fc branch
This code is supposed to implement the BSSGP flow control algorithm,
both for the per-BSS and for the per-MS flow control.

The code currently has no test cases, they will come in a separate
commit.
2012-09-07 12:07:54 +02:00
Harald Welte 1f87d75b7a USSD: text is 'char' not uint8_t 2012-09-07 12:07:10 +02:00
Harald Welte a102b63c28 gsmtap: add minimal support for encapsulating UMTS RRC in GSMTAP 2012-09-02 14:07:57 +02:00
Harald Welte 30a8ec466c GSM 04.08: Add 'enum gsm48_bcap_speech_ver' 2012-08-24 23:00:05 +02:00
Harald Welte c8a0b93939 GSM 04.08: Add support for parsing CSD related bearer capabilities
Also adds a test case for both encoder and decoder of this IE
2012-08-24 21:37:59 +02:00
Harald Welte eed26116c9 GSM 08.58: Add channel modes for transparent data services 2012-08-24 15:36:12 +02:00
Harald Welte fab0ae9b43 import vty_cmd_string_from_valstr() from osmo-bts
This function is able to generate a VTY help string based on an
array of 'struct value_string'.
2012-08-20 18:43:09 +02:00
Holger Hans Peter Freyther 08b286277b utils: Change semantic of OSMO_MAX/OSMO_MIN to match semantic of a function
Add parentheses around the OSMO_MAX and OSMO_MIN macro to match
the behaviour of calling a function. The current version does not
evaluate to what is expected. (OSMO_MAX(3, 2) + 13)  currently
results in 3 and not 16.
2012-08-15 17:08:21 +02:00
Holger Hans Peter Freyther d296f4244f gb: Make suspend_ref a plain uint8_t instead of a uint8_t*
The OpenSUSE build is not happy about the uint8_t to uint8_t*
assignment. As the suspend_ref is a mandatory field we can make
it a plain uint8_t. Increase the LIBVERSION as the ABI has changed.
2012-08-03 10:08:02 +02:00
Harald Welte 007a71e332 authentication: More documentation 2012-07-18 19:47:56 +02:00
Harald Welte 45ecd04e54 backtrace: Add a variant that uses the libosmocore logging framework
I recently discovered that we can only print backtraces to stdout, which
is of course useless in a daemon environment.  We'd rather want to use
the libosmocore logging framework instead.
2012-07-14 12:30:53 +02:00
Harald Welte 2fe684755a TLV: add new "vTvLV" type for GAN
This new TLV type is specific to TS 44.318.  Contrary to the TvLV type
of TS 08.16/08.18, it has an inverted meaning of the extension (0x80)
bit:
	* if the extension bit is not set, 1-byte length
	* if the extension bit is set, 2-byte length

Futhermore, it has support for variable-length tags, where the tag part
can be optionally two bytes in length.  As this esoteric option hasn't
been seen in the wild yet, we only add encoding support but skip
decoding for now.
2012-07-14 01:50:33 +02:00
Harald Welte 774a9de8b3 import gsm48_decode_lai() function from osmocom-bb/mobile sysinfo.c 2012-07-13 21:35:13 +02:00
Harald Welte e30b6ac5d1 timer: Add function osmo_timer_remaining() to determine remainign time 2012-07-13 12:22:20 +02:00
Andreas Eversberg 3c6a2cef5e VTY: Allow to compile vty.h and command.h headers with C++ 2012-07-12 09:42:36 +02:00
Holger Hans Peter Freyther fb4bfc2ad5 logging: Fix compile breakage introduced by the warning fixes
Make sure the declaration and definition match, add const to
the functions called by logp/logp2.

Compile output:
logging.c:317: error: conflicting types for 'logp'
../include/osmocom/core/logging.h:34: note: previous declaration of 'logp' was here
logging.c:327: error: conflicting types for 'logp2'
../include/osmocom/core/logging.h:168: note: previous declaration of 'logp2' was here
make[3]: *** [logging.lo] Error 1
2012-07-12 09:26:25 +02:00
Andreas Eversberg 2d6563b78e logging: Avoid compiler warnings when compiling c++ code
this patch i use to suppress warnings when compiling osmo-pcu (c++).
since __FILE__ is constant, the called logging function with parameter
"file" must be constant too, in order to avoid compiler warnings.
2012-07-10 13:10:15 +02:00
Diego Elio Pettenò 23431c75c8 codec: make data tables constant.
When declaring them constant, they are written on the .rodata section
instead of .data, which means that they can be mapped directly from
disk to memory.

Signed-off-by: Diego Elio Pettenò <flameeyes@flameeyes.eu>
2012-06-30 22:01:44 +02:00
Diego Elio Pettenò d471a21920 build: simplify headers management and remove recursion
There is no real reason to keep the include directory a multi-level
recursion, so instead declare everything within include (so that we
can use proper nobase_ declarations) and be it.

Please note that since we removed the sub-Makefile.am, ./configure
will not create the directory structure for us on out-of-tree builds,
so we have to make sure the directory we're generating to exists first.

Signed-off-by: Diego Elio Pettenò <flameeyes@flameeyes.eu>
2012-06-30 22:01:43 +02:00
Harald Welte 327009e420 GAN/UMA: use correct IE Identifier foer T3920
As Dieter found out, there has been a mix-up of 3902 with 3920 :/
2012-06-29 21:14:52 +02:00
Harald Welte c17f570538 ganc: add value_strings for GAN message type and protocol discriminator 2012-06-24 21:52:07 +02:00
Harald Welte c2a25c67f8 44.318: Add missing message types 2012-06-24 20:30:20 +02:00
Harald Welte 727399461d Fix bit-endianness in UMA/GAN definitions 2012-06-24 19:46:37 +02:00
Harald Welte 2b1ab863e1 44.318: add structure describing Control Channel Description IE 2012-06-24 16:52:46 +02:00
Harald Welte 53c815b7ae gsm_44_318: add protocol discriminator enum and data[0] array to hdr 2012-06-23 21:54:46 +02:00
Harald Welte 4498a0ac85 gsm_44_318.h: fix syntax errors in GAN definitions 2012-06-23 20:46:48 +02:00
Harald Welte b21825effc linuxrbtree: don't use 'new' as argument name to avoid C++ incompatibility 2012-06-18 12:18:46 +08:00
Harald Welte 641f7cee5d libosmogb: move files to proper location and fix build 2012-06-17 23:05:26 +08:00
Harald Welte e02b9f404c add GPRS/Gb related osmo_prim SAPs 2012-06-17 14:09:25 +08:00
Harald Welte d85d0159a5 add library VTY nodes for NS and BSSGP 2012-06-16 16:54:19 +08:00
Harald Welte 8cce125ff9 signal: add SS_L_NS as a signal subsystem for NS code in libosmo-gb 2012-06-16 16:37:57 +08:00
Harald Welte 81cd54a0c3 add GSM_LCHAN_PDTCH 2012-04-19 23:19:10 +02:00
Sylvain Munaut dca7d2caaa doc: Fix the Doxygen section endings
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2012-04-18 21:53:23 +02:00
Holger Hans Peter Freyther 738f13395d vty: Add a function to write the current config to a file. 2012-03-28 17:53:27 +02:00
Harald Welte a72e47b8a0 auth_milenage/osmo-auc-gen: compute OPC in case only OP is known 2012-03-21 09:04:14 +01:00
Holger Hans Peter Freyther 58d3153249 misc: Fix warning when compiling telnet_interface.c
In file included from telnet_interface.c:30:0:
osmocom/core/socket.h:25:4: warning: 'struct osmo_fd' declared inside parameter list [enabled by default]
telnet_interface.c: In function 'telnet_init_dynif':
telnet_interface.c:84:4: warning: passing argument 1 of 'osmo_sock_init_ofd' from incompatible pointer type [enabled by default]
osmocom/core/socket.h:24:5: note: expected 'struct osmo_fd *' but argument is of type 'struct osmo_fd *'
2012-03-16 09:18:12 +01:00
Sylvain Munaut a9efc12ccd vty/telnet: Add function to allow binding telnet interface to custom IP/Interface
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2012-03-01 22:33:20 +01:00
Harald Welte 3e04ed6083 gsmtap: Add GSMTAP_GPRS_CS() / GSMTAP_GPRS_MCS()
As requested by Mike Morrin <Mike.Morrin@ipaccess.com>, we introduce
GSMTAP sub-types for all the different GPRS and EGPRS coding schemes.

This is neccessary due to the fact that the RLC PDU doesn't contain any
explicit indication of the coding scheme used on the radio layer.
2012-02-08 18:13:34 +01:00
Andreas Eversberg 4b332d7d0e libosmocore/gsm: Fixed total size of gsm48_req_ref
"__attribute ((packed))" must be defined for unions, in order to make
sure that the compiler packs unions.
2012-02-07 20:02:17 +01:00
Harald Welte 07b625dd2c GSM 08.08: change gsm0808_create_classmark_update() prototype
The caller explicitly specifies CM2 and CM3, rather than one blob
containing both.
2012-01-26 22:42:16 +01:00
Harald Welte 7d974addc6 gsmtap: make sure we agree with wireshark on GSMTAP channel types 2012-01-26 13:12:03 +01:00
Harald Welte 2c02043f49 TLV/msgb: Return first byte of newly-pushed data from msgb_*_push()
The msgb_*_push() functions erroneously returned the firsrt byte after
newly-pushed information, which makes no sense at all.
2012-01-22 23:10:40 +01:00
Harald Welte 3068d5747a msgb_trim(): actually trim to an absolute length, as the comment states
The previous commit introduced a new msgb_trim() but the implementation
differed from the specification.
2012-01-14 22:08:28 +01:00
Harald Welte b0f91513cd msgb: introduce msgb_trim() and msgb_l3trim() to trim msgb's 2012-01-14 21:54:17 +01:00
Harald Welte aae2362455 auth_core: don't use anonymous unions to make certain gcc versions happy 2011-12-07 11:35:02 +01:00
Harald Welte a5ab1620f4 auth_core: add functions for parsing algorithm names 2011-12-07 02:33:11 +01:00
Harald Welte d82e0eb697 Add a generic abstraction for GSM/3G authentication algorithms
Indiidual algorithms can be implemented as plugins.  libosmogsm itself
only provides COMP128v1 via this generic interface.
2011-12-06 21:53:42 +01:00
Harald Welte 39a287db74 comp128: mark ki and srand as 'const' input parameters 2011-12-06 21:52:09 +01:00
Harald Welte ad633b0919 SMS: export gsm411_bcdify() and gsm411_unbcdify() functions
The same functions are e.g. required by the NITZ code in 04.08, and we
don't want copy+paste.
2011-12-01 21:09:19 +01:00
Sylvain Munaut ae8dbb4d77 core/conv: Add utility methods to know length of coded/decoded vectors
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-24 17:47:32 +01:00
Sylvain Munaut 297d13f460 core/conv: Add support for other termination types (trunc & tail biting)
Note that this breaks the ABI and the low level API. But it shouldn't
break the high level API, nor the conv code definitions (because fields
default to 0, and for new fields '0' is the previous behavior)

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-24 17:46:58 +01:00
Sylvain Munaut 03d2c8906b core/conv: Minor documentation improvements
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-24 11:53:49 +01:00
Sylvain Munaut 2735ac4848 gsm/a5: Add documentation
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-17 21:01:46 +01:00
Sylvain Munaut 3e387cb35c gsm/a5: Add const qualifier on the key
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-17 19:45:58 +01:00
Sylvain Munaut 4cfbae8152 utils: Add declaration back for osmo_osmo_hexdump_nospc
As it turns out, if a project uses the old name but without a declaration,
it'll causes a segfault on 64 bits platform (because of the implicit
int return type which doesn't apply since here it's a pointer).

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-13 23:04:00 +01:00
Sylvain Munaut 0d9b8ec9d3 include/gsm_04_11: Fix compatibility issue with GSM411_TMR_TC1A
We need to keep the old one for compatibility !

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-12 23:52:20 +01:00
Andreas Eversberg c1a91a896f gsm/sms: Rewrite of SMR process, extracted from OpenBSC
The SMR process is used to transfer SMS TPDUs. It is now extracted from
OpenBSC. It includes a real state machine now for easier debugging.

Also it implements the TR1M and TR2M timers. The memory notification
procedure is missing, but not required for network side.

Written-by: Andreas Eversberg <jolly@eversberg.eu>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-12 23:23:37 +01:00
Andreas Eversberg bbf9034eaa gsm/sms: Rewrite of SMC process, extracted from OpenBSC
The SMC process is used to transfer RP frames. It is now extracted from
OpenBSC. It includes a real state machine now for easier debugging.

Written-by: Andreas Eversberg <jolly@eversberg.eu>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-12 23:23:37 +01:00
Andreas.Eversberg d84f47abb3 gsm/sms: Moved utility functions of SMS processing to new gsm0411_utils.c
Written-by: Andreas Eversberg <jolly@eversberg.eu>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-12 23:23:37 +01:00
Andreas Eversberg c626da9f87 gsm/sms: Added DLSMS debugging
Written-by: Andreas Eversberg <jolly@eversberg.eu>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-12 23:23:36 +01:00
Andreas.Eversberg f1f80de007 gsm/lapdm: Fix TA and power level handling in the ACCH header
Timing advance and power level indicated by MS (measurement reports)
and BTS (SI 5/6) are now stored for use at ACCH data link connection.

This is part of a set of commit to fix LAPDm to handle datalink
connection on ACCH (SAPI 3)

This is required to transfer SMS on SACCH of TCH/f or SDCCH/8 (4).

Written-by: Andreas Eversberg <jolly@eversberg.eu>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-12 23:23:36 +01:00
Andreas.Eversberg 5ac44784b6 gsm/lapdm: Make T200 timer depends on the link type (SACCH is slower)
This is part of a set of commit to fix LAPDm to handle datalink
connection on ACCH (SAPI 3)

This is required to transfer SMS on SACCH of TCH/f or SDCCH/8 (4).

Written-by: Andreas Eversberg <jolly@eversberg.eu>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-12 23:23:36 +01:00
Andreas.Eversberg f948dbc442 vty: Fixed vty_down_level to move down from config nodes
When using ^D at config nodes above the CONFIG_NODE, the
go_parent_cb function is used to go down by one node. This
is equivalent to "exit" command.

Written-by: Andreas.Eversberg <jolly@eversberg.eu>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-12 23:23:36 +01:00
Andreas.Eversberg dc3be0a653 vty/telnet_interface: Add telnet_exit function
This frees socket and pending connections

Written-by: Andreas Eversberg <jolly@eversberg.eu>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-12 23:23:36 +01:00
Sylvain Munaut 2179f402e0 core/rbtree: add const qualifier to some functions
See kernel commit f4b477c47332367d35686bd2b808c2156b96d7c7

----
The 'rb_first()', 'rb_last()', 'rb_next()' and 'rb_prev()' calls
take a pointer to an RB node or RB root. They do not change the
pointed objects, so add a 'const' qualifier in order to make life
of the users of these functions easier.

Indeed, if I have my own constant pointer &const struct my_type *p,
and I call 'rb_next(&p->rb)', I get a GCC warning:

warning: passing argument 1 of ?~@~Xrb_next?~@~Y discards qualifiers from pointer target type

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
----

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-12 23:23:35 +01:00
Sylvain Munaut ff23d24972 utils: Fix a bad double osmo_ prefix for osmo_hexdump_nospc
Hopefully no project where using them it seems

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-10 23:03:18 +01:00
Sylvain Munaut 07f1103782 timer: Add compatibility header with timer helpers
Some of these are not always present, especially when cross compiling

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-10-21 21:55:29 +02:00
Pablo Neira Ayuso 066c912fd3 timer: add scalable RB-tree based timer infrastructure
This patch adds RB-tree based timers which scales better than the
previous list-based implementation.

It does not require any API changes. It breaks ABI because the
osmo_timer_list structure has changed though (to avoid this in
the future, we can put internal data in some private structure).

The following table summarizes the worst-case computational complexity
of this new implementation versus the previous one:

                                rb-tree         list-based
                                -------         ----------
calculate next timer to expire  O(1)            O(n)
insertion of new timer          O(log n)        O(n)
deletion of timer               O(log n)        O(1)
timer-fired scheduler           O(log n)        O(3n)

The most repeated cases are:

* the calculation of the next timer to expire, that happens in every
  loop of our select function.

* the timer-fired scheduler execution.

This new implementation only loses in the deletion of timer scenario,
this happens because we may need to rebalance the tree after the
removal.

So I think there is some real gain if we have some situation in which
we have to handle lots of timers.
2011-10-17 13:25:29 +02:00
Pablo Neira Ayuso f74db0b33d add rb-tree implementation to libosmocore
This patch adds red black trees implementation to libosmocore.
This data structure is very useful to search for elements in
ordered sets in O(log n) instead of O(n) that lists provide.

The first client of this code will be one follow up patch that
implements rbtree-based timer scheduler.
2011-10-17 13:25:29 +02:00
Harald Welte 226ef1d143 add header file containing UMA/GAN protocol definitions 2011-10-10 09:21:27 +02:00
Andreas Eversberg 78122ab568 Added defines to use primitive/operation tuples in switch/case statements 2011-10-10 08:38:58 +02:00
root af48bed556 Split of LAPDm into a core part and a GSM specific part
Instead of mixing together the GSM layer 1 interface and RSL interface
with the implementation of LAPD, the core function of LAPD is now
extracted from LAPDm. The core implementation is now in lapd_core.c
and lapd_core.h respectively.

The lapd_core.c implements exactly one datalink instance for one SAP.
The surrounding implementation "lapdm.c" codes/decodes the layer 2
headers and handles multiplexing and datalink instances, as well as
translates primitives from/to RSL layer.

lapd_core.c can now be used for other LAPD implementations. (ISDN/ABIS)
2011-10-10 08:38:58 +02:00
root 8a996b4844 Changed logging of LAPD from DLLAPDM to DLLAPD 2011-10-10 08:38:58 +02:00
Sylvain Munaut f84571d0f4 gsmtap: Add type/subtypes for GMR-1 protocol
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-10-09 16:57:33 +02:00