libosmo-netif 1.6.0.16-c51c Osmocom network interface library

Loading...
Searching...
No Matches
prim.h
1/* (C) 2021 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
2 * Author: Pau Espin Pedrol <pespin@sysmocom.de>
3 * All Rights Reserved
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Affero General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Affero General Public License for more details.
14 *
15 * You should have received a copy of the GNU Affero General Public License
16 * along with this program. If not, see <http://www.gnu.org/lienses/>.
17 *
18 */
19#pragma once
20
21#include <stdint.h>
22
23#include <osmocom/core/prim.h>
24#include <osmocom/core/select.h>
25#include <osmocom/core/linuxlist.h>
26
27struct osmo_prim_srv_link;
28struct osmo_prim_srv;
29
30typedef int (*osmo_prim_srv_conn_cb)(struct osmo_prim_srv *prim_srv);
32typedef int (*osmo_prim_srv_rx_cb)(struct osmo_prim_srv *prim_srv, struct osmo_prim_hdr *oph);
33
41typedef int (*osmo_prim_srv_rx_sapi_version)(struct osmo_prim_srv *prim_srv, uint32_t sapi, uint16_t rem_version);
42
43struct osmo_prim_hdr *osmo_prim_msgb_alloc(unsigned int sap, unsigned int primitive,
44 enum osmo_prim_operation operation, size_t alloc_len);
45
46struct osmo_prim_srv_link *osmo_prim_srv_link_alloc(void *ctx);
47void osmo_prim_srv_link_free(struct osmo_prim_srv_link *prim_link);
48void osmo_prim_srv_link_set_name(struct osmo_prim_srv_link *prim_link, const char *name);
49int osmo_prim_srv_link_set_addr(struct osmo_prim_srv_link *prim_link, const char *path);
50const char *osmo_prim_srv_link_get_addr(struct osmo_prim_srv_link *prim_link);
51void osmo_prim_srv_link_set_priv(struct osmo_prim_srv_link *prim_link, void *priv);
52void *osmo_prim_srv_link_get_priv(const struct osmo_prim_srv_link *prim_link);
53void osmo_prim_srv_link_set_log_category(struct osmo_prim_srv_link *prim_link, int log_cat);
54void osmo_prim_srv_link_set_opened_conn_cb(struct osmo_prim_srv_link *prim_link, osmo_prim_srv_conn_cb opened_conn_cb);
55void osmo_prim_srv_link_set_closed_conn_cb(struct osmo_prim_srv_link *prim_link, osmo_prim_srv_conn_cb closed_conn_cb);
56void osmo_prim_srv_link_set_rx_sapi_version_cb(struct osmo_prim_srv_link *prim_link, osmo_prim_srv_rx_sapi_version rx_sapi_version_cb);
57void osmo_prim_srv_link_set_rx_cb(struct osmo_prim_srv_link *prim_link, osmo_prim_srv_rx_cb rx_cb);
58void osmo_prim_srv_link_set_rx_msgb_alloc_len(struct osmo_prim_srv_link *prim_link, size_t alloc_len);
59int osmo_prim_srv_link_open(struct osmo_prim_srv_link *prim_link);
60
61int osmo_prim_srv_send(struct osmo_prim_srv *prim_srv, struct msgb *msg);
62struct osmo_prim_srv_link *osmo_prim_srv_get_link(struct osmo_prim_srv *prims_srv);
63void osmo_prim_srv_set_name(struct osmo_prim_srv *prim_srv, const char *name);
64void osmo_prim_srv_set_priv(struct osmo_prim_srv *prim_srv, void *priv);
65void *osmo_prim_srv_get_priv(const struct osmo_prim_srv *prim_srv);
66void osmo_prim_srv_close(struct osmo_prim_srv *prim_srv);