aboutsummaryrefslogtreecommitdiffstats
path: root/include
AgeCommit message (Collapse)AuthorFilesLines
2016-02-29log: Add conditional logging based on log_check_levelJacob Erlbeck1-4/+20
Currently the LOGP/DEBUGP arguments are always evaluated even if no logging will happen at all. This can be expensive, for instance if hexdumps or pretty printed object names are generated. This causes high base load especially on embedded devices and is a major part of CPU usage e.g. of the osmo-pcu. This commit uses the log_check_level function to avoid the evaluation of the parameters if it is known in advance, that no logging entry will be generated. Sponsored-by: On-Waves ehf
2016-02-29log: Add log_check_level functionJacob Erlbeck1-0/+1
This commit adds this predicate function which can be used to avoid the execution of code if a certain log level is not enabled. The function will only return 0 (false), if it is sure that a logging call for the same facility and level will not produce any output. This safety criterion shall ensure, that no logging output is lost due to the use of this predicate as a guard. On the other hand, even if the predicate returns != 0 (true), no logging output might get generated by a similar logging command. Note that the current implementation is not focussed on performance, which could be improved by using a lookup table instead of iterating through every target. Sponsored-by: On-Waves ehf
2016-02-29fix gsm_7bit_decode API comment: septets, not octetsNeels Hofmeyr1-1/+2
2016-02-25Add byte printing macrosMax1-0/+21
It's sometimes handy for debugging to be able to immediately see which bits are set in a given byte. Generalize macro used for that in bitvec tests and make it available for the rest of the library.
2016-02-25vty: add ctrl section for Control interface bind addressNeels Hofmeyr3-2/+12
This may seem like overkill for a mere const char * config item, but it makes the Control interface VTY commands reusable in any main() scope (inspired by libosmo-abis' VTY config). Add API functions ctrl_vty_init() and ctrl_vty_get_bind_addr(), in new files src/ctrl/control_vty.c and include/osmocom/ctrl/control_vty.h, compiled and/or installed dependent on ENABLE_VTY. Using these functions allows configuring a static const char* with the VTY commands ctrl bind A.B.C.D which callers shall subsequently use to bind the Control interface to a specific local interface address, by passing the return value of ctrl_vty_get_bind_addr() to control_interface_setup(). Add CTRL_NODE to enum node_type, "eating" RESERVED4_NODE to heed that comment on avoiding ABI changes.
2016-02-25add ctrl_interface_setup_dynip() for bind addressNeels Hofmeyr1-0/+4
Make the ctrl interface bind address configurable, so that it may be made available on other addresses than 127.0.0.1. The specific aim is to allow running multiple osmo-nitbs alongside each other (commits in openbsc follow).
2016-02-25vty: add bind command for telnet vty lineNeels Hofmeyr1-0/+3
Add VTY command line vty bind A.B.C.D The command merely stores the configured IP-address, which can then be used by the calling main program to set the telnet port of the VTY line. (Commits in openbsc and osmo-iuh will follow up on this.) Add function vty_get_bind_addr() to publish the address in the vty.h API. Add static vty_bind_addr to store. For allocation/freeing reasons, a NULL address defaults to 127.0.0.1. BTW, I decided against allowing keywords 'any' and 'localhost' in place of an actual IP address to make sure a written config is always identical to the parsed config.
2016-02-22Extend L1SAP PH-DATA with presence informationMax1-0/+11
Previously the presence of header and data blocks were communicated in-band which decreases code readability and makes it unnecessary hard to add support for new hardware. Note: OsmoBTS have to be modified to take advantage of extended ph_data_param structure.
2016-02-22gb: Add bssgp_msgb_copy functionJacob Erlbeck1-0/+1
This function originates from openbsc/src/gprs but is just specific to BSSGP/Gb on the same level like bssgp_msgb_alloc. This commit puts the former gprs_msgb_copy function beside bssgp_msgb_alloc. Renamed function: gprs_msgb_copy -> bssgp_msgb_copy Sponsored-by: On-Waves ehf
2016-02-18Add T4 bit map compression routinesMax2-0/+43
Add bit map encoder and decoder functions: decoder is fully functional while encoder is good enough for testing - no backtracking to find the best possible compression is implemented. If somebody is willing to implement MS side of EDGE than this has to be expanded. Add corresponding tests. N. B: the encoding is implemented according to ETSI TS 44.060 which is slightly different from T4 used for fax according to CCITT G31D (RFC 804). Ticket: OW#2407 Sponsored-by: On-Waves ehf Signed-off-by: Max <msuraev@sysmocom.de>
2016-02-18Expand bitvec interfaceMax1-0/+9
Add bit filling, shifting and other functions necessary for bit compression implementation. Add corresponding tests.
2016-02-15Add CSCN ctrl port defsNeels Hofmeyr2-0/+2
2016-02-10add vty port nr for osmo-cscnNeels Hofmeyr1-0/+1
2016-01-30bitvec: Test and fix regression for C++->C conversionHolger Hans Peter Freyther1-2/+2
bitvec_read_field/bitvec_write_field in the PCU used a C++ reference and when porting to C it was decided to pass the parameter by value and this lost the "back propagation" of the new index. Change the parameter to be an in/out parameter and this way do not have a silent semantic break in the osmo-pcu (where we copy the reference in csn.1 by value) and have a true compile failure. Add Max's simple test for bitvec_unhex function leaving the checking of bitvec_read_field and the side effect in the datastructure about the number of bits still open.
2016-01-26Add bitvec-related functions from Osmo-PCUMax1-0/+9
Allocation, pack/unpack, field access and helper routines used extensively by Osmo-PCU. Whenever memory allocation happens, alocator context is passed explicitly by caller.
2016-01-22bitvec: Fix interface to consistently use unsigned intMax1-5/+5
Use unsigned int for the length throughout the interface. We will never have a a negative length. Sponsored-by: On-Waves ehf
2016-01-18comment typoNeels Hofmeyr1-1/+1
2016-01-15msgb: Assert len >= 0 in msgb_trimJacob Erlbeck1-0/+2
Currently msgb_trim only checks for len > data_len and returns -1 in that case, allowing the caller to fix it somehow. Using a negative length will always lead to a corrupt msgb, but this is not being checked. This commit adds a check for len < 0 and a conditional call to MSGB_ABORT. Sponsored-by: On-Waves ehf
2016-01-15bitvec: Add get/set byte sequencesJacob Erlbeck1-0/+10
The new functions bitvec_get_bytes and bitvec_set_bytes copy byte sequences from bitvecs to uint8_t arrays and vice versa. While the bytes in the bitvecs do not need to be aligned, the uint8_t arrays always are. In case the bytes in the bitvec are aligned, the implementation uses memcpy. Note that the implementation like the other existing functions assume MSB first encoding. [hfreyther: Squash the comment fix into this commit as well] Sponsored-by: On-Waves ehf
2016-01-15gsm: Add APN conversion functionsJacob Erlbeck1-0/+3
These functions are currently part of openbsc but also needed by other projects. The function have been renamed as follows: gprs_apn_to_str -> osmo_apn_to_str gprs_str_to_apn -> osmo_apn_from_str Sponsored-by: On-Waves ehf
2015-12-25osmo_prim_op_names should be externHarald Welte1-1/+1
2015-12-23Add osmo_prim_op_names[] symbol and _SAP_SS7_BASE defineHarald Welte1-0/+3
2015-12-21msgb: Add msgb_test_invariant functionJacob Erlbeck1-0/+40
This adds a function that verifies whether a mgsb is consistent. Sponsored-by: On-Waves ehf
2015-12-21msgb: Add msgb_resize_area and msgb_copyJacob Erlbeck1-0/+3
These functions originate from openbsc/src/gprs but are generic msgb helper functions. msgb_copy: This function allocates a new msgb, copies the data buffer of msg, and adjusts the pointers (incl. l1h-l4h) accordingly. msgb_resize_area: This resizes a sub area of the msgb data and adjusts the pointers (incl. l1h-l4h) accordingly. Sponsored-by: On-Waves ehf
2015-12-21some comments / fixed typosNeels Hofmeyr4-2/+6
2015-12-13RSL: Add enum + TLV definitions for ip.access style embedded IEsHarald Welte2-0/+31
2015-12-09gsm_03_41: Fix structure definitions for big-endian machinesRuben Undheim1-0/+31
this was detected by debian packaging, as the associated gsm_03_41 test case fails on big endian machines like ppc.
2015-12-08stats: Add OSMO prefix to STAT_ITEM_NOVALUE_IDJacob Erlbeck1-1/+1
This symbol is globally visible and therefore should have an OSMO prefix like the other identifiers exported by stat_item.h. Sponsored-by: On-Waves ehf
2015-12-08stat: Explicitly support stat_items without unitJacob Erlbeck1-0/+1
Add OSMO_STAT_ITEM_NO_UNIT for stat items without an unit. The statsd reporter uses gauges ("g") to report them. Sponsored-by: On-Waves ehf
2015-12-05remove our internal copy of talloc, use system libtallocHarald Welte3-205/+4
Shipping our own private copy of talloc was a good idea in 2008, when it was not readily available on most target platforms. Today, the situation is quite different, as it is a standard library on major Linux distributions.
2015-11-26stats: Move statsd related code into a separate fileJacob Erlbeck1-4/+12
This commit moves the stats specific code parts into stats_statsd.c while keeping the generic parts in stats.c. The code in stats.c no longer contains references to statsd symbols. Note that the VTY code still needs to know about every stats reporter backend. Sponsored-by: On-Waves ehf
2015-11-21use system-wide libtalloc with --enable-system-tallocHarald Welte2-1/+14
This introduces a new configure flag by which the libosmocore-internal talloc code is not compiled, but rather a system-wide libtalloc is used. When we started openbsc/libosmocore in 2008, libtalloc was not widely present on systems yet. This has changed meanwhile, and we should simply use the system-wide library
2015-11-12fix FSF address in sources/headersJaroslav Škarvada4-7/+8
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
2015-11-09stats: Send all values on reporter updateJacob Erlbeck1-0/+1
Currently only counter changes and new item values are being reported. This makes it cumbersome to configure reporting clients, since there is nothing like a list of all parameters. This commit changes this behaviour such that all currently existing counters and items that would be reported eventually, are passed to the reporter when it has been reconfigured or enabled. If a counter has not been incremented, 0 is sent. If a stat item value has not been added, the last item value (or the default value if there is none) is resent again. Note that this will not catch transient counters/items that will be created later on, e.g. triggered by new peers or subscribers. To just force this kind of dump on a running reporter, it is sufficient to invoke the 'enable' command in its configuration node. Sponsored-by: On-Waves ehf
2015-11-04gprs-ns/stats: When the NSVCI is updated, update the stats counterHolger Hans Peter Freyther2-0/+11
The NS object is created with an unknown identity and only after the reset procedure has progressed (completed?) we know the real ID for this peer. Before nobody has looked at the idx values (this could have been seen with the CTRL interface) but with statsd the wrong NSVCI becomes obvious. Add routines to update the idx and I don't know if the change of idx is causing any issues but we will find that out soon.
2015-08-22stats/vty: Add selective show stats commandJacob Erlbeck1-0/+2
Currently there is only the 'show stats' command which shows all counter and stat_item values. This can lead to many lines of output if there are per-subscriber rate counters. The new command added by this commit allows it to only show groups of a certain level (class_id), similar to the 'level' configuration command for stats reporter. The new command is show stats level (global|peer|subscriber) Sponsored-by: On-Waves ehf
2015-08-21stats: Fix build on FreeBSDHolger Hans Peter Freyther1-0/+2
include stdint.h for int64_t and use netinet/in.h and not netinet/ip.h for getting sockaddr_in and such.
2015-11-02gtphub: add OSMO_VTY_PORT_GTPHUB.Neels Hofmeyr1-0/+1
This is for gtphub, being developed in openbsc.git. Sponsored-by: On-Waves ehi
2015-11-02fix some typosNeels Hofmeyr2-5/+5
Sponsored-by: On-Waves ehi
2015-11-02log: Add new DLSTATS log levelJacob Erlbeck1-1/+2
This log level is used by the stats subsystem log reporter to report statistics to level INFO. Note that the default level of DLSTATS is NOTICE. Sponsored-by: On-Waves ehf
2015-11-02stats: Limit reporting by class idJacob Erlbeck3-0/+14
This commit adds class_id fields to the rate_ctr and stat_item group descriptions. The stats reporter code is extended to only process groups whose class_id does not exceed a per reporter max_class level. If the class_id is not set, the code assumes 'global' for groups with idx == 0 and 'subscriber' otherwise. The following vty command is added to config-stats: level (global|peer|subscriber) Set the maximum group level Sponsored-by: On-Waves ehf
2015-11-02vty: Add reserved nodes to enum node_typeJacob Erlbeck1-0/+9
Currently every time a node is added to enum node_type, this constitutes an ABI change, since _LAST_OSMOVTY_NODE will get incremented accordingly. In this case, every project that adds new node type based on that value will have to be recompiled. This commit adds 4 spare node type values, which can be replaced one-by-one by new real types until they are exhausted to avoid this kind of ABI change. Sponsored-by: On-Waves ehf
2015-11-02stats: Add osmo_ name prefix to identifiersJacob Erlbeck5-67/+67
Since the the stat_item and stats functions and data types are meant to be exported, they get an osmo_ prefix. Sponsored-by: On-Waves ehf [hfreyther: Prepended the enum values too. This was requested by Jacob]
2015-10-29stats: Add log reporterJacob Erlbeck1-0/+3
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-29stats: Use function pointers in reporter objectsJacob Erlbeck1-0/+14
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-29stats: Make net config optionalJacob Erlbeck1-0/+2
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-29stats: Support statsd Multi-Metric PacketsJacob Erlbeck1-0/+5
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-29core: Add difference function to osmo_counterJacob Erlbeck1-0/+4
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-29stats: Implement timer based reportingJacob Erlbeck1-2/+8
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-29stats/vty: Add stats configurationJacob Erlbeck1-0/+1
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