libosmocore  1.9.0
Osmocom core library
stat_item_internal.h
Go to the documentation of this file.
1 
3 #pragma once
4 
11  uint32_t n;
13  int32_t min;
15  int32_t last;
17  int32_t max;
19  int64_t sum;
20 };
21 
25  const struct osmo_stat_item_desc *desc;
26 
29 
33 };
34 
osmo_select_init
void osmo_select_init(void)
osmo_plugin_load_all
int osmo_plugin_load_all(const char *directory)
Definition: plugin.c:65
osmo_generate_backtrace
void osmo_generate_backtrace(void)
Generate and print a call back-trace.
Definition: backtrace.c:63
osmo_sock_mcast_loop_set
int osmo_sock_mcast_loop_set(int fd, bool enable)
osmo_sercomm_drv_rx_char
int osmo_sercomm_drv_rx_char(struct osmo_sercomm_inst *sercomm, uint8_t ch)
the driver has received one byte, pass it into sercomm layer
Definition: sercomm.c:272
timer_ticks
static uint64_t timer_ticks
Definition: rate_ctr.c:312
IOFD_ACT_WRITE
@ IOFD_ACT_WRITE
Definition: osmo_io_internal.h:107
osmo_prbs_state::prbs
const struct osmo_prbs * prbs
Definition: prbs.h:14
osmo_stat_item_get_last
int32_t osmo_stat_item_get_last(const struct osmo_stat_item *item)
Get the last (freshest) value.
Definition: stat_item.c:429
osmo_prbs::name
const char * name
human-readable name
Definition: prbs.h:7
osmo_prim_event_map
single entry in a SAP/PRIM/OP -> EVENT map
Definition: prim.h:86
HDLC_ESCAPE
#define HDLC_ESCAPE
Definition: sercomm.c:54
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 each counter in group and call function.
Definition: rate_ctr.c:442
iofd_msghdr::osa
struct osmo_sockaddr osa
Definition: osmo_io_internal.h:119
OSMO_SOCK_F_CONNECT
#define OSMO_SOCK_F_CONNECT
connect the socket to a remote peer
Definition: socket.h:88
rate_ctr_timer_cb
static int rate_ctr_timer_cb(struct osmo_fd *ofd, unsigned int what)
Definition: rate_ctr.c:332
osmo_sockaddr::sa
struct sockaddr sa
Definition: socket.h:28
RATE_CTR_INTV_HOUR
@ RATE_CTR_INTV_HOUR
last hour
Definition: rate_ctr.h:18
LOGPIO
#define LOGPIO(iofd, level, fmt, args...)
Definition: osmo_io.h:14
osmo_sockaddr_str_to_32
int osmo_sockaddr_str_to_32(const struct osmo_sockaddr_str *sockaddr_str, uint32_t *ip)
rate_ctr_group_desc::ctr_desc
const struct rate_ctr_desc * ctr_desc
Pointer to array of counter names.
Definition: rate_ctr.h:53
osmo_panic_handler
static osmo_panic_handler_t osmo_panic_handler
Definition: panic.c:33
rate_ctr_desc
rate counter description
Definition: rate_ctr.h:37
osmo_sockaddr_str_is_set
bool osmo_sockaddr_str_is_set(const struct osmo_sockaddr_str *sockaddr_str)
msgb_alloc_headroom
static struct msgb * msgb_alloc_headroom(uint16_t size, uint16_t headroom, const char *name)
Allocate message buffer with specified headroom.
Definition: msgb.h:551
OSMO_SOCK_MAX_ADDRS
#define OSMO_SOCK_MAX_ADDRS
maximum number of local or remote addresses supported by an osmo_sock instance
Definition: socket.h:110
iofd_msghdr::iov
struct iovec iov[1]
Definition: osmo_io_internal.h:120
osmo_panic_default
static void osmo_panic_default(const char *fmt, va_list args)
Definition: panic.c:41
osmo_sockaddr_cmp
int osmo_sockaddr_cmp(const struct osmo_sockaddr *a, const struct osmo_sockaddr *b)
color
static const char * color(int subsys)
Definition: logging.c:432
osmo_sock_init_osa
int osmo_sock_init_osa(uint16_t type, uint8_t proto, const struct osmo_sockaddr *local, const struct osmo_sockaddr *remote, unsigned int flags)
osmo_prbs11
const struct osmo_prbs osmo_prbs11
PRBS-11 according ITU-T O.150.
Definition: prbs.c:30
osmo_serial_speed_t
int osmo_serial_speed_t(unsigned int baudrate, speed_t *speed)
Convert unsigned integer value to speed_t.
Definition: serial.c:250
osmo_stat_item::reported
struct osmo_stat_item_period reported
The results of the previous reporting period.
Definition: stat_item_internal.h:32
osmo_fd_disp_fds
int osmo_fd_disp_fds(void *readset, void *writeset, void *exceptset)
OSMO_SOCK_NAME_MAXLEN
#define OSMO_SOCK_NAME_MAXLEN
maximum length of a socket name ("r=1.2.3.4:123<->l=5.6.7.8:987")
Definition: socket.h:20
rate_ctr_init
int rate_ctr_init(void *tall_ctx)
Initialize the counter module.
Definition: rate_ctr.c:366
osmo_sock_get_name2_c
char * osmo_sock_get_name2_c(const void *ctx, int fd)
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)
iofd_txqueue_dequeue
struct iofd_msghdr * iofd_txqueue_dequeue(struct osmo_io_fd *iofd)
osmo_stat_item_handler_t
int(* osmo_stat_item_handler_t)(struct osmo_stat_item_group *, struct osmo_stat_item *, void *)
Definition: stat_item.h:89
osmo_stat_item_group_set_name
void osmo_stat_item_group_set_name(struct osmo_stat_item_group *statg, const char *name)
Set a name for the statistics item group to be used instead of index value at report time.
Definition: stat_item.c:249
iofd_backend_ops::write_disable
void(* write_disable)(struct osmo_io_fd *iofd)
Definition: osmo_io_internal.h:31
osmo_sock_init2_multiaddr2
int osmo_sock_init2_multiaddr2(uint16_t family, uint16_t type, uint8_t proto, const char **local_hosts, size_t local_hosts_cnt, uint16_t local_port, const char **remote_hosts, size_t remote_hosts_cnt, uint16_t remote_port, unsigned int flags, struct osmo_sock_init2_multiaddr_pars *pars)
osmo_prim_event_map::sap
unsigned int sap
SAP to match.
Definition: prim.h:87
rate_ctr_add
void rate_ctr_add(struct rate_ctr *ctr, int inc)
Increment the counter by inc.
Definition: rate_ctr.c:286
SC_DLCI_ECHO
@ SC_DLCI_ECHO
Definition: sercomm.h:20
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:172
node
uint16_t node
rate_ctr_group::desc
const struct rate_ctr_group_desc * desc
Pointer to the counter group class.
Definition: rate_ctr.h:61
osmo_stat_item_reset
void osmo_stat_item_reset(struct osmo_stat_item *item)
Remove all values of a stat item.
Definition: stat_item.c:437
len
static size_t len(const char *str)
osmo_sock_init_osa_ofd
int osmo_sock_init_osa_ofd(struct osmo_fd *ofd, int type, int proto, const struct osmo_sockaddr *local, const struct osmo_sockaddr *remote, unsigned int flags)
rate_ctrl_group_desc_validate
static bool rate_ctrl_group_desc_validate(const struct rate_ctr_group_desc *desc)
Definition: rate_ctr.c:75
osmo_stat_item_period::max
int32_t max
Largest value seen in a reporting period.
Definition: stat_item_internal.h:17
n
write Write running configuration to or terminal n Write configuration to the copy running config startup Copy configuration n Copy running config to n Copy running config to startup write Write running configuration to or terminal n Write to terminal n
osmo_stat_item_period::sum
int64_t sum
Sum of all values passed to osmo_stat_item_set() in the reporting period.
Definition: stat_item_internal.h:19
osmo_fd::priv_nr
unsigned int priv_nr
private number, extending data
Definition: select.h:45
rate_ctr_get_unused_name_idx
static unsigned int rate_ctr_get_unused_name_idx(const char *name)
Find an unused index for this rate counter group.
Definition: rate_ctr.c:189
osmo_sockaddr_str_from_sockaddr_in
int osmo_sockaddr_str_from_sockaddr_in(struct osmo_sockaddr_str *sockaddr_str, const struct sockaddr_in *src)
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:255
hdr
struct gsm48_hdr hdr
osmo_stat_item_group_desc::item_desc
const struct osmo_stat_item_desc * item_desc
Pointer to array of value names, length as per num_items.
Definition: stat_item.h:41
OSMO_ASSERT
#define OSMO_ASSERT(exp)
Helper macro to terminate when an assertion fails.
Definition: utils.h:113
osmo_sock_get_name2
const char * osmo_sock_get_name2(int fd)
osmo_stat_item_period
Definition: stat_item_internal.h:9
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 based on group + item name.
Definition: stat_item.c:370
DEBUGP
#define DEBUGP(ss, fmt, args...)
Log a debug message through the Osmocom logging framework.
Definition: logging.h:30
osmo_stat_item_group
One instance of a counter group class.
Definition: stat_item.h:45
osmo_prim_hdr
Osmocom primitive header.
Definition: prim.h:47
DEFAULT_RX_MSG_SIZE
#define DEFAULT_RX_MSG_SIZE
Definition: sercomm.c:37
msgb_put
static unsigned char * msgb_put(struct msgb *msgb, unsigned int len)
append data to end of message buffer
Definition: msgb.h:240
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 stat items.
Definition: stat_item.c:225
rate_ctr_group_desc::class_id
int class_id
The class to which this group belongs.
Definition: rate_ctr.h:49
osmo_signalfd
Definition: select.h:98
OSMO_NO_EVENT
#define OSMO_NO_EVENT
magic value to be used as final record of osmo_prim_event_map
Definition: prim.h:83
subsys
char subsys[16]
logging sub-system
Definition: gsmtap.h:11
osmo_prbs_get_ubit
ubit_t osmo_prbs_get_ubit(struct osmo_prbs_state *state)
Get the next bit out of given PRBS instance.
Definition: prbs.c:61
osmo_stat_item_group::idx
unsigned int idx
The index of this value group within its class.
Definition: stat_item.h:51
osmo_sercomm_init
void osmo_sercomm_init(struct osmo_sercomm_inst *sercomm)
Initialize an Osmocom sercomm instance.
Definition: sercomm.c:74
msgb::data
unsigned char * data
start of message in buffer
Definition: msgb.h:55
osmo_stat_item_group_handler_t
int(* osmo_stat_item_group_handler_t)(struct osmo_stat_item_group *, void *)
Definition: stat_item.h:92
osmo_stat_item_get_desc
const struct osmo_stat_item_desc * osmo_stat_item_get_desc(struct osmo_stat_item *item)
Return the description for an osmo_stat_item.
Definition: stat_item.c:458
iofd_msghdr::iofd
struct osmo_io_fd * iofd
Definition: osmo_io_internal.h:124
iofd_msghdr::msg
struct msgb * msg
Definition: osmo_io_internal.h:123
rate_ctr_per_intv::rate
uint64_t rate
counter rate
Definition: rate_ctr.h:25
osmo_stat_item
data we keep for each actual item
Definition: stat_item_internal.h:23
osmo_fd_register
int osmo_fd_register(struct osmo_fd *fd)
osmo_stat_item_desc::default_value
int32_t default_value
default value
Definition: stat_item.h:27
osmo_sock_set_priority
int osmo_sock_set_priority(int fd, int prio)
rate_ctr_group_set_name
void rate_ctr_group_set_name(struct rate_ctr_group *grp, const char *name)
Set a name for the group of counters be used instead of index value at report time.
Definition: rate_ctr.c:280
osmo_fd::cb
int(* cb)(struct osmo_fd *fd, unsigned int what)
call-back function to be called once file descriptor becomes available
Definition: select.h:41
osmo_signalfd::sigset
sigset_t sigset
Definition: select.h:100
__rb_erase_color
static void __rb_erase_color(struct rb_node *node, struct rb_node *parent, struct rb_root *root)
Definition: rbtree.c:134
osmo_stat_item_group_desc::num_items
const unsigned int num_items
The number of values in this group (size of item_desc)
Definition: stat_item.h:39
rb_set_black
#define rb_set_black(r)
Definition: linuxrbtree.h:115
osmo_io_fd::fd
int fd
actual operating-system level file decriptor
Definition: osmo_io_internal.h:53
PRIM_OP_INDICATION
@ PRIM_OP_INDICATION
indication
Definition: prim.h:29
rb_replace_node
void rb_replace_node(struct rb_node *victim, struct rb_node *new, struct rb_root *root)
Definition: rbtree.c:360
mangle_identifier_ifneeded
static char * mangle_identifier_ifneeded(const void *ctx, const char *in)
Definition: rate_ctr.c:108
osmo_stat_item_group_reset
void osmo_stat_item_group_reset(struct osmo_stat_item_group *statg)
Reset all osmo stat items in a group.
Definition: stat_item.c:447
osmo_sercomm_inst::dlci_queues
struct llist_head dlci_queues[_SC_DLCI_MAX]
per-DLC queue of pending transmit msgbs
Definition: sercomm.h:41
osmo_sockaddr_port
uint16_t osmo_sockaddr_port(const struct sockaddr *sa)
osmo_io_fd::u
union osmo_io_fd::@40 u
osmo_sockaddr_str_to_in6_addr
int osmo_sockaddr_str_to_in6_addr(const struct osmo_sockaddr_str *sockaddr_str, struct in6_addr *dst)
osmo_timers_nearest_ms
int osmo_timers_nearest_ms(void)
Determine time between now and the nearest timer in milliseconds.
Definition: timer.c:186
backtrace.h
msg
uint8_t msg[0]
osmo_stat_item_inc
void osmo_stat_item_inc(struct osmo_stat_item *item, int32_t value)
Increase the stat_item to the given value.
Definition: stat_item.c:260
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 llist entry.
Definition: linuxlist.h:337
osmo_sockaddr_str_to_sockaddr_in6
int osmo_sockaddr_str_to_sockaddr_in6(const struct osmo_sockaddr_str *sockaddr_str, struct sockaddr_in6 *dst)
PRIM_OP_REQUEST
@ PRIM_OP_REQUEST
request
Definition: prim.h:27
osmo_sockaddr
Definition: socket.h:26
llist_for_each
#define llist_for_each(pos, head)
Iterate over a linked list.
Definition: linuxlist.h:261
RATE_CTR_INTV_MIN
@ RATE_CTR_INTV_MIN
last minute
Definition: rate_ctr.h:17
osmo_talloc_replace_string
static void osmo_talloc_replace_string(void *ctx, char **dst, const char *newstr)
duplicate a string using talloc and release its prior content (if any)
Definition: utils.h:124
osmo_fd_setup
void osmo_fd_setup(struct osmo_fd *ofd, int fd, unsigned int when, int(*cb)(struct osmo_fd *fd, unsigned int what), void *data, unsigned int priv_nr)
osmo_sock_get_name
char * osmo_sock_get_name(const void *ctx, int fd)
msgb_tailroom
static int msgb_tailroom(const struct msgb *msgb)
determine how much tail room is left in msgb
Definition: msgb.h:211
HDLC_FLAG
#define HDLC_FLAG
Definition: sercomm.c:53
osmo_stat_item_group_desc
Description of a statistics item group.
Definition: stat_item.h:31
name
const char * name
plugin.h
osmo_fd_unregister
void osmo_fd_unregister(struct osmo_fd *fd)
osmo_timers_update
int osmo_timers_update(void)
fire all timers...
Definition: timer.c:233
osmo_stat_item::value
struct osmo_stat_item_period value
Current reporting period / current value.
Definition: stat_item_internal.h:28
osmo_sockaddr_str_is_nonzero
bool osmo_sockaddr_str_is_nonzero(const struct osmo_sockaddr_str *sockaddr_str)
osmo_io_ops::write_cb
void(* write_cb)(struct osmo_io_fd *iofd, int res, struct msgb *msg)
call-back function when write has completed on fd
Definition: osmo_io.h:44
OSMO_FD_READ
#define OSMO_FD_READ
Indicate interest in reading from the file descriptor.
Definition: select.h:17
rb_prev
struct rb_node * rb_prev(const struct rb_node *node)
Definition: rbtree.c:336
osmo_fd_is_registered
bool osmo_fd_is_registered(struct osmo_fd *fd)
osmo_sockaddr_str::ip
char ip[INET6_ADDRSTRLEN]
NUL terminated string of the IPv4 or IPv6 address.
Definition: sockaddr_str.h:49
iofd_backend_ops
Definition: osmo_io_internal.h:26
INIT_LLIST_HEAD
#define INIT_LLIST_HEAD(ptr)
Initialize a llist_head to point back to itself.
Definition: linuxlist.h:65
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:565
osmo_signalfd::data
void * data
Definition: select.h:102
osmo_ntohs
#define osmo_ntohs(x)
Definition: byteswap.h:42
IOFD_FLAG_TO_FREE
#define IOFD_FLAG_TO_FREE
Definition: osmo_io_internal.h:38
IOFD_ACT_READ
@ IOFD_ACT_READ
Definition: osmo_io_internal.h:106
rb_color
#define rb_color(r)
Definition: linuxrbtree.h:111
tall_rate_ctr_ctx
static void * tall_rate_ctr_ctx
Definition: rate_ctr.c:72
osmo_sockaddr::sin6
struct sockaddr_in6 sin6
Definition: socket.h:31
OTC_GLOBAL
#define OTC_GLOBAL
Definition: talloc.h:26
osmo_sockaddr_size
static socklen_t osmo_sockaddr_size(const struct osmo_sockaddr *addr)
Return the size of the variant used in the address NOTE: This does not return the size of the in{,...
Definition: socket.h:46
signal_handler::cbfn
osmo_signal_cbfn * cbfn
Definition: signal.c:41
osmo_sock_unix_init
int osmo_sock_unix_init(uint16_t type, uint8_t proto, const char *socket_path, unsigned int flags)
RX_ST_ADDR
@ RX_ST_ADDR
Definition: sercomm.c:62
iofd_poll_ops
const struct iofd_backend_ops iofd_poll_ops
osmo_sockaddr_str_from_32n
int osmo_sockaddr_str_from_32n(struct osmo_sockaddr_str *sockaddr_str, uint32_t ip, uint16_t port) OSMO_DEPRECATED("osmo_sockaddr_str_from_32n() actually uses *host* byte order. Use osmo_sockaddr_str_from_32h() instead")
osmo_sercomm_inst::initialized
int initialized
Has this instance been initialized?
Definition: sercomm.h:34
rb_left
struct rb_node * rb_left
Definition: linuxrbtree.h:6
osmo_sock_mcast_all_set
int osmo_sock_mcast_all_set(int fd, bool enable)
osmo_io_fd::poll
struct osmo_io_fd::@40::@41 poll
RB_BLACK
#define RB_BLACK
Definition: linuxrbtree.h:4
osmo_sock_init2_multiaddr_pars
Definition: socket.h:119
rb_first
struct rb_node * rb_first(const struct rb_root *root)
Definition: rbtree.c:284
osmo_stat_item_group::list
struct llist_head list
Linked list of all value groups in the system.
Definition: stat_item.h:47
OSMO_NAME_C_IMPL
#define OSMO_NAME_C_IMPL(CTX, INITIAL_BUFSIZE, ON_ERROR, FUNC_BUF, FUNC_BUF_ARGS...)
Translate a buffer function to a talloc context function.
Definition: utils.h:340
rate_ctr_desc::description
const char * description
description of the counter
Definition: rate_ctr.h:39
osmo_signal_unregister_handler
void osmo_signal_unregister_handler(unsigned int subsys, osmo_signal_cbfn *cbfn, void *data)
Unregister signal handler.
Definition: signal.c:86
osmo_sockaddr::u
union osmo_sockaddr::@28 u
osmo_sercomm_drv_pull
int osmo_sercomm_drv_pull(struct osmo_sercomm_inst *sercomm, uint8_t *ch)
fetch one octet of to-be-transmitted serial data
Definition: sercomm.c:179
osmo_sockaddr_to_str_buf
char * osmo_sockaddr_to_str_buf(char *buf, size_t buf_len, const struct osmo_sockaddr *sockaddr)
osmo_prbs9
const struct osmo_prbs osmo_prbs9
PRBS-9 according ITU-T O.150.
Definition: prbs.c:22
msgb_length
uint16_t msgb_length(const struct msgb *msg)
get length of message buffer
Definition: msgb.c:285
osmo_sock_get_local_ip_port
int osmo_sock_get_local_ip_port(int fd, char *port, size_t len)
osmo_serial_set_baudrate
int osmo_serial_set_baudrate(int fd, speed_t baudrate)
Change current baudrate.
Definition: serial.c:158
llist_del
static void llist_del(struct llist_head *entry)
Delete a single entry from a linked list.
Definition: linuxlist.h:128
osmo_strbuf::chars_needed
size_t chars_needed
After all OSMO_STRBUF_APPEND operations, reflects the total number of characters that would be writte...
Definition: utils.h:210
IOFD_FLAG_ISSET
#define IOFD_FLAG_ISSET(iofd, flag)
Definition: osmo_io_internal.h:47
stats_start
probe stats_start()
proto
uint8_t proto
osmo_ctx
__thread struct osmo_talloc_contexts * osmo_ctx
Definition: context.c:24
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)
osmo_fd_fill_fds
int osmo_fd_fill_fds(void *readset, void *writeset, void *exceptset)
osmo_prim_hdr::operation
enum osmo_prim_operation operation
Definition: prim.h:50
osmo_stat_item_set
void osmo_stat_item_set(struct osmo_stat_item *item, int32_t value)
Set the a given stat_item to the given value.
Definition: stat_item.c:282
OSMO_SOCK_F_NONBLOCK
#define OSMO_SOCK_F_NONBLOCK
switch socket to non-blocking mode
Definition: socket.h:92
bits.h
osmo_ntohl
#define osmo_ntohl(x)
Definition: byteswap.h:41
OSMO_IO_FD_MODE_SCTP_RECVMSG_SENDMSG
@ OSMO_IO_FD_MODE_SCTP_RECVMSG_SENDMSG
emulate sctp_recvmsg() and sctp_sendmsg()
Definition: osmo_io.h:25
osmo_io_fd::io_ops
struct osmo_io_ops io_ops
send/recv (msg) callback functions
Definition: osmo_io_internal.h:64
osmo_fd_read_enable
static void osmo_fd_read_enable(struct osmo_fd *ofd)
Definition: select.h:54
osmo_sercomm_inst::tx
struct osmo_sercomm_inst::@24 tx
transmit side
osmo_stat_item_period::n
uint32_t n
Number of osmo_stat_item_set() that occurred during the reporting period, zero if none.
Definition: stat_item_internal.h:11
data
uint8_t data[0]
sercomm_drv_baudrate_chg
int sercomm_drv_baudrate_chg(struct osmo_sercomm_inst *sercomm, uint32_t bdrt)
low-level driver routine to execute baud-rate change
dispatch_rx_msg
static void dispatch_rx_msg(struct osmo_sercomm_inst *sercomm, uint8_t dlci, struct msgb *msg)
Definition: sercomm.c:258
IOFD_ACT_RECVFROM
@ IOFD_ACT_RECVFROM
Definition: osmo_io_internal.h:108
osmo_sercomm_inst::next_char
uint8_t * next_char
next to-be-transmitted char in msg
Definition: sercomm.h:47
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)
osmo_sock_mcast_ttl_set
int osmo_sock_mcast_ttl_set(int fd, uint8_t ttl)
osmo_select_shutdown_requested
int osmo_select_shutdown_requested(void)
msgb
Osmocom message buffer.
Definition: msgb.h:31
msgb_push
static unsigned char * msgb_push(struct msgb *msgb, unsigned int len)
prepend (push) some data to start of message
Definition: msgb.h:341
osmo_fd_read_disable
static void osmo_fd_read_disable(struct osmo_fd *ofd)
Definition: select.h:58
osmo_prbs7
const struct osmo_prbs osmo_prbs7
PRBS-7 according ITU-T O.150.
Definition: prbs.c:14
LOGL_INFO
#define LOGL_INFO
general information
Definition: logging.h:123
osmo_prbs_state_init
void osmo_prbs_state_init(struct osmo_prbs_state *st, const struct osmo_prbs *prbs)
Initialize the given caller-allocated PRBS state.
Definition: prbs.c:46
flags
uint16_t flags
osmo_sercomm_inst::ctrl
uint8_t ctrl
CTRL of currently received msgb.
Definition: sercomm.h:63
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:418
__rb_rotate_left
static void __rb_rotate_left(struct rb_node *node, struct rb_root *root)
Definition: rbtree.c:23
rb_root
Definition: linuxrbtree.h:104
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:61
_osmo_serial_set_baudrate
static int _osmo_serial_set_baudrate(int fd, speed_t baudrate)
Definition: serial.c:127
OSMO_CMP
#define OSMO_CMP(a, b)
Return a typical cmp result for comparable entities a and b.
Definition: utils.h:26
osmo_sockaddr_str_to_sockaddr_in
int osmo_sockaddr_str_to_sockaddr_in(const struct osmo_sockaddr_str *sockaddr_str, struct sockaddr_in *dst)
osmo_io.h
res
uint8_t res[16]
osmo_fd::list
struct llist_head list
linked list for internal management
Definition: select.h:33
osmo_sockaddr_to_octets
int osmo_sockaddr_to_octets(uint8_t *dst, size_t dst_maxlen, const struct osmo_sockaddr *os)
IOFD_FLAG_CLOSED
#define IOFD_FLAG_CLOSED
Definition: osmo_io_internal.h:36
rb_next
struct rb_node * rb_next(const struct rb_node *node)
Definition: rbtree.c:308
utils.h
osmo_fd_update_when
void osmo_fd_update_when(struct osmo_fd *ofd, unsigned int when_mask, unsigned int when)
osmo_stat_item::desc
const struct osmo_stat_item_desc * desc
back-reference to the item description
Definition: stat_item_internal.h:25
rb_set_red
#define rb_set_red(r)
Definition: linuxrbtree.h:114
osmo_sockaddr_str_from_in6_addr
int osmo_sockaddr_str_from_in6_addr(struct osmo_sockaddr_str *sockaddr_str, const struct in6_addr *addr, uint16_t port)
rate_ctr_group
One instance of a counter group class.
Definition: rate_ctr.h:57
rate_ctr_group_desc::group_description
const char * group_description
The human-readable description of the group.
Definition: rate_ctr.h:47
rb_node::rb_left
struct rb_node * rb_left
Definition: linuxrbtree.h:100
osmo_sockaddr_set_port
void osmo_sockaddr_set_port(struct sockaddr *sa, uint16_t port)
osmo_iofd_txqueue_len
unsigned int osmo_iofd_txqueue_len(struct osmo_io_fd *iofd)
osmo_panic
void osmo_panic(const char *fmt,...) __attribute__((noreturn))
Terminate the current program with a panic.
Definition: panic.c:71
iofd_msghdr::hdr
struct msghdr hdr
Definition: osmo_io_internal.h:118
rate_ctr_group_desc_mangle
static struct rate_ctr_group_desc * rate_ctr_group_desc_mangle(void *ctx, const struct rate_ctr_group_desc *desc)
Definition: rate_ctr.c:139
msgb_free
void msgb_free(struct msgb *m)
Release given message buffer.
Definition: msgb.c:117
osmo_prim_event_map::event
uint32_t event
event as result if above match
Definition: prim.h:90
osmo_sock_mcast_subscribe
int osmo_sock_mcast_subscribe(int fd, const char *grp_addr)
osmo_sercomm_initialized
int osmo_sercomm_initialized(struct osmo_sercomm_inst *sercomm)
Determine if a given Osmocom sercomm instance has been initialized.
Definition: sercomm.c:92
osmo_signal_talloc_ctx_init
void * osmo_signal_talloc_ctx_init(void *root_ctx)
Initialize a signal_handler talloc context for osmo_signal_register_handler.
Definition: signal.c:50
osmo_sockaddr_to_str_buf2
int osmo_sockaddr_to_str_buf2(char *buf, size_t buf_len, const struct osmo_sockaddr *sockaddr)
rb_insert_color
void rb_insert_color(struct rb_node *node, struct rb_root *root)
Definition: rbtree.c:69
osmo_fd_close
void osmo_fd_close(struct osmo_fd *fd)
stats_tcp.h
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:397
stat_item_internal.h
tall_sigh_ctx
void * tall_sigh_ctx
Definition: signal.c:35
libosmocore
provider libosmocore
Definition: probes.d:1
osmo_sockaddr_in_to_str_and_uint
size_t osmo_sockaddr_in_to_str_and_uint(char *addr, unsigned int addr_len, uint16_t *port, const struct sockaddr_in *sin)
osmo_sockaddr_from_octets
int osmo_sockaddr_from_octets(struct osmo_sockaddr *os, const void *src, size_t src_len)
timer.h
rate_ctr_group::list
struct llist_head list
Linked list of all counter groups in the system.
Definition: rate_ctr.h:59
rate_ctr_handler_t
int(* rate_ctr_handler_t)(struct rate_ctr_group *, struct rate_ctr *, const struct rate_ctr_desc *, void *)
Definition: rate_ctr.h:122
interval_expired
static void interval_expired(struct rate_ctr *ctr, enum rate_ctr_intv intv)
Definition: rate_ctr.c:303
osmo_stat_item_group::name
char * name
Optional string-based identifier to be used instead of index at report time.
Definition: stat_item.h:53
osmo_sockaddr_is_local
int osmo_sockaddr_is_local(struct sockaddr *addr, unsigned int addrlen)
OSMO_IO_FD_MODE_READ_WRITE
@ OSMO_IO_FD_MODE_READ_WRITE
use read() / write() calls
Definition: osmo_io.h:21
osmo_sercomm_inst::dlci_handler
dlci_cb_t dlci_handler[_SC_DLCI_MAX]
per-DLC handler call-back functions
Definition: sercomm.h:53
osmo_sockaddr_str_from_str2
int osmo_sockaddr_str_from_str2(struct osmo_sockaddr_str *sockaddr_str, const char *ip)
OSMO_SOCKADDR_STR_FMT_ARGS
#define OSMO_SOCKADDR_STR_FMT_ARGS(R)
Definition: sockaddr_str.h:67
osmo_select_main_ctx
int osmo_select_main_ctx(int polling)
rate_ctr_group_intv
static void rate_ctr_group_intv(struct rate_ctr_group *grp)
Definition: rate_ctr.c:315
osmo_htonl
#define osmo_htonl(x)
Definition: byteswap.h:43
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:106
stats_done
probe stats_done()
rate_ctr_group_desc::num_ctr
unsigned int num_ctr
The number of counters in this group.
Definition: rate_ctr.h:51
osmo_io_ops::sendto_cb
void(* sendto_cb)(struct osmo_io_fd *iofd, int res, struct msgb *msg, const struct osmo_sockaddr *daddr)
call-back function emulating sendto
Definition: osmo_io.h:65
osmo_sock_init2
int osmo_sock_init2(uint16_t family, uint16_t type, uint8_t proto, const char *local_host, uint16_t local_port, const char *remote_host, uint16_t remote_port, unsigned int flags)
osmo_sock_init2_multiaddr
int osmo_sock_init2_multiaddr(uint16_t family, uint16_t type, uint8_t proto, const char **local_hosts, size_t local_hosts_cnt, uint16_t local_port, const char **remote_hosts, size_t remote_hosts_cnt, uint16_t remote_port, unsigned int flags) OSMO_DEPRECATED_OUTSIDE("Use osmo_sock_init2_multiaddr2() instead")
osmo_timers_prepare
void osmo_timers_prepare(void)
Find the nearest time and update nearest_p.
Definition: timer.c:215
LLIST_HEAD
static LLIST_HEAD(signal_handler_list)
rate_ctr_group_handler_t
int(* rate_ctr_group_handler_t)(struct rate_ctr_group *, void *)
Definition: rate_ctr.h:125
osmo_fd::when
unsigned int when
bit-mask or of OSMO_FD_READ, OSMO_FD_WRITE and/or OSMO_FD_EXCEPT
Definition: select.h:38
msgb::tail
unsigned char * tail
end of message in buffer
Definition: msgb.h:54
OSMO_STRBUF_APPEND
#define OSMO_STRBUF_APPEND(STRBUF, func, args...)
Append a string to a buffer, as printed by an snprintf()-like function and with similar bounds checki...
Definition: utils.h:249
osmo_prbs_process_bit
static void osmo_prbs_process_bit(struct osmo_prbs_state *state, ubit_t bit)
Definition: prbs.c:53
osmo_prbs15
const struct osmo_prbs osmo_prbs15
PRBS-15 according ITU-T O.150.
Definition: prbs.c:38
osmo_stat_item_for_each_group
int osmo_stat_item_for_each_group(osmo_stat_item_group_handler_t handle_group, void *data)
Iterate over all stat_item groups in system, call user-supplied function on each.
Definition: stat_item.c:414
osmo_stat_item_dec
void osmo_stat_item_dec(struct osmo_stat_item *item, int32_t value)
Descrease the stat_item to the given value.
Definition: stat_item.c:271
osmo_timers_nearest
struct timeval * osmo_timers_nearest(void)
Determine time between now and the nearest timer.
Definition: timer.c:175
osmo_sercomm_inst::msg
struct msgb * msg
msgb currently being transmitted
Definition: sercomm.h:43
sercomm.h
osmo_serial_init
int osmo_serial_init(const char *dev, speed_t baudrate)
Open serial device and does base init.
Definition: serial.c:54
osmo_panic_handler_t
void(* osmo_panic_handler_t)(const char *fmt, va_list args)
panic handler callback function type
Definition: panic.h:10
rate_ctr_group::ctr
struct rate_ctr ctr[0]
Actual counter structures below.
Definition: rate_ctr.h:67
osmo_prbs
definition of a PRBS sequence
Definition: prbs.h:6
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:212
IOFD_FLAG_UNSET
#define IOFD_FLAG_UNSET(iofd, flag)
Definition: osmo_io_internal.h:44
osmo_set_panic_handler
void osmo_set_panic_handler(osmo_panic_handler_t h)
Set the panic handler.
Definition: panic.c:98
osmo_stat_item_flush
void osmo_stat_item_flush(struct osmo_stat_item *item)
Indicate that a reporting period has elapsed, and prepare the stat item for a new period of collectin...
Definition: stat_item.c:302
rate_ctr_desc::name
const char * name
name of the counter
Definition: rate_ctr.h:38
iofd_txqueue_enqueue_front
void iofd_txqueue_enqueue_front(struct osmo_io_fd *iofd, struct iofd_msghdr *msghdr)
h
struct gad_raw_head h
osmo_sockaddr_to_str_and_uint
unsigned int osmo_sockaddr_to_str_and_uint(char *addr, unsigned int addr_len, uint16_t *port, const struct sockaddr *sa)
IOFD_FLAG_SET
#define IOFD_FLAG_SET(iofd, flag)
Definition: osmo_io_internal.h:41
byteswap.h
rate_ctr_group_get_ctr
struct rate_ctr * rate_ctr_group_get_ctr(struct rate_ctr_group *grp, unsigned int idx)
Get rate counter from group, identified by index idx.
Definition: rate_ctr.c:270
RX_ST_ESCAPE
@ RX_ST_ESCAPE
Definition: sercomm.c:65
osmo_event_for_prim
uint32_t osmo_event_for_prim(const struct osmo_prim_hdr *oph, const struct osmo_prim_event_map *maps)
resolve the (fsm) event for a given primitive using a map
Definition: prim.c:28
osmo_identifier_valid
bool osmo_identifier_valid(const char *str)
Determine if a given identifier is valid, i.e.
Definition: utils.c:671
osmo_stat_item_period::last
int32_t last
Most recent value passed to osmo_stat_item_set(), or the item->desc->default_value if none.
Definition: stat_item_internal.h:15
signal_handler::data
void * data
Definition: signal.c:42
osmo_timerfd_disable
int osmo_timerfd_disable(struct osmo_fd *ofd)
osmo_sockaddr_str_from_32h
int osmo_sockaddr_str_from_32h(struct osmo_sockaddr_str *sockaddr_str, uint32_t ip, uint16_t port)
talloc.h
llist_head
(double) linked list header structure
Definition: linuxlist.h:46
OSMO_IO_FD_MODE_RECVFROM_SENDTO
@ OSMO_IO_FD_MODE_RECVFROM_SENDTO
use recvfrom() / sendto() calls
Definition: osmo_io.h:23
osmo_sockaddr_str_from_sockaddr_in6
int osmo_sockaddr_str_from_sockaddr_in6(struct osmo_sockaddr_str *sockaddr_str, const struct sockaddr_in6 *src)
if
if(vty->type==VTY_SHELL_SERV)
signal.h
tall_stat_item_ctx
static void * tall_stat_item_ctx
talloc context from which we allocate
Definition: stat_item.c:170
rb_node::rb_parent_color
unsigned long rb_parent_color
Definition: linuxrbtree.h:96
osmo_sock_get_ip_and_port
int osmo_sock_get_ip_and_port(int fd, char *ip, size_t ip_len, char *port, size_t port_len, bool local)
osmo_prim_op_names
const struct value_string osmo_prim_op_names[5]
human-readable string mapping for osmo_prim_operation
Definition: prim.c:16
osmo_signal_cbfn
int osmo_signal_cbfn(unsigned int subsys, unsigned int signal, void *handler_data, void *signal_data)
signal callback function type
Definition: signal.h:33
LLIST_HEAD
static LLIST_HEAD(osmo_stat_item_groups)
global list of stat_item groups
log_reset_context
void log_reset_context(void)
Reset (clear) the logging context.
Definition: logging.c:800
OSMO_SOCK_F_NO_MCAST_LOOP
#define OSMO_SOCK_F_NO_MCAST_LOOP
disable multiast loop (IP_MULTICAST_LOOP)
Definition: socket.h:94
DLIO
#define DLIO
Osmocom IO sub-system.
Definition: logging.h:157
osmo_io_internal.h
osmo_io_fd::uring
struct osmo_io_fd::@40::@42 uring
prbs.h
osmo_prim_event_map::operation
enum osmo_prim_operation operation
operation to match
Definition: prim.h:89
rx_state
rx_state
Definition: sercomm.c:60
msgb.h
stat_item.h
osmo_prbs::coeff
uint64_t coeff
coefficients
Definition: prbs.h:9
osmo_sockaddr_str_from_in_addr
int osmo_sockaddr_str_from_in_addr(struct osmo_sockaddr_str *sockaddr_str, const struct in_addr *addr, uint16_t port)
__rb_rotate_right
static void __rb_rotate_right(struct rb_node *node, struct rb_root *root)
Definition: rbtree.c:46
OSMO_SOCK_F_UDP_REUSEADDR
#define OSMO_SOCK_F_UDP_REUSEADDR
use SO_REUSEADDR on UDP ports (required for multicast)
Definition: socket.h:98
osmo_sockaddr_str::af
int af
AF_INET for IPv4 address, or AF_INET6 for IPv6 address.
Definition: sockaddr_str.h:47
rb_root::rb_node
struct rb_node * rb_node
Definition: linuxrbtree.h:106
osmo_fd_write_disable
static void osmo_fd_write_disable(struct osmo_fd *ofd)
Definition: select.h:66
HDLC_C_UI
#define HDLC_C_UI
Definition: sercomm.c:56
osmo_timerfd_setup
int osmo_timerfd_setup(struct osmo_fd *ofd, int(*cb)(struct osmo_fd *, unsigned int), void *data)
sercomm_drv_start_tx
void sercomm_drv_start_tx(struct osmo_sercomm_inst *sercomm)
low-level driver routine to request start of transmission The Sercomm code calls this function to inf...
serial.h
osmo_sock_local_ip
int osmo_sock_local_ip(char *local_ip, const char *remote_ip)
osmo_io_fd::ofd
struct osmo_fd ofd
Definition: osmo_io_internal.h:93
rate_ctr_group_reset
void rate_ctr_group_reset(struct rate_ctr_group *ctrg)
Reset all counters in a group.
Definition: rate_ctr.c:489
osmo_sockaddr_str_from_str
int osmo_sockaddr_str_from_str(struct osmo_sockaddr_str *sockaddr_str, const char *ip, uint16_t port)
osmo_sockaddr_str_to_32h
int osmo_sockaddr_str_to_32h(const struct osmo_sockaddr_str *sockaddr_str, uint32_t *ip)
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:45
rate_ctr_timer
static struct osmo_fd rate_ctr_timer
Definition: rate_ctr.c:311
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:292
osmo_sockaddr_str_from_32
int osmo_sockaddr_str_from_32(struct osmo_sockaddr_str *sockaddr_str, uint32_t ip, uint16_t port)
osmo_signalfd_setup
struct osmo_signalfd * osmo_signalfd_setup(void *ctx, sigset_t set, osmo_signalfd_cb *cb, void *data)
llist_for_each_entry
#define llist_for_each_entry(pos, head, member)
Iterate over a linked list of a given type.
Definition: linuxlist.h:299
dbg_perror
#define dbg_perror(x)
Definition: serial.c:45
osmo_sercomm_inst::dlci
uint8_t dlci
DLCI of currently received msgb.
Definition: sercomm.h:61
__attribute__
enum gsm0808_assignment_requirement __attribute__
fls64 - find last set bit in a 64-bit word @x: the word to search
Definition: log2.h:61
osmo_stat_item_group::desc
const struct osmo_stat_item_group_desc * desc
Pointer to the counter group class.
Definition: stat_item.h:49
osmo_sock_init2_ofd
int osmo_sock_init2_ofd(struct osmo_fd *ofd, int family, int type, int proto, const char *local_host, uint16_t local_port, const char *remote_host, uint16_t remote_port, unsigned int flags)
osmo_fd_write_enable
static void osmo_fd_write_enable(struct osmo_fd *ofd)
Definition: select.h:62
osmo_strbuf::buf
char * buf
Point to the start of a string buffer.
Definition: utils.h:202
sockaddr_str.h
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:330
osmo_select_shutdown_done
bool osmo_select_shutdown_done(void)
LOGL_NOTICE
#define LOGL_NOTICE
abnormal/unexpected condition
Definition: logging.h:124
rate_ctr_intv
rate_ctr_intv
Rate counter interval.
Definition: rate_ctr.h:15
RX_ST_DATA
@ RX_ST_DATA
Definition: sercomm.c:64
osmo_sockaddr_netmask_to_prefixlen
int osmo_sockaddr_netmask_to_prefixlen(const struct osmo_sockaddr *addr)
sercomm_drv_lock
void sercomm_drv_lock(unsigned long __attribute__((unused)) *flags)
Protect against IRQ context.
Definition: sercomm.c:39
osmo_sercomm_tx_queue_depth
unsigned int osmo_sercomm_tx_queue_depth(struct osmo_sercomm_inst *sercomm, uint8_t dlci)
How deep is the Tx queue for a given DLCI?
Definition: sercomm.c:126
sercomm_drv_unlock
void sercomm_drv_unlock(unsigned long __attribute__((unused)) *flags)
Release protection against IRQ context.
Definition: sercomm.c:41
iofd_handle_recv
void iofd_handle_recv(struct osmo_io_fd *iofd, struct msgb *msg, int rc, struct iofd_msghdr *msghdr)
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:92
osmo_sockaddr::sin
struct sockaddr_in sin
Definition: socket.h:30
desc
osmo_stat_item_desc::name
const char * name
name of the item
Definition: stat_item.h:23
host
osmo_signalfd::ofd
struct osmo_fd ofd
Definition: select.h:99
value_string
A mapping between human-readable string and numeric value.
Definition: utils.h:51
osmo_sercomm_inst::state
int state
transmit state
Definition: sercomm.h:45
osmo_signalfd::cb
osmo_signalfd_cb * cb
Definition: select.h:101
osmo_sercomm_inst::rx
struct osmo_sercomm_inst::@25 rx
receive side
osmo_fd_get_by_fd
struct osmo_fd * osmo_fd_get_by_fd(int fd)
iofd_msg_action
iofd_msg_action
Definition: osmo_io_internal.h:105
osmo_timerfd_schedule
int osmo_timerfd_schedule(struct osmo_fd *ofd, const struct timespec *first, const struct timespec *interval)
osmo_sercomm_inst
one instance of a sercomm multiplex/demultiplex
Definition: sercomm.h:32
osmo_sockaddr_str_to_in_addr
int osmo_sockaddr_str_to_in_addr(const struct osmo_sockaddr_str *sockaddr_str, struct in_addr *dst)
osmo_signalfd_cb
void osmo_signalfd_cb(struct osmo_signalfd *osfd, const struct signalfd_siginfo *fdsi)
Definition: select.h:96
__attribute__
__attribute__((weak))
Definition: sercomm.c:47
osmo_prbs_get_ubits
int osmo_prbs_get_ubits(ubit_t *out, unsigned int out_len, struct osmo_prbs_state *state)
Fill buffer of unpacked bits with next bits out of given PRBS instance.
Definition: prbs.c:70
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:104
osmo_sock_set_dscp
int osmo_sock_set_dscp(int fd, uint8_t dscp)
ubit_t
uint8_t ubit_t
unpacked bit (0 or 1): 1 bit per byte
Definition: bits.h:24
linuxrbtree.h
iofd_msghdr::action
enum iofd_msg_action action
Definition: osmo_io_internal.h:117
ARRAY_SIZE
#define ARRAY_SIZE(x)
Determine number of elements in an array of static size.
Definition: utils.h:19
rb_node::rb_right
struct rb_node * rb_right
Definition: linuxrbtree.h:99
osmo_sock_get_name_buf
int osmo_sock_get_name_buf(char *str, size_t str_len, int fd)
rate_ctr::previous
uint64_t previous
previous value, used for delta
Definition: rate_ctr.h:31
osmo_sercomm_inst::msg_size
unsigned int msg_size
msgb allocation size for rx msgs
Definition: sercomm.h:55
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:33
OSMO_UNLIKELY
#define OSMO_UNLIKELY(exp)
Definition: utils.h:47
osmo_sercomm_change_speed
int osmo_sercomm_change_speed(struct osmo_sercomm_inst *sercomm, uint32_t bdrt)
wait until everything has been transmitted, then grab the lock and change the baud rate as requested
Definition: sercomm.c:144
OSMO_SOCKADDR_STR_FMT
#define OSMO_SOCKADDR_STR_FMT
Format string to print an osmo_sockaddr_str.
Definition: sockaddr_str.h:61
osmo_sock_get_remote_ip_port
int osmo_sock_get_remote_ip_port(int fd, char *port, size_t len)
IOFD_FLAG_IN_CALLBACK
#define IOFD_FLAG_IN_CALLBACK
Definition: osmo_io_internal.h:37
osmo_sockaddr_str_from_sockaddr
int osmo_sockaddr_str_from_sockaddr(struct osmo_sockaddr_str *sockaddr_str, const struct sockaddr_storage *src)
logging.h
osmo_strbuf
State for OSMO_STRBUF_APPEND() and OSMO_STRBUF_PRINTF().
Definition: utils.h:200
rb_last
struct rb_node * rb_last(const struct rb_root *root)
Definition: rbtree.c:296
osmo_sock_init2_multiaddr_pars::sctp
struct osmo_sock_init2_multiaddr_pars::@29::@31 sctp
OSMO_FD_WRITE
#define OSMO_FD_WRITE
Indicate interest in writing to the file descriptor.
Definition: select.h:19
rate_ctr::current
uint64_t current
current value
Definition: rate_ctr.h:30
osmo_stat_item_period::min
int32_t min
Smallest value seen in a reporting period.
Definition: stat_item_internal.h:13
iofd_msghdr::flags
int flags
Definition: osmo_io_internal.h:121
socket.h
osmo_serial_clear_custom_baudrate
int osmo_serial_clear_custom_baudrate(int fd)
Clear any custom baudrate.
Definition: serial.c:220
iofd_backend_ops::register_fd
int(* register_fd)(struct osmo_io_fd *iofd)
Definition: osmo_io_internal.h:27
msgb_pull
static unsigned char * msgb_pull(struct msgb *msgb, unsigned int len)
remove (pull) a header from the front of the message buffer
Definition: msgb.h:404
rb_set_parent
static void rb_set_parent(struct rb_node *rb, struct rb_node *p)
Definition: linuxrbtree.h:117
rate_ctr::intv
struct rate_ctr_per_intv intv[RATE_CTR_INTV_NUM]
per-interval data
Definition: rate_ctr.h:33
msgb_data
uint8_t * msgb_data(const struct msgb *msg)
get pointer to data section of message buffer
Definition: msgb.c:184
select.h
panic.h
rate_ctr.h
rb_node
Definition: linuxrbtree.h:94
osmo_ip_str_type
int osmo_ip_str_type(const char *ip)
DLGLOBAL
#define DLGLOBAL
global logging
Definition: logging.h:129
signal_handler
Definition: signal.c:38
osmo_stat_item_group_alloc
struct osmo_stat_item_group * osmo_stat_item_group_alloc(void *ctx, const struct osmo_stat_item_group_desc *group_desc, unsigned int idx)
Allocate a new group of counters according to description.
Definition: stat_item.c:179
osmo_io_fd
Definition: osmo_io_internal.h:49
osmo_fd
Structure representing a file dsecriptor.
Definition: select.h:31
osmo_sercomm_register_rx_cb
int osmo_sercomm_register_rx_cb(struct osmo_sercomm_inst *sercomm, uint8_t dlci, dlci_cb_t cb)
Register a handler for a given DLCI.
Definition: sercomm.c:245
LOGP
#define LOGP(ss, level, fmt, args...)
Log a new message through the Osmocom logging framework.
Definition: logging.h:49
llist_empty
static int llist_empty(const struct llist_head *head)
Test whether a linked list is empty.
Definition: linuxlist.h:169
rb_is_red
#define rb_is_red(r)
Definition: linuxrbtree.h:112
rb_parent
#define rb_parent(r)
Definition: linuxrbtree.h:110
osmo_sock_get_remote_ip
int osmo_sock_get_remote_ip(int fd, char *host, size_t len)
iofd_msgb_pending_or_alloc
struct msgb * iofd_msgb_pending_or_alloc(struct osmo_io_fd *iofd)
OSMO_STRBUF_PRINTF
#define OSMO_STRBUF_PRINTF(STRBUF, fmt, args...)
Shortcut for OSMO_STRBUF_APPEND() invocation using snprintf().
Definition: utils.h:281
osmo_sock_get_local_ip
int osmo_sock_get_local_ip(int fd, char *host, size_t len)
type
enum osmo_sub_auth_type type
osmo_sercomm_sendmsg
void osmo_sercomm_sendmsg(struct osmo_sercomm_inst *sercomm, uint8_t dlci, struct msgb *msg)
User interface for transmitting messages for a given DLCI.
Definition: sercomm.c:102
osmo_prbs_state::state
uint64_t state
Definition: prbs.h:15
osmo_stat_item_group_get_item
struct osmo_stat_item * osmo_stat_item_group_get_item(struct osmo_stat_item_group *grp, unsigned int idx)
Get statistics item from group, identified by index idx.
Definition: stat_item.c:239
rb_is_black
#define rb_is_black(r)
Definition: linuxrbtree.h:113
GET_OSMO_SOCK_F_PRIO
#define GET_OSMO_SOCK_F_PRIO(f)
Definition: socket.h:106
osmo_talloc_contexts::select
void * select
volatile select-dispatch context.
Definition: talloc.h:19
iofd_msghdr_alloc
struct iofd_msghdr * iofd_msghdr_alloc(struct osmo_io_fd *iofd, enum iofd_msg_action action, struct msgb *msg)
osmo_sercomm_alloc_msgb
static struct msgb * osmo_sercomm_alloc_msgb(unsigned int len)
Sercomm msgb allocator function.
Definition: sercomm.h:106
iofd_msghdr
Definition: osmo_io_internal.h:115
osmo_sockaddr_local_ip
int osmo_sockaddr_local_ip(struct osmo_sockaddr *local_ip, const struct osmo_sockaddr *remote_ip)
osmo_htons
#define osmo_htons(x)
Definition: byteswap.h:44
signal_handler::subsys
unsigned int subsys
Definition: signal.c:40
rate_ctr_group_desc
description of a rate counter group
Definition: rate_ctr.h:43
osmo_stat_item_group::items
struct osmo_stat_item * items[0]
Actual counter structures below.
Definition: stat_item.h:55
iofd_msghdr_free
void iofd_msghdr_free(struct iofd_msghdr *msghdr)
osmo_sockaddr_str_cmp
int osmo_sockaddr_str_cmp(const struct osmo_sockaddr_str *a, const struct osmo_sockaddr_str *b)
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:464
osmo_stat_item_desc
Statistics item description.
Definition: stat_item.h:22
rb_set_color
static void rb_set_color(struct rb_node *rb, int color)
Definition: linuxrbtree.h:121
msgb_dequeue
struct msgb * msgb_dequeue(struct llist_head *queue)
Dequeue message buffer from head of queue.
Definition: msgb.c:141
signal_handler::entry
struct llist_head entry
Definition: signal.c:39
linuxlist.h
list
struct llist_head list
log_done
probe log_done()
rate_ctr_per_intv::last
uint64_t last
counter value in last interval
Definition: rate_ctr.h:24
osmo_sock_init_sa
int osmo_sock_init_sa(struct sockaddr *ss, uint16_t type, uint8_t proto, unsigned int flags)
RATE_CTR_INTV_DAY
@ RATE_CTR_INTV_DAY
last day
Definition: rate_ctr.h:19
IOFD_ACT_SENDTO
@ IOFD_ACT_SENDTO
Definition: osmo_io_internal.h:109
OSMO_SNPRINTF_RET
#define OSMO_SNPRINTF_RET(ret, rem, offset, len)
Definition: utils.h:99
prim.h
osmo_select_shutdown_request
void osmo_select_shutdown_request(void)
osmo_sock_mcast_iface_set
int osmo_sock_mcast_iface_set(int fd, const char *ifname)
osmo_fd::fd
int fd
actual operating-system level file decriptor
Definition: select.h:35
osmo_sockaddr_str_to_sockaddr
int osmo_sockaddr_str_to_sockaddr(const struct osmo_sockaddr_str *sockaddr_str, struct sockaddr_storage *dst)
osmo_prbs_state
state of a given PRBS sequence generator
Definition: prbs.h:13
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)
Iterate over all items in group, call user-supplied function on each.
Definition: stat_item.c:394
OSMO_MIN
#define OSMO_MIN(a, b)
Return the minimum of two specified values.
Definition: utils.h:24
GET_OSMO_SOCK_F_DSCP
#define GET_OSMO_SOCK_F_DSCP(f)
Definition: socket.h:102
LOGL_DEBUG
#define LOGL_DEBUG
different log levels
Definition: logging.h:122
osmo_io_fd::mode
enum osmo_io_fd_mode mode
type of read/write mode to use
Definition: osmo_io_internal.h:55
RX_ST_CTRL
@ RX_ST_CTRL
Definition: sercomm.c:63
OSMO_SOCK_F_BIND
#define OSMO_SOCK_F_BIND
bind the socket to a local address/port
Definition: socket.h:90
msgb_enqueue
void msgb_enqueue(struct llist_head *queue, struct msgb *msg)
Enqueue message buffer to tail of a queue.
Definition: msgb.c:129
osmo_stat_item_init
int osmo_stat_item_init(void *tall_ctx)
Initialize the stat item module.
Definition: stat_item.c:319
osmo_sockaddr_to_str_c
char * osmo_sockaddr_to_str_c(void *ctx, const struct osmo_sockaddr *sockaddr)
osmo_prim_hdr::primitive
unsigned int primitive
Primitive number.
Definition: prim.h:49
osmo_fd::data
void * data
data pointer passed through to call-back function
Definition: select.h:43
osmo_sockaddr_str
Definition: sockaddr_str.h:45
osmo_prim_event_map::primitive
unsigned int primitive
primtiive to match
Definition: prim.h:88
LOGL_ERROR
#define LOGL_ERROR
error condition, requires user action
Definition: logging.h:125
RATE_CTR_INTV_SEC
@ RATE_CTR_INTV_SEC
last second
Definition: rate_ctr.h:16
rate_ctr_reset
void rate_ctr_reset(struct rate_ctr *ctr)
Reset a rate counter back to zero.
Definition: rate_ctr.c:481
osmo_stat_item_get_group_by_name_idxname
struct osmo_stat_item_group * osmo_stat_item_get_group_by_name_idxname(const char *group_name, const char *idx_name)
Search for item group based on group name and index's name.
Definition: stat_item.c:350
osmo_sockaddr_str::port
uint16_t port
Port number.
Definition: sockaddr_str.h:51
LLIST_HEAD
static LLIST_HEAD(rate_ctr_groups)
osmo_select_main
int osmo_select_main(int polling)
rate_ctr
data we keep for each actual value
Definition: rate_ctr.h:29
OSMO_FD_EXCEPT
#define OSMO_FD_EXCEPT
Indicate interest in exceptions from the file descriptor.
Definition: select.h:21
osmo_sockaddr_str_to_32n
int osmo_sockaddr_str_to_32n(const struct osmo_sockaddr_str *sockaddr_str, uint32_t *ip) OSMO_DEPRECATED("osmo_sockaddr_str_to_32n() actually uses *host* byte order. Use osmo_sockaddr_str_to_32h() instead")
OSMO_MAX
#define OSMO_MAX(a, b)
Return the maximum of two specified values.
Definition: utils.h:22
dlci_cb_t
void(* dlci_cb_t)(struct osmo_sercomm_inst *sercomm, uint8_t dlci, struct msgb *msg)
call-back function for per-DLC receive handler
Definition: sercomm.h:29
osmo_sockaddr_ntop
const char * osmo_sockaddr_ntop(const struct sockaddr *sa, char *dst)
ENOTSUP
#define ENOTSUP
OSMO_SOCK_F_NO_MCAST_ALL
#define OSMO_SOCK_F_NO_MCAST_ALL
disable receiving all multiast even for non-subscribed groups
Definition: socket.h:96
PRIM_OP_CONFIRM
@ PRIM_OP_CONFIRM
confirm
Definition: prim.h:30
rb_erase
void rb_erase(struct rb_node *node, struct rb_root *root)
Definition: rbtree.c:214
osmo_prim_hdr::sap
unsigned int sap
Service Access Point Identifier.
Definition: prim.h:48
osmo_sockaddr_is_any
int osmo_sockaddr_is_any(const struct osmo_sockaddr *addr)
PRIM_OP_RESPONSE
@ PRIM_OP_RESPONSE
response
Definition: prim.h:28
handle_counter
static int handle_counter(struct osmo_counter *counter, void *vctx_)
rate_ctr_group::name
char * name
Optional string-based identifier to be used instead of index at report time.
Definition: rate_ctr.h:65
RX_ST_WAIT_START
@ RX_ST_WAIT_START
Definition: sercomm.c:61
osmo_sockaddr_to_str
const char * osmo_sockaddr_to_str(const struct osmo_sockaddr *sockaddr)
rate_ctr_group::idx
unsigned int idx
The index of this ctr_group within its class.
Definition: rate_ctr.h:63
osmo_stats_tcp_osmo_fd_unregister
int osmo_stats_tcp_osmo_fd_unregister(const struct osmo_fd *fd)
Register an osmo_fd for TCP stats monitoring.
Definition: stats_tcp.c:242