diff options
author | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2023-03-13 06:01:08 +0700 |
---|---|---|
committer | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2023-03-13 06:16:48 +0700 |
commit | 9feb5057da41611033a5881409c4fef2628d98a9 (patch) | |
tree | 11c4833a33cf9abbbdb5c4bea715739e7d574c86 /src/host/layer23/include/osmocom/bb/common | |
parent | c43d4183f514bbbe200048f07d75a5cad79bae55 (diff) |
layer23: refactor the application API concept
With this set of changes we have a cleaner l23 app architecture:
* struct vty_app_info: all l23 applications must define this struct;
* struct vty_app_info: *cfg_supported() becomes a mask of L23_OPT_*;
* struct vty_app_info: explicitly set L23_OPT_* in all l23 apps;
* drop l23_app_info(), there can be only one vty_app_info per an app;
It's no more needed to obtain the vty_app_info by calling a function
and checking the returned value against NULL everywhere. This kind
of information is rather static (not dynamically composed) and needs
not to be encapsulated into functions.
Change-Id: I89004cd5308927305f79b102f7b695709148df6d
Diffstat (limited to 'src/host/layer23/include/osmocom/bb/common')
-rw-r--r-- | src/host/layer23/include/osmocom/bb/common/l23_app.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/host/layer23/include/osmocom/bb/common/l23_app.h b/src/host/layer23/include/osmocom/bb/common/l23_app.h index 8ae4ead1..fd8c8770 100644 --- a/src/host/layer23/include/osmocom/bb/common/l23_app.h +++ b/src/host/layer23/include/osmocom/bb/common/l23_app.h @@ -60,10 +60,10 @@ extern int (*l23_app_exit)(void); struct l23_app_info { const char *copyright; const char *contribution; - struct vty_app_info *vty_info; /* L23_OPT_VTY */ + const struct vty_app_info *vty_info; /* L23_OPT_VTY */ char *getopt_string; - int (*cfg_supported)(); + uint32_t opt_supported; /* mask of L23_OPT_* */ int (*cfg_print_help)(); int (*cfg_getopt_opt)(struct option **options); int (*cfg_handle_opt)(int c,const char *optarg); @@ -71,6 +71,7 @@ struct l23_app_info { osmo_tundev_data_ind_cb_t tun_data_ind_cb; }; -extern struct l23_app_info *l23_app_info(); +/* all l23 apps must define this structure */ +extern const struct l23_app_info l23_app_info; #endif /* _L23_APP_H */ |