diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2023-05-03 20:46:50 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2023-05-04 12:03:52 +0200 |
commit | bbfb569b8ec650060c97d64c5063cd35e851e4d5 (patch) | |
tree | 8ef8c49198c842084c8f68f592fe2a2b967f016a /src/host/layer23/include/osmocom/bb/common | |
parent | bb5e13ca23e242dd9b70962065c8c01fbb4c3d7a (diff) |
layer23: Introduce apn_fsm
This allows further control on the state of the APNs, as well as
a step further towards administering them through VTY.
Change-Id: I2cc732dfb020d31ab89025e7e22276b819dcb24a
Diffstat (limited to 'src/host/layer23/include/osmocom/bb/common')
4 files changed, 33 insertions, 0 deletions
diff --git a/src/host/layer23/include/osmocom/bb/common/Makefile.am b/src/host/layer23/include/osmocom/bb/common/Makefile.am index 28caf78d..7c0fa972 100644 --- a/src/host/layer23/include/osmocom/bb/common/Makefile.am +++ b/src/host/layer23/include/osmocom/bb/common/Makefile.am @@ -1,5 +1,6 @@ noinst_HEADERS = \ apn.h \ + apn_fsm.h \ l1ctl.h \ l1l2_interface.h \ l23_app.h \ diff --git a/src/host/layer23/include/osmocom/bb/common/apn.h b/src/host/layer23/include/osmocom/bb/common/apn.h index 94784ef7..538b31dd 100644 --- a/src/host/layer23/include/osmocom/bb/common/apn.h +++ b/src/host/layer23/include/osmocom/bb/common/apn.h @@ -20,6 +20,7 @@ #include <osmocom/core/linuxlist.h> #include <osmocom/core/select.h> #include <osmocom/core/tun.h> +#include <osmocom/bb/common/apn_fsm.h> struct osmocom_ms; @@ -50,6 +51,7 @@ struct osmobb_apn { bool tx_gpdu_seq; } cfg; struct osmo_tundev *tun; + struct apn_fsm_ctx fsm; }; struct osmobb_apn *apn_alloc(struct osmocom_ms *ms, const char *name); diff --git a/src/host/layer23/include/osmocom/bb/common/apn_fsm.h b/src/host/layer23/include/osmocom/bb/common/apn_fsm.h new file mode 100644 index 00000000..890267c9 --- /dev/null +++ b/src/host/layer23/include/osmocom/bb/common/apn_fsm.h @@ -0,0 +1,29 @@ +#pragma once + +#include <osmocom/core/fsm.h> + +struct osmobb_apn; + +enum apn_fsm_states { + APN_ST_DISABLED, + APN_ST_INACTIVE, + APN_ST_ACTIVATING, + APN_ST_ACTIVE, +}; + +enum apn_fsm_events { + APN_EV_GPRS_ALLOWED, /* data: bool *allowed */ + APN_EV_GMM_ATTACHED, + APN_EV_GMM_DETACHED, + APN_EV_RX_SM_ACT_PDP_CTX_REJ, /* data: enum gsm48_gsm_cause *cause */ + APN_EV_RX_SM_ACT_PDP_CTX_ACC, + APN_EV_RX_SM_DEACT_PDP_CTX_ACC, +}; + +struct apn_fsm_ctx { + struct osmo_fsm_inst *fi; + struct osmobb_apn *apn; +}; + +int apn_fsm_ctx_init(struct apn_fsm_ctx *ctx, struct osmobb_apn *apn); +void apn_fsm_ctx_release(struct apn_fsm_ctx *ctx); diff --git a/src/host/layer23/include/osmocom/bb/common/settings.h b/src/host/layer23/include/osmocom/bb/common/settings.h index 88ce280a..38faa4bb 100644 --- a/src/host/layer23/include/osmocom/bb/common/settings.h +++ b/src/host/layer23/include/osmocom/bb/common/settings.h @@ -205,6 +205,7 @@ struct gprs_settings { int gprs_settings_init(struct osmocom_ms *ms); int gprs_settings_fi(struct osmocom_ms *ms); struct osmobb_apn *ms_find_apn_by_name(struct osmocom_ms *ms, const char *apn_name); +int ms_dispatch_all_apn(struct osmocom_ms *ms, uint32_t event, void *data); extern char *layer2_socket_path; |