libosmocore  0.9.6-14.20170220git32ee5af8.fc33
Osmocom core library
application.h File Reference

Routines for helping with the osmocom application setup. More...

Go to the source code of this file.

Functions

void osmo_init_ignore_signals (void)
 Ignore SIGPIPE, SIGALRM, SIGHUP and SIGIO.
 
int osmo_init_logging (const struct log_info *)
 Initialize the osmocom logging framework. More...
 
int osmo_daemonize (void)
 Turn the current process into a background daemon. More...
 

Variables

struct log_targetosmo_stderr_target
 the default logging target, logging to stderr
 

Detailed Description

Routines for helping with the osmocom application setup.

Function Documentation

◆ osmo_daemonize()

int osmo_daemonize ( void  )

Turn the current process into a background daemon.

This function will fork the process, exit the parent and set umask, create a new session, close stdin/stdout/stderr and chdir to /tmp

◆ osmo_init_logging()

int osmo_init_logging ( const struct log_info log_info)

Initialize the osmocom logging framework.

Parameters
[in]log_infoArray of available logging sub-systems
Returns
0 on success, -1 in case of error

This function initializes the osmocom logging systems. It also creates the default (stderr) logging target.

References log_add_target(), log_init(), log_set_all_filter(), log_target_create_stderr(), and osmo_stderr_target.

