diff options
author | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2016-12-08 21:30:34 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2016-12-13 14:54:01 +0000 |
commit | 49012f14dd5480573943e5d8cd5e9908f3eabb16 (patch) | |
tree | 4e00395a69f244daa66c334d28f9be61e01ebcb1 /openbsc/include | |
parent | 736474ce451a92cdc17db5f290f55f8cf22a13a2 (diff) |
oap: rename public API from oap_ to oap_client_
Mainly to differentiate the OAP messaging API (osmo_oap_ in libosmocore) from
the OAP client.
This is in preparation for moving the oap client to libcommon, which is in turn
preparation for libvlr. Add the osmo_ prefix, as all public Osmocom API should
have. We also have OAP messages code in libosmocore, so clarify by naming this
osmo_oap_client, and by also renaming the oap_test to oap_client_test. This
reshuffling will allow an easy move of OAP to libosmocore if we should want to
do that. A number of patches will follow up on this.
Related: OS#1592
Change-Id: Id447d2bebc026a375567654adafa5f82439ea7e1
Diffstat (limited to 'openbsc/include')
-rw-r--r-- | openbsc/include/openbsc/gsup_client.h | 4 | ||||
-rw-r--r-- | openbsc/include/openbsc/oap.h | 32 | ||||
-rw-r--r-- | openbsc/include/openbsc/sgsn.h | 2 |
3 files changed, 21 insertions, 17 deletions
diff --git a/openbsc/include/openbsc/gsup_client.h b/openbsc/include/openbsc/gsup_client.h index 551f76d75..d21a54d83 100644 --- a/openbsc/include/openbsc/gsup_client.h +++ b/openbsc/include/openbsc/gsup_client.h @@ -41,7 +41,7 @@ struct gsup_client { gsup_client_read_cb_t read_cb; void *data; - struct oap_state oap_state; + struct oap_client_state oap_state; struct osmo_timer_list ping_timer; struct osmo_timer_list connect_timer; @@ -52,7 +52,7 @@ struct gsup_client { struct gsup_client *gsup_client_create(const char *ip_addr, unsigned int tcp_port, gsup_client_read_cb_t read_cb, - struct oap_config *oap_config); + struct oap_client_config *oap_config); void gsup_client_destroy(struct gsup_client *gsupc); int gsup_client_send(struct gsup_client *gsupc, struct msgb *msg); diff --git a/openbsc/include/openbsc/oap.h b/openbsc/include/openbsc/oap.h index 2206184d1..80c86d5d6 100644 --- a/openbsc/include/openbsc/oap.h +++ b/openbsc/include/openbsc/oap.h @@ -27,9 +27,10 @@ struct msgb; struct osmo_oap_message; -/* This is the config part for vty. It is essentially copied in oap_state, - * where values are copied over once the config is considered valid. */ -struct oap_config { +/* This is the config part for vty. It is essentially copied in + * oap_client_state, where values are copied over once the config is + * considered valid. */ +struct oap_client_config { uint16_t client_id; int secret_k_present; uint8_t secret_k[16]; @@ -38,9 +39,10 @@ struct oap_config { }; /* The runtime state of the OAP client. client_id and the secrets are in fact - * duplicated from oap_config, so that a separate validation of the config data - * is possible, and so that only a struct oap_state* is passed around. */ -struct oap_state { + * duplicated from oap_client_config, so that a separate validation of the + * config data is possible, and so that only a struct oap_client_state* is + * passed around. */ +struct oap_client_state { enum { OAP_UNINITIALIZED = 0, /* just allocated. */ OAP_DISABLED, /* disabled by config. */ @@ -56,23 +58,25 @@ struct oap_state { }; /* From config, initialize state. Return 0 on success. */ -int oap_init(struct oap_config *config, struct oap_state *state); +int oap_client_init(struct oap_client_config *config, + struct oap_client_state *state); /* Construct an OAP registration message and return in *msg_tx. Use * state->client_id and update state->state. * Return 0 on success, or a negative value on error. * If an error is returned, *msg_tx is guaranteed to be NULL. */ -int oap_register(struct oap_state *state, struct msgb **msg_tx); +int oap_client_register(struct oap_client_state *state, struct msgb **msg_tx); /* Decode and act on a received OAP message msg_rx. Update state->state. If a * non-NULL pointer is returned in *msg_tx, that msgb should be sent to the OAP * server (and freed) by the caller. The received msg_rx is not freed. * Return 0 on success, or a negative value on error. * If an error is returned, *msg_tx is guaranteed to be NULL. */ -int oap_handle(struct oap_state *state, const struct msgb *msg_rx, struct msgb **msg_tx); - -/* Allocate a msgb and in it, return the encoded oap_msg. Return NULL on - * error. (Like oap_encode(), but also allocates a msgb.) - * About the name: the idea is do_something(oap_encoded(my_struct)) */ -struct msgb *oap_encoded(const struct osmo_oap_message *oap_msg); +int oap_client_handle(struct oap_client_state *state, + const struct msgb *msg_rx, struct msgb **msg_tx); +/* Allocate a msgb and in it, return the encoded oap_client_msg. Return + * NULL on error. (Like oap_client_encode(), but also allocates a msgb.) + * About the name: the idea is do_something(oap_client_encoded(my_struct)) + */ +struct msgb *oap_client_encoded(const struct osmo_oap_message *oap_client_msg); diff --git a/openbsc/include/openbsc/sgsn.h b/openbsc/include/openbsc/sgsn.h index 0045fae39..c8dcc0de8 100644 --- a/openbsc/include/openbsc/sgsn.h +++ b/openbsc/include/openbsc/sgsn.h @@ -92,7 +92,7 @@ struct sgsn_config { int dynamic_lookup; - struct oap_config oap; + struct oap_client_config oap; /* RFC1144 TCP/IP header compression */ struct { |