msgb::list
struct llist_head list
linked list header
Definition: msgb.h:44
OSMO_FSM_TERM_ERROR
@ OSMO_FSM_TERM_ERROR
erroneous termination of process
Definition: fsm.h:28
gsmtap_inst::ofd_wq_mode
int ofd_wq_mode
wait queue mode?
Definition: gsmtap_util.h:24
osmo_conv_decoder::state_history
uint8_t * state_history
state history [len][n_states]
Definition: conv.h:121
osmo_conv_encoder::i_idx
int i_idx
Next input bit index.
Definition: conv.h:86
osmo_strrb_elements
size_t osmo_strrb_elements(const struct osmo_strrb *rb)
Count the number of log messages in an osmo_strrb.
Definition: strrb.c:133
osmo_gettimeofday
int osmo_gettimeofday(struct timeval *tv, struct timezone *tz)
shim around gettimeofday to be able to set the time manually. To override, set osmo_gettimeofday_over...
Definition: timer_gettimeofday.c:39
osmo_strrb::buffer
char ** buffer
storage for messages
Definition: strrb.h:43
osmo_timer_list
A structure representing a single instance of a timer.
Definition: timer.h:54
osmo_macaddr_parse
int osmo_macaddr_parse(uint8_t *out, const char *in)
Parse a MAC address from human-readable notation This function parses an ethernet MAC address in the ...
Definition: macaddr.c:43
bitvec_read_field
uint64_t bitvec_read_field(struct bitvec *bv, unsigned int *read_index, unsigned int len)
read part of the vector
Definition: bitvec.c:461
osmo_conv_decoder::p_idx
int p_idx
puncture index
Definition: conv.h:117
osmo_strrb::start
uint16_t start
index of the first slot
Definition: strrb.h:40
rate_ctr_for_each_counter
int rate_ctr_for_each_counter(struct rate_ctr_group *ctrg, rate_ctr_handler_t handle_counter, void *data)
Iterate over all counters.
Definition: rate_ctr.c:205
msgb::l3h
unsigned char * l3h
pointer to Layer 3 header. For OML: FOM; RSL: 04.08; GPRS: BSSGP
Definition: msgb.h:57
bitvec::data
uint8_t * data
pointer to data array
Definition: bitvec.h:62
bitvec_get_int16_msb
int16_t bitvec_get_int16_msb(const struct bitvec *bv, unsigned int num_bits)
get multiple bits (num_bits) from beginning of vector (MSB side)
Definition: bitvec.c:234
OSMO_SOCK_F_CONNECT
#define OSMO_SOCK_F_CONNECT
Definition: socket.h:18
osmo_stderr_target
struct log_target * osmo_stderr_target
the default logging target, logging to stderr
Definition: application.c:73
RATE_CTR_INTV_HOUR
@ RATE_CTR_INTV_HOUR
last hour
Definition: rate_ctr.h:20
loggingrb.h
gsmtap_send_ex
int gsmtap_send_ex(struct gsmtap_inst *gti, uint8_t type, uint16_t arfcn, uint8_t ts, uint8_t chan_type, uint8_t ss, uint32_t fn, int8_t signal_dbm, uint8_t snr, const uint8_t *data, unsigned int len)
send an arbitrary type through GSMTAP. See gsmtap_makemsg_ex for arguments
Definition: gsmtap_util.c:252
rate_ctr_group_desc::ctr_desc
const struct rate_ctr_desc * ctr_desc
Pointer to array of counter names.
Definition: rate_ctr.h:55
gsmtap_hdr::frame_number
uint32_t frame_number
Definition: gsmtap.h:252
rate_ctr_desc
rate counter description
Definition: rate_ctr.h:39
log_add_target
void log_add_target(struct log_target *target)
Register a new log target with the logging core.
Definition: logging.c:455
osmo_conv_encoder::p_idx
int p_idx
Current puncture index.
Definition: conv.h:87
osmo_fsm_inst::priv
void * priv
some private data of this instance
Definition: fsm.h:94
bitvec_get_bytes
int bitvec_get_bytes(struct bitvec *bv, uint8_t *bytes, unsigned int count)
get multiple bytes from current pos Assumes MSB first encoding.
Definition: bitvec.c:310
log_info_cat::enabled
uint8_t enabled
Definition: logging.h:121
osmo_fsm_state
description of a rule in the FSM
Definition: fsm.h:41
crc8gen.h
bitvec_get_bit_high
int bitvec_get_bit_high(struct bitvec *bv)
get the next bit (low/high) inside a bitvec
Definition: bitvec.c:185
osmo_ubit2pbit
int osmo_ubit2pbit(pbit_t *out, const ubit_t *in, unsigned int num_bits)
convert unpacked bits to packed bits, return length in bytes
Definition: bits.c:41
osmo_conv_code::term
enum osmo_conv_term term
Termination type.
Definition: conv.h:61
rate_ctr_init
int rate_ctr_init(void *tall_ctx)
Initialize the counter module.
Definition: rate_ctr.c:147
osmo_char2bcd
uint8_t osmo_char2bcd(char c)
Convert number in ASCII to BCD value.
Definition: utils.c:116
LOGL_FATAL
#define LOGL_FATAL
fatal, program aborted
Definition: logging.h:90
osmo_conv_decoder::ae_next
unsigned int * ae_next
next accumulated error (tmp in scan)
Definition: conv.h:120
osmo_crc16gen_set_bits
void osmo_crc16gen_set_bits(const struct osmo_crc16gen_code *code, const ubit_t *in, int len, ubit_t *crc_bits)
Computes and writes the CRC value of a given array of bits.
Definition: crc16gen.c:106
bitvec_set_bit_pos
int bitvec_set_bit_pos(struct bitvec *bv, unsigned int bitnum, enum bit_value bit)
set a bit at given position in a bit vector
Definition: bitvec.c:146
_osmo_fsm_inst_dispatch
int _osmo_fsm_inst_dispatch(struct osmo_fsm_inst *fi, uint32_t event, void *data, const char *file, int line)
dispatch an event to an osmocom finite state machine instance
Definition: fsm.c:379
osmo_wqueue::current_length
unsigned int current_length
current length of write queue
Definition: write_queue.h:42
osmo_sock_init
int osmo_sock_init(uint16_t family, uint16_t type, uint8_t proto, const char *host, uint16_t port, unsigned int flags)
Initialize a socket (including bind/connect)
Definition: socket.c:67
log_info_cat::color
const char * color
Definition: logging.h:118
osmo_str2lower
void osmo_str2lower(char *out, const char *in)
Convert an entire string to lower case.
Definition: utils.c:271
log_parse_level
int log_parse_level(const char *lvl)
Parse a human-readable log level into a numeric value.
Definition: logging.c:160
osmo_t4_encode
int osmo_t4_encode(struct bitvec *bv)
encode bit vector in-place using T4 encoding Assumes MSB first encoding.
Definition: bitcomp.c:316
OSMO_FSM_TERM_REGULAR
@ OSMO_FSM_TERM_REGULAR
regular termination of process
Definition: fsm.h:26
log_info_cat::loglevel
uint8_t loglevel
Definition: logging.h:120
get_value_string
const char * get_value_string(const struct value_string *vs, uint32_t val)
get human-readable string for given value
Definition: utils.c:51
rate_ctr_add
void rate_ctr_add(struct rate_ctr *ctr, int inc)
Increment the counter by inc.
Definition: rate_ctr.c:81
osmo_serial_set_custom_baudrate
int osmo_serial_set_custom_baudrate(int fd, int baudrate)
Change current baudrate to a custom one using OS specific method.
Definition: serial.c:173
osmo_fsm_inst_term
#define osmo_fsm_inst_term(fi, cause, data)
Terminate FSM instance with given cause.
Definition: fsm.h:185
rate_ctr_group::desc
const struct rate_ctr_group_desc * desc
Pointer to the counter group class.
Definition: rate_ctr.h:63
osmo_pbit2ubit
int osmo_pbit2ubit(ubit_t *out, const pbit_t *in, unsigned int num_bits)
convert packed bits to unpacked bits, return length in bytes
Definition: bits.c:142
osmo_conv_encoder::state
uint8_t state
Current state.
Definition: conv.h:88
bitvec_get_bit_pos
enum bit_value bitvec_get_bit_pos(const struct bitvec *bv, unsigned int bitnr)
check if the bit is 0 or 1 for a given position inside a bitvec
Definition: bitvec.c:80
osmo_fsm::name
const char * name
human readable name
Definition: fsm.h:63
bitvec_pack
unsigned int bitvec_pack(const struct bitvec *bv, uint8_t *buffer)
Export a bit vector to a buffer.
Definition: bitvec.c:412
log_set_print_extended_timestamp
void log_set_print_extended_timestamp(struct log_target *target, int print_timestamp)
Enable or disable printing of extended timestamps while logging.
Definition: logging.c:537
ZERO
@ ZERO
A zero (0) bit.
Definition: bitvec.h:52
osmo_timer_add
void osmo_timer_add(struct osmo_timer_list *timer)
add a new timer to the timer management
Definition: timer.c:71
log_category
Definition: logging.h:110
osmo_crc64gen_code
structure describing a given CRC code of max 64 bits
Definition: crc64gen.h:39
gsmtap_osmocore_log_hdr::level
uint8_t level
Definition: gsmtap.h:269
rate_ctr_group_free
void rate_ctr_group_free(struct rate_ctr_group *grp)
Free the memory for the specified group of counters.
Definition: rate_ctr.c:74
osmo_stat_item_group_desc::item_desc
const struct osmo_stat_item_desc * item_desc
Pointer to array of value names.
Definition: stat_item.h:54
OSMO_ASSERT
#define OSMO_ASSERT(exp)
Definition: utils.h:68
osmo_stat_item_get_by_name
const struct osmo_stat_item * osmo_stat_item_get_by_name(const struct osmo_stat_item_group *statg, const char *name)
Search for item group based on group name.
Definition: stat_item.c:219
osmo_stat_item_group
One instance of a counter group class.
Definition: stat_item.h:58
write_queue.h
bitcomp.h
Osmocom bit compression routines.
conv.h
msgb_put
static unsigned char * msgb_put(struct msgb *msgb, unsigned int len)
append data to end of message buffer
Definition: msgb.h:185
gsmtap_util.h
osmo_stat_item_group_free
void osmo_stat_item_group_free(struct osmo_stat_item_group *statg)
Free the memory for the specified group of counters.
Definition: stat_item.c:118
osmo_stat_item_desc::num_values
unsigned int num_values
number of values to store
Definition: stat_item.h:39
bitvec_set_bit
int bitvec_set_bit(struct bitvec *bv, enum bit_value bit)
set the next bit inside a bitvec
Definition: bitvec.c:172
rate_ctr_group_desc::class_id
int class_id
The class to which this group belongs.
Definition: rate_ctr.h:51
bitvec_find_bit_pos
int bitvec_find_bit_pos(const struct bitvec *bv, unsigned int n, enum bit_value val)
find first bit set in bit vector
Definition: bitvec.c:290
osmo_stat_item_group::idx
unsigned int idx
The index of this value group within its class.
Definition: stat_item.h:64
crc64gen.h
osmo_wqueue::max_length
unsigned int max_length
maximum length of write queue
Definition: write_queue.h:40
msgb::data
unsigned char * data
start of message in buffer
Definition: msgb.h:67
osmo_strrb::size
uint16_t size
max number of messages to store
Definition: strrb.h:42
osmo_crc8gen_compute_bits
uint8_t osmo_crc8gen_compute_bits(const struct osmo_crc8gen_code *code, const ubit_t *in, int len)
Compute the CRC value of a given array of hard-bits.
Definition: crc8gen.c:46
gsmtap_hdr::arfcn
uint16_t arfcn
Definition: gsmtap.h:248
osmo_wqueue::write_cb
int(* write_cb)(struct osmo_fd *fd, struct msgb *msg)
call-back in case qeueue is writable
Definition: write_queue.h:50
bitvec_free
void bitvec_free(struct bitvec *bv)
Free a bit vector (release its memory)
Definition: bitvec.c:402
osmo_conv_encode_init
void osmo_conv_encode_init(struct osmo_conv_encoder *encoder, const struct osmo_conv_code *code)
Initialize a convolutional encoder.
Definition: conv.c:87
osmo_crc64gen_check_bits
int osmo_crc64gen_check_bits(const struct osmo_crc64gen_code *code, const ubit_t *in, int len, const ubit_t *crc_bits)
Checks the CRC value of a given array of hard-bits.
Definition: crc64gen.c:81
rate_ctr_per_intv::rate
uint64_t rate
counter rate
Definition: rate_ctr.h:27
LOG_TGT_TYPE_STDERR
@ LOG_TGT_TYPE_STDERR
stderr logging
Definition: logging.h:170
osmo_stat_item
data we keep for each actual value
Definition: stat_item.h:24
osmo_fd_register
int osmo_fd_register(struct osmo_fd *fd)
Register a new file descriptor with select loop abstraction.
Definition: select.c:70
gsmtap_source_init_fd
int gsmtap_source_init_fd(const char *host, uint16_t port)
Create a new (sending) GSMTAP source socket.
Definition: gsmtap_util.c:177
bitvec_set_bits
int bitvec_set_bits(struct bitvec *bv, const enum bit_value *bits, unsigned int count)
set multiple bits (based on array of bitvals) at current pos
Definition: bitvec.c:201
osmo_fsm_inst::children
struct llist_head children
a list of children processes
Definition: fsm.h:112
osmo_fd::cb
int(* cb)(struct osmo_fd *fd, unsigned int what)
Definition: select.h:32
osmo_nibble_shift_left_unal
void osmo_nibble_shift_left_unal(uint8_t *out, const uint8_t *in, unsigned int num_nibbles)
Shift unaligned input to octet-aligned output.
Definition: bits.c:96
osmo_stat_item_group_desc::num_items
const unsigned int num_items
The number of values in this group.
Definition: stat_item.h:52
PRIM_OP_INDICATION
@ PRIM_OP_INDICATION
indication
Definition: prim.h:19
osmo_stat_item_value
Definition: stat_item.h:18
osmo_conv_decoder::len
int len
Max o_idx (excl. termination)
Definition: conv.h:114
log_info_cat::name
const char * name
Definition: logging.h:117
bitvec::data_len
unsigned int data_len
length of data array in bytes
Definition: bitvec.h:61
osmo_crc8gen_set_bits
void osmo_crc8gen_set_bits(const struct osmo_crc8gen_code *code, const ubit_t *in, int len, ubit_t *crc_bits)
Computes and writes the CRC value of a given array of bits.
Definition: crc8gen.c:106
log_info_cat
Information regarding one logging category.
Definition: logging.h:116
bit_value
bit_value
A single GSM bit.
Definition: bitvec.h:51
osmo_conv_encoder
convolutional encoder state
Definition: conv.h:84
osmo_decode_big_endian
uint64_t osmo_decode_big_endian(const uint8_t *data, size_t data_len)
Generic retrieval of 1..8 bytes as big-endian uint64_t.
Definition: utils.c:326
log_level_str
const char * log_level_str(unsigned int lvl)
convert a numeric log level into human-readable string
Definition: logging.c:169
osmo_fsm_inst_alloc
struct osmo_fsm_inst * osmo_fsm_inst_alloc(struct osmo_fsm *fsm, void *ctx, void *priv, int log_level, const char *id)
allocate a new instance of a specified FSM
Definition: fsm.c:174
_osmo_fsm_inst_state_chg
int _osmo_fsm_inst_state_chg(struct osmo_fsm_inst *fi, uint32_t new_state, unsigned long timeout_secs, int T, const char *file, int line)
perform a state change of the given FSM instance
Definition: fsm.c:323
log_info
Logging configuration, passed to log_init.
Definition: logging.h:148
osmo_config_list
Definition: msgfile.h:42
llist_for_each_entry_safe
#define llist_for_each_entry_safe(pos, n, head, member)
iterate over llist of given type, safe against removal of non-consecutive(!) llist entries
Definition: linuxlist.h:299
osmo_stat_item_get_next
int osmo_stat_item_get_next(const struct osmo_stat_item *item, int32_t *idx, int32_t *value)
Retrieve the next value from the osmo_stat_item object. If a new value has been set,...
Definition: stat_item.c:138
gsmtap_osmocore_log_hdr::subsys
char subsys[16]
Definition: gsmtap.h:272
log_target_rb_used_size
size_t log_target_rb_used_size(struct log_target const *target)
Return the number of log strings in the osmo_strrb-backed target.
Definition: loggingrb.c:43
PRIM_OP_REQUEST
@ PRIM_OP_REQUEST
request
Definition: prim.h:17
gsmtap_source_add_sink_fd
int gsmtap_source_add_sink_fd(int gsmtap_fd)
Add a local sink to an existing GSMTAP source and return fd.
Definition: gsmtap_util.c:200
osmo_fsm_inst::proc
struct osmo_fsm_inst::@0 proc
support for fsm-based procedures
osmo_fsm_inst::child
struct llist_head child
llist_head linked to parent->proc.children
Definition: fsm.h:114
get_string_value
int get_string_value(const struct value_string *vs, const char *str)
get numeric value for given human-readable string
Definition: utils.c:87
gsmtap_source_init
struct gsmtap_inst * gsmtap_source_init(const char *host, uint16_t port, int ofd_wq_mode)
Open GSMTAP source socket, connect and register osmo_fd.
Definition: gsmtap_util.c:368
RATE_CTR_INTV_MIN
@ RATE_CTR_INTV_MIN
last minute
Definition: rate_ctr.h:19
DLLAPD
#define DLLAPD
Definition: logging.h:96
msgb_tailroom
static int msgb_tailroom(const struct msgb *msgb)
determine how much tail room is left in msgb
Definition: msgb.h:156
msgb::cb
unsigned long cb[5]
control buffer
Definition: msgb.h:60
get_value_string_or_null
const char * get_value_string_or_null(const struct value_string *vs, uint32_t val)
get human-readable string or NULL for given value
Definition: utils.c:67
msgb_set_talloc_ctx
void msgb_set_talloc_ctx(void *ctx) OSMO_DEPRECATED("Use msgb_talloc_ctx_init() instead")
Set the talloc context for msgb_alloc Deprecated, use msgb_talloc_ctx_init() instead.
Definition: msgb.c:157
osmo_stat_item_group_desc
description of a statistics value group
Definition: stat_item.h:44
chantype_rsl2gsmtap
uint8_t chantype_rsl2gsmtap(uint8_t rsl_chantype, uint8_t rsl_link_id)
convert RSL channel number to GSMTAP channel type
Definition: gsmtap_util.c:56
osmo_fd_unregister
void osmo_fd_unregister(struct osmo_fd *fd)
Unregister a file descriptor from select loop abstraction.
Definition: select.c:111
osmo_timers_update
int osmo_timers_update(void)
fire all timers... and remove them
Definition: timer.c:209
DLOAP
#define DLOAP
Definition: logging.h:106
osmo_conv_code::next_term_state
const uint8_t * next_term_state
Flush termination state
Definition: conv.h:67
osmo_fsm_term_cause
osmo_fsm_term_cause
Definition: fsm.h:20
llist_del_init
static void llist_del_init(struct llist_head *entry)
Delete entry from linked list and reinitialize it.
Definition: linuxlist.h:135
OSMO_NUM_DLIB
#define OSMO_NUM_DLIB
Definition: logging.h:107
osmo_conv_decoder::o_idx
int o_idx
output index
Definition: conv.h:116
log_set_print_filename
void log_set_print_filename(struct log_target *target, int print_filename)
Enable or disable printing of the filename while logging.
Definition: logging.c:546
log_target::print_filename
unsigned int print_filename
should log messages be prefixed with a filename?
Definition: logging.h:194
osmo_fd_is_registered
bool osmo_fd_is_registered(struct osmo_fd *fd)
Check if a file descriptor is already registered.
Definition: select.c:54
INIT_LLIST_HEAD
#define INIT_LLIST_HEAD(ptr)
initialize a llist_head to point back to self
Definition: linuxlist.h:63
osmo_gettimeofday_override_add
void osmo_gettimeofday_override_add(time_t secs, suseconds_t usecs)
convenience function to advance the fake time. Add the given values to osmo_gettimeofday_override_tim...
Definition: timer_gettimeofday.c:51
osmo_conv_encode
int osmo_conv_encode(const struct osmo_conv_code *code, const ubit_t *input, ubit_t *output)
All-in-one convolutional encoding function.
Definition: conv.c:213
crc32gen.h
osmo_strlcpy
size_t osmo_strlcpy(char *dst, const char *src, size_t siz)
Copy a C-string into a sized buffer.
Definition: utils.c:365
osmo_fsm_event_name
const char * osmo_fsm_event_name(struct osmo_fsm *fsm, uint32_t event)
get human-readable name of FSM event
Definition: fsm.c:259
statistics.h
Common routines regarding statistics.
osmo_fsm::allstate_event_mask
uint32_t allstate_event_mask
bit-mask of events permitted in all states
Definition: fsm.h:69
osmo_stats_reporter
Definition: stats.h:45
osmo_conv_decoder::code
const struct osmo_conv_code * code
for which code?
Definition: conv.h:110
container_of
#define container_of(ptr, type, member)
cast a member of a structure out to the containing structure
Definition: linuxlist.h:33
osmo_sock_unix_init
int osmo_sock_unix_init(uint16_t type, uint8_t proto, const char *socket_path, unsigned int flags)
Initialize a unix domain socket (including bind/connect)
Definition: socket.c:322
gsmtap_inst::sink_ofd
struct osmo_fd sink_ofd
file descriptor
Definition: gsmtap_util.h:26
osmo_revbytebits_buf
void osmo_revbytebits_buf(uint8_t *buf, int len)
reverse bit-order of each byte in a buffer
Definition: bits.c:282
msgb::len
uint16_t len
length of bytes used in msgb
Definition: msgb.h:63
osmo_daemonize
int osmo_daemonize(void)
Turn the current process into a background daemon.
Definition: application.c:120
log_target_create_gsmtap
struct log_target * log_target_create_gsmtap(const char *host, uint16_t port, const char *ident, bool ofd_wq_mode, bool add_sink)
Create a new logging target for GSMTAP logging.
Definition: logging_gsmtap.c:103
log_target_create_syslog
struct log_target * log_target_create_syslog(const char *ident, int option, int facility)
Create a new logging target for syslog logging.
Definition: logging_syslog.c:72
osmo_fsm_log_addr
void osmo_fsm_log_addr(bool log_addr)
specify if FSM instance addresses should be logged or not
Definition: fsm.c:101
osmo_conv_decoder::ae
unsigned int * ae
accumulated error
Definition: conv.h:119
osmo_fsm_inst
a single instanceof an osmocom finite state machine
Definition: fsm.h:84
bitvec_shiftl
void bitvec_shiftl(struct bitvec *bv, unsigned n)
Shifts bitvec to the left, n MSB bits lost.
Definition: bitvec.c:624
msgb_talloc_ctx_init
void * msgb_talloc_ctx_init(void *root_ctx, unsigned int pool_size)
Initialize a msgb talloc context for msgb_alloc. Create a talloc context called "msgb"....
Definition: msgb.c:170
osmo_counter::previous
unsigned long previous
previous value
Definition: statistics.h:12
osmo_stat_item_group::list
struct llist_head list
Linked list of all value groups in the system.
Definition: stat_item.h:60
LOG_TGT_TYPE_SYSLOG
@ LOG_TGT_TYPE_SYSLOG
syslog based logging
Definition: logging.h:168
bitvec_rl_curbit
unsigned bitvec_rl_curbit(struct bitvec *bv, bool b, int max_bits)
Return number (bits) of uninterrupted bit run in vector starting from the current bit.
Definition: bitvec.c:586
log_target::entry
struct llist_head entry
linked list
Definition: logging.h:177
log_category::loglevel
uint8_t loglevel
Definition: logging.h:111
osmo_fsm_state::onleave
void(* onleave)(struct osmo_fsm_inst *fi, uint32_t next_state)
function to be called just before leaving the state
Definition: fsm.h:53
rate_ctr_desc::description
const char * description
description of the counter
Definition: rate_ctr.h:41
osmo_signal_unregister_handler
void osmo_signal_unregister_handler(unsigned int subsys, osmo_signal_cbfn *cbfn, void *data)
Unregister signal handler.
Definition: signal.c:78
log_target::use_color
unsigned int use_color
should color be used when printing log messages?
Definition: logging.h:190
osmo_counter
Definition: statistics.h:7
osmo_stat_item::values
struct osmo_stat_item_value values[0]
value fifo
Definition: stat_item.h:31
osmo_fsm
a description of an osmocom finite state machine
Definition: fsm.h:57
msgb_length
uint16_t msgb_length(const struct msgb *msg)
get length of message buffer
Definition: msgb.c:148
sbit_t
int8_t sbit_t
soft bit (-127...127)
Definition: bits.h:22
log_targets_reopen
int log_targets_reopen(void)
close and re-open all log files (for log file rotation)
Definition: logging.c:749
osmo_serial_set_baudrate
int osmo_serial_set_baudrate(int fd, speed_t baudrate)
Change current baudrate.
Definition: serial.c:159
llist_del
static void llist_del(struct llist_head *entry)
Delete entry from linked list.
Definition: linuxlist.h:125
value_string::value
unsigned int value
numeric value
Definition: utils.h:28
osmo_get_macaddr
int osmo_get_macaddr(uint8_t *mac_out, const char *dev_name)
Obtain the MAC address of a given network device.
Definition: macaddr.c:120
osmo_init_ignore_signals
void osmo_init_ignore_signals(void)
Ignore SIGPIPE, SIGALRM, SIGHUP and SIGIO.
Definition: application.c:81
osmo_sock_unix_init_ofd
int osmo_sock_unix_init_ofd(struct osmo_fd *ofd, uint16_t type, uint8_t proto, const char *socket_path, unsigned int flags)
Initialize a unix domain socket and fill osmo_fd.
Definition: socket.c:395
gsmtap_hdr::signal_dbm
int8_t signal_dbm
Definition: gsmtap.h:249
osmo_strrb_is_empty
bool osmo_strrb_is_empty(const struct osmo_strrb *rb)
Check if an osmo_strrb is empty.
Definition: strrb.c:89
osmo_timer_list::timeout
struct timeval timeout
expiration time
Definition: timer.h:57
OSMO_SOCK_F_NONBLOCK
#define OSMO_SOCK_F_NONBLOCK
Definition: socket.h:22
bits.h
Osmocom bit level support code.
log_target::print_ext_timestamp
unsigned int print_ext_timestamp
should log messages be prefixed with an extended timestamp?
Definition: logging.h:198
log_target::loglevel
uint8_t loglevel
global log level
Definition: logging.h:188
gsmtap_hdr::sub_type
uint8_t sub_type
Definition: gsmtap.h:254
osmo_crc64gen_set_bits
void osmo_crc64gen_set_bits(const struct osmo_crc64gen_code *code, const ubit_t *in, int len, ubit_t *crc_bits)
Computes and writes the CRC value of a given array of bits.
Definition: crc64gen.c:106
osmo_stat_item_discard_all
int osmo_stat_item_discard_all(int32_t *idx)
Skip all values of all items and update idx accordingly.
Definition: stat_item.c:185
osmo_fsm::allstate_action
void(* allstate_action)(struct osmo_fsm_inst *fi, uint32_t event, void *data)
function pointer to be called for allstate events
Definition: fsm.h:71
osmo_stats_config
Definition: stats.h:84
osmo_sock_init_ofd
int osmo_sock_init_ofd(struct osmo_fd *ofd, int family, int type, int proto, const char *host, uint16_t port, unsigned int flags)
Initialize a socket and fill osmo_fd.
Definition: socket.c:206
log_info::num_cat_user
unsigned int num_cat_user
total number of user categories (not library)
Definition: logging.h:157
BSC_FD_READ
#define BSC_FD_READ
Indicate interest in reading from the file descriptor.
Definition: select.h:15
osmo_stat_item::last_value_index
int32_t last_value_index
the index of the freshest value
Definition: stat_item.h:27
msgb
Osmocom message buffer.
Definition: msgb.h:43
osmo_conv_code::next_output
const uint8_t(* next_output)[2]
Next output array.
Definition: conv.h:63
osmo_crc32gen_compute_bits
uint32_t osmo_crc32gen_compute_bits(const struct osmo_crc32gen_code *code, const ubit_t *in, int len)
Compute the CRC value of a given array of hard-bits.
Definition: crc32gen.c:46
timer_compat.h
Compatibility header with some helpers.
LOGL_INFO
#define LOGL_INFO
general information
Definition: logging.h:87
osmo_stat_item_discard
int osmo_stat_item_discard(const struct osmo_stat_item *item, int32_t *idx)
Skip all values of the item and update idx accordingly.
Definition: stat_item.c:176
DLMI
#define DLMI
Definition: logging.h:99
log_target
structure representing a logging target
Definition: logging.h:176
strrb.h
Osmocom string ringbuffer handling routines.
log_info::cat
const struct log_info_cat * cat
per-category information
Definition: logging.h:153
osmo_strrb_add
int osmo_strrb_add(struct osmo_strrb *rb, const char *data)
Add a string to the osmo_strrb.
Definition: strrb.c:149
rate_ctr_get_by_name
const struct rate_ctr * rate_ctr_get_by_name(const struct rate_ctr_group *ctrg, const char *name)
Search for counter based on group + name.
Definition: rate_ctr.c:181
rb_root
Definition: linuxrbtree.h:110
osmo_signal_register_handler
int osmo_signal_register_handler(unsigned int subsys, osmo_signal_cbfn *cbfn, void *data)
Register a new signal handler.
Definition: signal.c:51
gsmtap_inst
one gsmtap instance
Definition: gsmtap_util.h:23
osmo_wqueue::read_cb
int(* read_cb)(struct osmo_fd *fd)
call-back in case qeueue is readable
Definition: write_queue.h:48
gsmtap_hdr::type
uint8_t type
Definition: gsmtap.h:245
osmo_fd::list
struct llist_head list
Definition: select.h:24
log_target::raw_output
void(* raw_output)(struct log_target *target, int subsys, unsigned int level, const char *file, int line, int cont, const char *format, va_list ap)
alternative call-back function to which the logging framework passes the unfortmatted input arguments...
Definition: logging.h:250
osmo_fsm_inst_free
void osmo_fsm_inst_free(struct osmo_fsm_inst *fi)
delete a given instance of a FSM
Definition: fsm.c:246
msgb_resize_area
int msgb_resize_area(struct msgb *msg, uint8_t *area, int old_size, int new_size)
Resize an area within an msgb.
Definition: msgb.c:230
msgb::l1h
unsigned char * l1h
pointer to Layer1 header (if any)
Definition: msgb.h:55
utils.h
BSC_FD_WRITE
#define BSC_FD_WRITE
Indicate interest in writing to the file descriptor.
Definition: select.h:17
osmo_fsm_unregister
void osmo_fsm_unregister(struct osmo_fsm *fsm)
unregister a FSM from the core
Definition: fsm.c:141
osmo_stat_item_desc::unit
const char * unit
unit of a value
Definition: stat_item.h:38
osmo_fsm_inst_dispatch
#define osmo_fsm_inst_dispatch(fi, event, data)
dispatch an event to an osmocom finite state machine instance
Definition: fsm.h:174
osmo_conv_decoder
convolutional decoder state
Definition: conv.h:109
osmo_fsm::states
const struct osmo_fsm_state * states
table of state transition rules
Definition: fsm.h:65
log_info::num_cat
unsigned int num_cat
total number of categories
Definition: logging.h:155
rate_ctr_group
One instance of a counter group class.
Definition: rate_ctr.h:59
_osmo_fsm_inst_term_children
void _osmo_fsm_inst_term_children(struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause, void *data, const char *file, int line)
Terminate all child FSM instances of an FSM instance.
Definition: fsm.c:479
gsmtap_send
int gsmtap_send(struct gsmtap_inst *gti, uint16_t arfcn, uint8_t ts, uint8_t chan_type, uint8_t ss, uint32_t fn, int8_t signal_dbm, uint8_t snr, const uint8_t *data, unsigned int len)
send a message from L1/L2 through GSMTAP. See gsmtap_makemsg for arguments
Definition: gsmtap_util.c:273
osmo_panic
void osmo_panic(const char *fmt,...)
Terminate the current program with a panic.
Definition: panic.c:76
msgb_free
void msgb_free(struct msgb *m)
Release given message buffer.
Definition: msgb.c:72
log_set_print_timestamp
void log_set_print_timestamp(struct log_target *target, int print_timestamp)
Enable or disable printing of timestamps while logging.
Definition: logging.c:524
CONV_TERM_TAIL_BITING
@ CONV_TERM_TAIL_BITING
Tail biting.
Definition: conv.h:47
OSMO_FSM_TERM_PARENT
@ OSMO_FSM_TERM_PARENT
terminate because parent terminated
Definition: fsm.h:22
rate_ctr_get_group_by_name_idx
struct rate_ctr_group * rate_ctr_get_group_by_name_idx(const char *name, const unsigned int idx)
Search for counter group based on group name and index.
Definition: rate_ctr.c:160
log_del_target
void log_del_target(struct log_target *target)
Unregister a log target from the logging core.
Definition: logging.c:463
osmo_timer_list::data
void * data
user data for callback
Definition: timer.h:61
osmo_bit_reversal
uint32_t osmo_bit_reversal(uint32_t x, enum osmo_br_mode k)
generic bit reversal function
Definition: bits.c:235
osmo_ubit_dump
char * osmo_ubit_dump(const uint8_t *bits, unsigned int len)
Convert a sequence of unpacked bits to ASCII string.
Definition: utils.c:200
value_string::str
const char * str
human-readable string
Definition: utils.h:29
osmo_wqueue_enqueue
int osmo_wqueue_enqueue(struct osmo_wqueue *queue, struct msgb *data)
Enqueue a new Message buffers into a write queue.
Definition: write_queue.c:107
DLCTRL
#define DLCTRL
Definition: logging.h:102
osmo_fsm_inst::parent
struct osmo_fsm_inst * parent
the parent FSM that has created us
Definition: fsm.h:108
timer.h
Osmocom timer handling routines.
rate_ctr_group::list
struct llist_head list
Linked list of all counter groups in the system.
Definition: rate_ctr.h:61
osmo_timer_schedule
void osmo_timer_schedule(struct osmo_timer_list *timer, int seconds, int microseconds)
schedule a timer at a given future relative time
Definition: timer.c:90
t4_rle
static int t4_rle(struct bitvec *bv, unsigned len, bool b)
Make-up codes for a given length.
Definition: bitcomp.c:230
osmo_sockaddr_is_local
int osmo_sockaddr_is_local(struct sockaddr *addr, unsigned int addrlen)
Determine if the given address is a local address.
Definition: socket.c:291
rate_ctr_group_desc::num_ctr
const unsigned int num_ctr
The number of counters in this group.
Definition: rate_ctr.h:53
crc16gen.h
bitvec_add_array
unsigned int bitvec_add_array(struct bitvec *bv, const uint32_t *array, unsigned int array_len, bool dry_run, unsigned int num_bits)
Add given array to bitvec.
Definition: bitvec.c:666
osmo_revbytebits_32
uint32_t osmo_revbytebits_32(uint32_t x)
reverse the bit-order in each byte of a dword
Definition: bits.c:252
osmo_wqueue
Definition: write_queue.h:36
osmo_signal_dispatch
void osmo_signal_dispatch(unsigned int subsys, unsigned int signal, void *signal_data)
dispatch (deliver) a new signal to all registered handlers
Definition: signal.c:98
osmo_gettimeofday_override
bool osmo_gettimeofday_override
Definition: timer_gettimeofday.c:33
gsmtap_hdr::sub_slot
uint8_t sub_slot
Definition: gsmtap.h:256
osmo_timers_prepare
void osmo_timers_prepare(void)
Find the nearest time and update nearest_p.
Definition: timer.c:191
osmo_fd::when
unsigned int when
Definition: select.h:29
DLMIB
#define DLMIB
Definition: logging.h:100
gsmtap_source_add_sink
int gsmtap_source_add_sink(struct gsmtap_inst *gti)
Add a local sink to an existing GSMTAP source and return fd.
Definition: gsmtap_util.c:331
msgb::tail
unsigned char * tail
end of message in buffer
Definition: msgb.h:66
osmo_fsm::cleanup
void(* cleanup)(struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause)
clean-up function, called during termination
Definition: fsm.h:73
osmo_init_logging
int osmo_init_logging(const struct log_info *log_info)
Initialize the osmocom logging framework.
Definition: application.c:103
osmo_timers_nearest
struct timeval * osmo_timers_nearest(void)
Determine time between now and the nearest timer.
Definition: timer.c:166
osmo_serial_init
int osmo_serial_init(const char *dev, speed_t baudrate)
Open serial device and does base init.
Definition: serial.c:60
log_set_use_color
void log_set_use_color(struct log_target *target, int use_color)
Enable or disable the use of colored output.
Definition: logging.c:515
osmo_panic_handler_t
void(* osmo_panic_handler_t)(const char *fmt, va_list args)
panic handler callback function type
Definition: panic.h:12
osmo_plugin_load_all
int osmo_plugin_load_all(const char *directory)
Load all plugins available in given directory.
Definition: plugin.c:44
msgb::l4h
unsigned char * l4h
pointer to layer 4 header
Definition: msgb.h:58
osmo_fsm_inst::name
const char * name
human readable fully-qualified name
Definition: fsm.h:92
rate_ctr_group::ctr
struct rate_ctr ctr[0]
Actual counter structures below.
Definition: rate_ctr.h:67
rate_ctr_group_alloc
struct rate_ctr_group * rate_ctr_group_alloc(void *ctx, const struct rate_ctr_group_desc *desc, unsigned int idx)
Allocate a new group of counters according to description.
Definition: rate_ctr.c:48
osmo_fsm_inst::state
uint32_t state
current state of the FSM
Definition: fsm.h:98
osmo_config_entry
Definition: msgfile.h:29
log_target::print_category
unsigned int print_category
should log messages be prefixed with a category name?
Definition: logging.h:196
gsmtap_makemsg_ex
struct msgb * gsmtap_makemsg_ex(uint8_t type, uint16_t arfcn, uint8_t ts, uint8_t chan_type, uint8_t ss, uint32_t fn, int8_t signal_dbm, uint8_t snr, const uint8_t *data, unsigned int len)
create an arbitrary type GSMTAP message
Definition: gsmtap_util.c:107
osmo_stat_item_get_last
static int32_t osmo_stat_item_get_last(const struct osmo_stat_item *item)
Get the last (freshest) value.
Definition: stat_item.h:133
osmo_set_panic_handler
void osmo_set_panic_handler(osmo_panic_handler_t h)
Set the panic handler.
Definition: panic.c:97
log_init
void int log_init(const struct log_info *inf, void *talloc_ctx)
Initialize the Osmocom logging core.
Definition: logging.c:912
osmo_stat_item::last_offs
int16_t last_offs
offset to the freshest value in the value fifo
Definition: stat_item.h:29
rate_ctr_desc::name
const char * name
name of the counter
Definition: rate_ctr.h:40
pbit_t
uint8_t pbit_t
packed bis (8 bits in a byte)
Definition: bits.h:24
osmo_strrb_create
struct osmo_strrb * osmo_strrb_create(TALLOC_CTX *ctx, size_t rb_size)
Create an empty, initialized osmo_strrb.
Definition: strrb.c:56
osmo_fsm::timer_cb
int(* timer_cb)(struct osmo_fsm_inst *fi)
timer call-back for states with time-out.
Definition: fsm.h:76
log_target_create_rb
struct log_target * log_target_create_rb(size_t size)
Create a new logging target for ringbuffer-backed logging.
Definition: loggingrb.c:76
osmo_revbytebits_8
uint32_t osmo_revbytebits_8(uint8_t x)
reverse the bit order in a byte
Definition: bits.c:267
gsmtap_sendmsg
int gsmtap_sendmsg(struct gsmtap_inst *gti, struct msgb *msg)
Send a Message buffers through a GSMTAP source.
Definition: gsmtap_util.c:225
log_target_create_file
struct log_target * log_target_create_file(const char *fname)
Create a new file-based log target.
Definition: logging.c:664
osmo_sbit2ubit
void osmo_sbit2ubit(ubit_t *out, const sbit_t *in, unsigned int num_bits)
convert soft bits to unpacked bits
Definition: bits.c:129
osmo_bcd2char
char osmo_bcd2char(uint8_t bcd)
Convert BCD-encoded digit into printable character.
Definition: utils.c:104
log_target::type
enum log_target_type type
the type of this log taget
Definition: logging.h:201
osmo_wqueue::except_cb
int(* except_cb)(struct osmo_fd *fd)
call-back in case qeueue has exceptions
Definition: write_queue.h:52
llist_head
(double) linked list header structure
Definition: linuxlist.h:47
signal.h
osmo_fd_init_ofd
static int osmo_fd_init_ofd(struct osmo_fd *ofd, int sfd)
fill osmo_fd for a give sfd
Definition: socket.c:174
gsmtap_inst::wq
struct osmo_wqueue wq
the wait queue
Definition: gsmtap_util.h:25
osmo_prim_op_names
const struct value_string osmo_prim_op_names[5]
human-readable string mapping for osmo_prim_operation
Definition: prim.c:6
osmo_signal_cbfn
int osmo_signal_cbfn(unsigned int subsys, unsigned int signal, void *handler_data, void *signal_data)
Definition: signal.h:34
osmo_stat_item_group_alloc
struct osmo_stat_item_group * osmo_stat_item_group_alloc(void *ctx, const struct osmo_stat_item_group_desc *desc, unsigned int idx)
Allocate a new group of counters according to description.
Definition: stat_item.c:50
osmo_timer_list::list
struct llist_head list
internal list header
Definition: timer.h:56
osmo_conv_decode
int osmo_conv_decode(const struct osmo_conv_code *code, const sbit_t *input, ubit_t *output)
All-in-one convolutional decoding function.
Definition: conv.c:603
log_parse_category_mask
void log_parse_category_mask(struct log_target *target, const char *_mask)
parse the log category mask
Definition: logging.c:199
LOG_TGT_TYPE_FILE
@ LOG_TGT_TYPE_FILE
text file logging
Definition: logging.h:169
log_reset_context
void log_reset_context(void)
Reset (clear) the logging context.
Definition: logging.c:469
osmo_hexparse
int osmo_hexparse(const char *str, uint8_t *b, int max_len)
Parse a string containing hexadecimal digits.
Definition: utils.c:127
osmo_fsm_inst::T
int T
timer number for states with time-out
Definition: fsm.h:101
bitvec_write_field
int bitvec_write_field(struct bitvec *bv, unsigned int *write_index, uint64_t val, unsigned int len)
write into the vector
Definition: bitvec.c:485
osmo_timer_pending
int osmo_timer_pending(struct osmo_timer_list *timer)
check if given timer is still pending
Definition: timer.c:125
bitvec_alloc
struct bitvec * bitvec_alloc(unsigned int size, TALLOC_CTX *bvctx)
Allocate a bit vector.
Definition: bitvec.c:383
msgb_trim
static int msgb_trim(struct msgb *msg, int len)
Trim the msgb to a given absolute length.
Definition: msgb.h:405
DLMUX
#define DLMUX
Definition: logging.h:98
osmo_wqueue_init
void osmo_wqueue_init(struct osmo_wqueue *queue, int max_length)
Initialize a osmo_wqueue structure.
Definition: write_queue.c:91
osmo_timer_list::node
struct rb_node node
rb-tree node header
Definition: timer.h:55
gsmtap_hdr::timeslot
uint8_t timeslot
Definition: gsmtap.h:246
OSMO_FSM_TERM_REQUEST
@ OSMO_FSM_TERM_REQUEST
terminate on explicit user request
Definition: fsm.h:24
msgb.h
Osmocom message buffers The Osmocom message buffers are modelled after the 'struct skb' inside the Li...
LOG_TGT_TYPE_GSMTAP
@ LOG_TGT_TYPE_GSMTAP
GSMTAP network logging.
Definition: logging.h:172
stat_item.h
OSMO_VALUE_STRING
#define OSMO_VALUE_STRING(x)
Make a value_string entry from an enum value name.
Definition: utils.h:21
bitvec
structure describing a bit vector
Definition: bitvec.h:59
bitvec_to_string_r
void bitvec_to_string_r(const struct bitvec *bv, char *str)
prints bit vector to provided string It's caller's responsibility to ensure that we won't shoot him i...
Definition: bitvec.c:520
osmo_counters_for_each
int osmo_counters_for_each(int(*handle_counter)(struct osmo_counter *, void *), void *data)
Iterate over all counters.
Definition: statistics.c:52
osmo_fsm::num_states
unsigned int num_states
number of entries in states
Definition: fsm.h:67
osmo_fsm_state::action
void(* action)(struct osmo_fsm_inst *fi, uint32_t event, void *data)
function to be called for events arriving in this state
Definition: fsm.h:49
serial.h
rate_ctr_group_desc::group_name_prefix
const char * group_name_prefix
The prefix to the name of all counters in this group.
Definition: rate_ctr.h:47
log_target_rb_get
const char * log_target_rb_get(struct log_target const *target, size_t logindex)
Return the nth log entry in a target.
Definition: loggingrb.c:67
rate_ctr_difference
int64_t rate_ctr_difference(struct rate_ctr *ctr)
Return the counter difference since the last call to this function.
Definition: rate_ctr.c:87
log_set_log_level
void log_set_log_level(struct log_target *target, int log_level)
Set the global log level for a given log target.
Definition: logging.c:566
llist_for_each_entry
#define llist_for_each_entry(pos, head, member)
Iterate over llist of given type.
Definition: linuxlist.h:260
osmo_encode_big_endian
uint8_t * osmo_encode_big_endian(uint64_t value, size_t data_len)
Generic big-endian encoding of big endian number up to 64bit.
Definition: utils.c:347
osmo_counter_free
void osmo_counter_free(struct osmo_counter *ctr)
Free the specified counter.
Definition: statistics.c:46
osmo_stat_item_group::desc
const struct osmo_stat_item_group_desc * desc
Pointer to the counter group class.
Definition: stat_item.h:62
osmo_fsm_inst::id
const char * id
human readable identifier
Definition: fsm.h:90
OSMO_FSM_TERM_TIMEOUT
@ OSMO_FSM_TERM_TIMEOUT
termination due to time-out
Definition: fsm.h:30
osmo_stat_item_get_group_by_name_idx
struct osmo_stat_item_group * osmo_stat_item_get_group_by_name_idx(const char *name, const unsigned int idx)
Search for item group based on group name and index.
Definition: stat_item.c:202
LOGL_NOTICE
#define LOGL_NOTICE
abnormal/unexpected condition
Definition: logging.h:88
rate_ctr_intv
rate_ctr_intv
Rate counter interval.
Definition: rate_ctr.h:17
ONE
@ ONE
A one (1) bit.
Definition: bitvec.h:53
osmo_conv_code::next_state
const uint8_t(* next_state)[2]
Next state array
Definition: conv.h:64
osmo_conv_encoder::code
const struct osmo_conv_code * code
for which code?
Definition: conv.h:85
osmo_generate_backtrace
void osmo_generate_backtrace(void)
Generate and print a call back-trace.
Definition: backtrace.c:67
llist_add
static void llist_add(struct llist_head *_new, struct llist_head *head)
add a new entry into a linked list (at head)
Definition: linuxlist.h:89
osmo_stat_item_desc::name
const char * name
name of the item
Definition: stat_item.h:36
logp
void logp(int subsys, const char *file, int line, int cont, const char *format,...)
logging function used by DEBUGP() macro
Definition: logging.c:426
value_string
A mapping between human-readable string and numeric value.
Definition: utils.h:27
log_set_print_category
void log_set_print_category(struct log_target *target, int print_category)
Enable or disable printing of the category name.
Definition: logging.c:557
osmo_fsm_inst_name
const char * osmo_fsm_inst_name(struct osmo_fsm_inst *fi)
get human-readable name of FSM instance
Definition: fsm.c:273
msgb_copy
struct msgb * msgb_copy(const struct msgb *msg, const char *name)
Copy an msgb.
Definition: msgb.c:188
CONV_TERM_FLUSH
@ CONV_TERM_FLUSH
Flush encoder state.
Definition: conv.h:45
osmo_crc32gen_check_bits
int osmo_crc32gen_check_bits(const struct osmo_crc32gen_code *code, const ubit_t *in, int len, const ubit_t *crc_bits)
Checks the CRC value of a given array of hard-bits.
Definition: crc32gen.c:81
osmo_conv_code::K
int K
Constraint length.
Definition: conv.h:58
log_set_category_filter
void log_set_category_filter(struct log_target *target, int category, int enable, int level)
Set a category filter on a given log target.
Definition: logging.c:577
msgb_reset
void msgb_reset(struct msgb *m)
Re-set all message buffer pointers.
Definition: msgb.c:119
fsm.h
Finite State Machine.
msgb_hexdump
const char * msgb_hexdump(const struct msgb *msg)
Return a (static) buffer containing a hexdump of the msg.
Definition: msgb.c:275
log_target_create_stderr
struct log_target * log_target_create_stderr(void)
Create the STDERR log target.
Definition: logging.c:640
osmo_strrb_get_nth
const char * osmo_strrb_get_nth(const struct osmo_strrb *rb, unsigned int string_index)
Return a pointer to the Nth string in the osmo_strrb.
Definition: strrb.c:103
gsmtap_osmocore_log_hdr::line_nr
uint32_t line_nr
Definition: gsmtap.h:275
osmo_conv_code::puncture
const int * puncture
Punctured bits indexes.
Definition: conv.h:69
osmo_fsm_inst::fsm
struct osmo_fsm * fsm
back-pointer to the FSM of which we are an instance
Definition: fsm.h:88
msgb::lchan
struct gsm_lchan * lchan
logical channel
Definition: msgb.h:53
osmo_crc16gen_compute_bits
uint16_t osmo_crc16gen_compute_bits(const struct osmo_crc16gen_code *code, const ubit_t *in, int len)
Compute the CRC value of a given array of hard-bits.
Definition: crc16gen.c:46
log_target_destroy
void log_target_destroy(struct log_target *target)
Unregister, close and delete a log target.
Definition: logging.c:708
llist_add_tail
static void llist_add_tail(struct llist_head *_new, struct llist_head *head)
add a new entry into a linked list (at tail)
Definition: linuxlist.h:101
bitvec_set_bytes
int bitvec_set_bytes(struct bitvec *bv, const uint8_t *bytes, unsigned int count)
set multiple bytes at current pos Assumes MSB first encoding.
Definition: bitvec.c:346
ubit_t
uint8_t ubit_t
unpacked bit (0 or 1)
Definition: bits.h:23
ARRAY_SIZE
#define ARRAY_SIZE(x)
Determine number of elements in an array of static size.
Definition: utils.h:13
osmo_fsm_state::onenter
void(* onenter)(struct osmo_fsm_inst *fi, uint32_t prev_state)
function to be called just after entering the state
Definition: fsm.h:51
log_check_level
int log_check_level(int subsys, unsigned int level)
Check whether a log entry will be generated.
Definition: logging.c:972
osmo_fsm::instances
struct llist_head instances
list of instances of this FSM
Definition: fsm.h:61
osmo_wqueue::bfd
struct osmo_fd bfd
osmocom file descriptor
Definition: write_queue.h:38
osmo_conv_code::N
int N
Inverse of code rate.
Definition: conv.h:57
rate_ctr::previous
uint64_t previous
previous value, used for delta
Definition: rate_ctr.h:33
gsmtap_osmocore_log_hdr
Structure of the GTMTAP libosmocore logging header.
Definition: gsmtap.h:262
osmo_conv_code::next_term_output
const uint8_t * next_term_output
Flush termination output.
Definition: conv.h:66
osmo_stat_item_group_desc::group_name_prefix
const char * group_name_prefix
The prefix to the name of all values in this group.
Definition: stat_item.h:46
osmo_br_mode
osmo_br_mode
bit-reversal mode for osmo_bit_reversal()
Definition: bits.h:85
osmo_timer_list::cb
void(* cb)(void *)
call-back called at timeout
Definition: timer.h:60
log_target::output
void(* output)(struct log_target *target, unsigned int level, const char *string)
call-back function to be called when the logging framework wants to log a fully formatted string
Definition: logging.h:235
RB_MAX_MESSAGE_SIZE
#define RB_MAX_MESSAGE_SIZE
A structure representing an osmocom string ringbuffer.
Definition: strrb.h:38
log_target::categories
struct log_category * categories
logging categories
Definition: logging.h:185
osmo_timer_del
void osmo_timer_del(struct osmo_timer_list *timer)
delete a timer from timer management
Definition: timer.c:107
osmo_fsm_register
int osmo_fsm_register(struct osmo_fsm *fsm)
register a FSM with the core
Definition: fsm.c:124
osmo_counter_difference
int osmo_counter_difference(struct osmo_counter *ctr)
Return the counter difference since the last call to this function.
Definition: statistics.c:78
osmo_counter::name
const char * name
human-readable name
Definition: statistics.h:9
llist_entry
#define llist_entry(ptr, type, member)
Get the struct containing this list entry.
Definition: linuxlist.h:215
LOGPSRC
#define LOGPSRC(ss, level, caller_file, caller_line, fmt, args...)
Log through the Osmocom logging framework with explicit source. If caller_file is passed as NULL,...
Definition: logging.h:75
msgb::l2h
unsigned char * l2h
pointer to A-bis layer 2 header: OML, RSL(RLL), NS
Definition: msgb.h:56
logging.h
osmo_strrb::end
uint16_t end
index of the last slot
Definition: strrb.h:41
osmo_crc16gen_code
structure describing a given CRC code of max 16 bits
Definition: crc16gen.h:39
DLSTATS
#define DLSTATS
Definition: logging.h:104
msgb::data_len
uint16_t data_len
length of underlying data array
Definition: msgb.h:62
rate_ctr::current
uint64_t current
current value
Definition: rate_ctr.h:32
log_set_context
int log_set_context(uint8_t ctx_nr, void *value)
Set the logging context.
Definition: logging.c:485
LLIST_HEAD
#define LLIST_HEAD(name)
define a statically-initialized llist_head
Definition: linuxlist.h:59
log_target_file_reopen
int log_target_file_reopen(struct log_target *target)
close and re-open a log file (for log file rotation)
Definition: logging.c:734
bitvec_zero
void bitvec_zero(struct bitvec *bv)
force bit vector to all 0 and current bit to the beginnig of the vector
Definition: bitvec.c:556
socket.h
Osmocom socket convenience functions.
osmo_fsm_state_name
const char * osmo_fsm_state_name(struct osmo_fsm *fsm, uint32_t state)
get human-readable name of FSM instance
Definition: fsm.c:289
osmo_serial_clear_custom_baudrate
int osmo_serial_clear_custom_baudrate(int fd)
Clear any custom baudrate.
Definition: serial.c:221
rate_ctr::intv
struct rate_ctr_per_intv intv[RATE_CTR_INTV_NUM]
per-interval data
Definition: rate_ctr.h:35
gsmtap_hdr::snr_db
int8_t snr_db
Definition: gsmtap.h:250
msgb_data
uint8_t * msgb_data(const struct msgb *msg)
get pointer to data section of message buffer
Definition: msgb.c:139
select.h
select loop abstraction
osmo_fsm_inst_alloc_child
struct osmo_fsm_inst * osmo_fsm_inst_alloc_child(struct osmo_fsm *fsm, struct osmo_fsm_inst *parent, uint32_t parent_term_event)
allocate a new instance of a specified FSM as child of other FSM instance
Definition: fsm.c:220
log_vty_command_description
const char * log_vty_command_description(const struct log_info *unused_info)
Generates the logging command description for VTY.
Definition: logging.c:850
H
@ H
A CSN.1 "H" bit.
Definition: bitvec.h:55
osmo_fsm_inst::parent_term_event
uint32_t parent_term_event
the event we should send upon termination
Definition: fsm.h:110
panic.h
bitvec.h
Osmocom bit vector abstraction.
rate_ctr.h
rb_node
Definition: linuxrbtree.h:100
log_target_rb_avail_size
size_t log_target_rb_avail_size(struct log_target const *target)
Return the capacity of the osmo_strrb-backed target.
Definition: loggingrb.c:55
osmo_timer_list::active
unsigned int active
is it active?
Definition: timer.h:58
DLGLOBAL
#define DLGLOBAL
Definition: logging.h:95
signal_handler
Definition: signal.c:37
bitvec_rl
unsigned bitvec_rl(const struct bitvec *bv, bool b)
Return number (bits) of uninterrupted bit run in vector starting from the MSB.
Definition: bitvec.c:567
gsmtap_hdr
Structure of the GTMTAP pseudo-header.
Definition: gsmtap.h:242
osmo_fd
Structure representing a file dsecriptor.
Definition: select.h:22
osmo_fsm_state::in_event_mask
uint32_t in_event_mask
bit-mask of permitted input events for this state
Definition: fsm.h:43
log_parse_category
int log_parse_category(const char *category)
parse a human-readable log category into numeric form
Definition: logging.c:178
log_category::enabled
uint8_t enabled
Definition: logging.h:112
LOG_MAX_CTX
#define LOG_MAX_CTX
Maximum number of logging contexts.
Definition: logging.h:17
bitvec_get_bit_pos_high
enum bit_value bitvec_get_bit_pos_high(const struct bitvec *bv, unsigned int bitnr)
check if the bit is L or H for a given position inside a bitvec
Definition: bitvec.c:102
osmo_counter_get_by_name
struct osmo_counter * osmo_counter_get_by_name(const char *name)
Resolve counter by human-readable name.
Definition: statistics.c:67
LOGP
#define LOGP(ss, level, fmt, args...)
Log a new message through the Osmocom logging framework.
Definition: logging.h:48
bitvec_spare_padding
int bitvec_spare_padding(struct bitvec *bv, unsigned int up_to_bit)
pad all remaining bits up to num_bits
Definition: bitvec.c:279
bit_value_to_char
char bit_value_to_char(enum bit_value v)
convert enum to corresponding character
Definition: bitvec.c:505
msgb_alloc
struct msgb * msgb_alloc(uint16_t size, const char *name)
Allocate a new message buffer.
Definition: msgb.c:49
bitvec::cur_bit
unsigned int cur_bit
cursor to the next unused bit
Definition: bitvec.h:60
llist_empty
static int llist_empty(const struct llist_head *head)
Test whether a linked list is empty.
Definition: linuxlist.h:166
osmo_conv_code::len
int len
# of data bits
Definition: conv.h:59
osmo_timers_check
int osmo_timers_check(void)
Check how many timers we have in the system.
Definition: timer.c:255
osmo_ubit2sbit
void osmo_ubit2sbit(sbit_t *out, const ubit_t *in, unsigned int num_bits)
convert unpacked bits to soft bits
Definition: bits.c:117
BSC_FD_EXCEPT
#define BSC_FD_EXCEPT
Indicate interest in exceptions from the file descriptor.
Definition: select.h:19
osmo_crc64gen_compute_bits
uint64_t osmo_crc64gen_compute_bits(const struct osmo_crc64gen_code *code, const ubit_t *in, int len)
Compute the CRC value of a given array of hard-bits.
Definition: crc64gen.c:46
osmo_log_backtrace
void osmo_log_backtrace(int subsys, int level)
Generate and log a call back-trace.
Definition: backtrace.c:79
log_target::print_timestamp
unsigned int print_timestamp
should log messages be prefixed with a timestamp?
Definition: logging.h:192
osmo_crc32gen_code
structure describing a given CRC code of max 32 bits
Definition: crc32gen.h:39
osmo_hexdump_nospc
char * osmo_hexdump_nospc(const unsigned char *buf, int len)
Convert binary sequence to hexadecimal ASCII string.
Definition: utils.c:251
osmo_counter::description
const char * description
humn-readable description
Definition: statistics.h:10
osmo_fsm::event_names
const struct value_string * event_names
human-readable names of events
Definition: fsm.h:80
osmo_fd_get_by_fd
struct osmo_fd * osmo_fd_get_by_fd(int fd)
find an osmo_fd based on the integer fd
Definition: select.c:213
osmo_conv_decoder::n_states
int n_states
number of states
Definition: conv.h:112
osmo_wqueue_bfd_cb
int osmo_wqueue_bfd_cb(struct osmo_fd *fd, unsigned int what)
Select loop function for write queue handling.
Definition: write_queue.c:42
osmo_fsm_state::out_state_mask
uint32_t out_state_mask
bit-mask to which other states this state may transiton
Definition: fsm.h:45
log_target_create
struct log_target * log_target_create(void)
Create a new log target skeleton.
Definition: logging.c:602
osmo_hexdump
char * osmo_hexdump(const unsigned char *buf, int len)
Convert binary sequence to hexadecimal ASCII string.
Definition: utils.c:238
rate_ctr_group_desc
description of a rate counter group
Definition: rate_ctr.h:45
osmo_crc8gen_check_bits
int osmo_crc8gen_check_bits(const struct osmo_crc8gen_code *code, const ubit_t *in, int len, const ubit_t *crc_bits)
Checks the CRC value of a given array of hard-bits.
Definition: crc8gen.c:81
gsmtap_hdr::hdr_len
uint8_t hdr_len
Definition: gsmtap.h:244
osmo_stat_item_group::items
struct osmo_stat_item * items[0]
Actual counter structures below.
Definition: stat_item.h:66
msgb_put_u8
static void msgb_put_u8(struct msgb *msgb, uint8_t word)
append a uint8 value to the end of the message
Definition: msgb.h:200
bitvec_set_uint
int bitvec_set_uint(struct bitvec *bv, unsigned int in, unsigned int count)
set multiple bits (based on numeric value) at current pos
Definition: bitvec.c:216
log_info_cat::description
const char * description
Definition: logging.h:119
osmo_sock_get_name
char * osmo_sock_get_name(void *ctx, int fd)
Get address/port information on soocket in dyn-alloc string.
Definition: socket.c:406
rate_ctr_for_each_group
int rate_ctr_for_each_group(rate_ctr_group_handler_t handle_group, void *data)
Iterate over all counter groups.
Definition: rate_ctr.c:227
DLGSUP
#define DLGSUP
Definition: logging.h:105
gsmtap_inst_fd
static int gsmtap_inst_fd(struct gsmtap_inst *gti)
obtain the file descriptor associated with a gsmtap instance
Definition: gsmtap_util.h:32
osmo_pbit2ubit_ext
int osmo_pbit2ubit_ext(ubit_t *out, unsigned int out_ofs, const pbit_t *in, unsigned int in_ofs, unsigned int num_bits, int lsb_mode)
convert packed bits to unpacked bits (extended options)
Definition: bits.c:212
osmo_stat_item_desc
statistics value description
Definition: stat_item.h:35
_osmo_fsm_inst_term
void _osmo_fsm_inst_term(struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause, void *data, const char *file, int line)
Terminate FSM instance with given cause.
Definition: fsm.c:432
osmo_fsm_state::name
const char * name
human-readable name of this state
Definition: fsm.h:47
msgb_dequeue
struct msgb * msgb_dequeue(struct llist_head *queue)
Dequeue message buffer from head of queue.
Definition: msgb.c:96
linuxlist.h
Simple doubly linked list implementation.
bitvec_get_uint
int bitvec_get_uint(struct bitvec *bv, unsigned int num_bits)
get multiple bits (based on numeric value) from current pos
Definition: bitvec.c:247
rate_ctr_per_intv::last
uint64_t last
counter value in last interval
Definition: rate_ctr.h:26
osmo_sock_init_sa
int osmo_sock_init_sa(struct sockaddr *ss, uint16_t type, uint8_t proto, unsigned int flags)
Initialize a socket and fill sockaddr.
Definition: socket.c:222
log_context
Log context information, passed to filter.
Definition: logging.h:125
log_target::filter_map
int filter_map
Internal data for filtering.
Definition: logging.h:180
RATE_CTR_INTV_DAY
@ RATE_CTR_INTV_DAY
last day
Definition: rate_ctr.h:21
osmo_timer_remaining
int osmo_timer_remaining(const struct osmo_timer_list *timer, const struct timeval *now, struct timeval *remaining)
compute the remaining time of a timer
Definition: timer.c:139
osmo_stat_item_group_desc::class_id
int class_id
The class to which this group belongs.
Definition: stat_item.h:50
osmo_wqueue::msg_queue
struct llist_head msg_queue
actual linked list implementing the queue
Definition: write_queue.h:45
prim.h
osmo_ubit2pbit_ext
int osmo_ubit2pbit_ext(pbit_t *out, unsigned int out_ofs, const ubit_t *in, unsigned int in_ofs, unsigned int num_bits, int lsb_mode)
convert unpacked bits to packed bits (extended options)
Definition: bits.c:187
gsmtap_makemsg
struct msgb * gsmtap_makemsg(uint16_t arfcn, uint8_t ts, uint8_t chan_type, uint8_t ss, uint32_t fn, int8_t signal_dbm, uint8_t snr, const uint8_t *data, unsigned int len)
create L1/L2 data and put it into GSMTAP
Definition: gsmtap_util.c:154
osmo_fd::fd
int fd
Definition: select.h:26
osmo_strrb
Definition: strrb.h:39
osmo_stat_item_for_each_item
int osmo_stat_item_for_each_item(struct osmo_stat_item_group *statg, osmo_stat_item_handler_t handle_item, void *data)
Iteate over all items.
Definition: stat_item.c:238
log_target_find
struct log_target * log_target_find(int type, const char *fname)
Find a registered log target.
Definition: logging.c:690
osmo_crc16gen_check_bits
int osmo_crc16gen_check_bits(const struct osmo_crc16gen_code *code, const ubit_t *in, int len, const ubit_t *crc_bits)
Checks the CRC value of a given array of hard-bits.
Definition: crc16gen.c:81
osmo_counter::value
unsigned long value
current value
Definition: statistics.h:11
gsmtap_hdr::antenna_nr
uint8_t antenna_nr
Definition: gsmtap.h:255
DLGTP
#define DLGTP
Definition: logging.h:103
gsmtap_osmocore_log_hdr::name
char name[32]
Definition: gsmtap.h:274
LOGL_DEBUG
#define LOGL_DEBUG
different log levels
Definition: logging.h:86
msgb::head
unsigned char * head
start of underlying memory buffer
Definition: msgb.h:65
OSMO_SOCK_F_BIND
#define OSMO_SOCK_F_BIND
Definition: socket.h:20
msgb_enqueue
void msgb_enqueue(struct llist_head *queue, struct msgb *msg)
Enqueue message buffer to tail of a queue.
Definition: msgb.c:84
osmo_vlogp
void osmo_vlogp(int subsys, int level, const char *file, int line, int cont, const char *format, va_list ap)
vararg version of logging function
Definition: logging.c:395
osmo_crc32gen_set_bits
void osmo_crc32gen_set_bits(const struct osmo_crc32gen_code *code, const ubit_t *in, int len, ubit_t *crc_bits)
Computes and writes the CRC value of a given array of bits.
Definition: crc32gen.c:106
osmo_counter_alloc
struct osmo_counter * osmo_counter_alloc(const char *name)
Allocate a new counter.
Definition: statistics.c:33
osmo_stat_item_init
int osmo_stat_item_init(void *tall_ctx)
Initialize the stat item module.
Definition: stat_item.c:194
LOGL_ERROR
#define LOGL_ERROR
error condition, requires user action
Definition: logging.h:89
log_set_all_filter
void log_set_all_filter(struct log_target *target, int)
Enable the LOG_FILTER_ALL log filter.
Definition: logging.c:503
RATE_CTR_INTV_SEC
@ RATE_CTR_INTV_SEC
last second
Definition: rate_ctr.h:18
gsmtap_hdr::version
uint8_t version
Definition: gsmtap.h:243
LOG_TGT_TYPE_STRRB
@ LOG_TGT_TYPE_STRRB
osmo_strrb-backed logging
Definition: logging.h:171
gsmtap_osmocore_log_hdr::proc_name
char proc_name[16]
Definition: gsmtap.h:267
osmo_select_main
int osmo_select_main(int polling)
select main loop integration
Definition: select.c:184
osmo_constant_time_cmp
int osmo_constant_time_cmp(const uint8_t *exp, const uint8_t *rel, const int count)
Wishful thinking to generate a constant time compare.
Definition: utils.c:304
rate_ctr
data we keep for each actual value
Definition: rate_ctr.h:31
osmo_conv_code
structure describing a given convolutional code
Definition: conv.h:56
bitvec_fill
int bitvec_fill(struct bitvec *bv, unsigned int num_bits, enum bit_value fill)
fill num_bits with \fill starting from the current position
Definition: bitvec.c:267
llist_head::next
struct llist_head * next
Pointer to next and previous item.
Definition: linuxlist.h:49
osmo_fsm_inst::timer
struct osmo_timer_list timer
timer back-end for states with time-out
Definition: fsm.h:103
osmo_fsm::list
struct llist_head list
global list
Definition: fsm.h:59
msgb::_data
unsigned char _data[0]
optional immediate data array
Definition: msgb.h:68
PRIM_OP_CONFIRM
@ PRIM_OP_CONFIRM
confirm
Definition: prim.h:20
bitvec_unhex
int bitvec_unhex(struct bitvec *bv, const char *src)
read hexadecimap string into a bit vector
Definition: bitvec.c:439
bitvec_unpack
unsigned int bitvec_unpack(struct bitvec *bv, const uint8_t *buffer)
Copy buffer of unpacked bits into bit vector.
Definition: bitvec.c:425
osmo_fsm_inst::log_level
int log_level
logging level for this FSM
Definition: fsm.h:96
PRIM_OP_RESPONSE
@ PRIM_OP_RESPONSE
response
Definition: prim.h:18
log_vty_command_string
const char * log_vty_command_string(const struct log_info *unused_info)
Generates the logging command string for VTY.
Definition: logging.c:772
application.h
Routines for helping with the osmocom application setup.
osmo_wqueue_clear
void osmo_wqueue_clear(struct osmo_wqueue *queue)
Clear a osmo_wqueue.
Definition: write_queue.c:127
DLSMS
#define DLSMS
Definition: logging.h:101
osmo_counter::list
struct llist_head list
internal list head
Definition: statistics.h:8
osmo_fsm_inst::list
struct llist_head list
member in the fsm->instances list
Definition: fsm.h:86
bitvec_get_nth_set_bit
unsigned int bitvec_get_nth_set_bit(const struct bitvec *bv, unsigned int n)
get the Nth set bit inside the bit vector
Definition: bitvec.c:125
osmo_str2upper
void osmo_str2upper(char *out, const char *in)
Convert an entire string to upper case.
Definition: utils.c:284
rate_ctr_group::idx
unsigned int idx
The index of this ctr_group within its class.
Definition: rate_ctr.h:65
DLINP
#define DLINP
Definition: logging.h:97
L
@ L
A CSN.1 "L" bit.
Definition: bitvec.h:54
osmo_crc8gen_code
structure describing a given CRC code of max 8 bits
Definition: crc8gen.h:39
osmo_nibble_shift_right
void osmo_nibble_shift_right(uint8_t *out, const uint8_t *in, unsigned int num_nibbles)
Shift unaligned input to octet-aligned output.
Definition: bits.c:69