gsup_server: Add "priv" pointer and make it point to 'struct hlr'

Change-Id: Iada68996b7f4cbdcca92b254ddaf6b88b962e6f1
This commit is contained in:
Harald Welte 2018-06-16 17:07:28 +02:00
parent b85f60477f
commit 32acace879
3 changed files with 8 additions and 3 deletions

View File

@ -292,7 +292,7 @@ failed:
struct osmo_gsup_server *
osmo_gsup_server_create(void *ctx, const char *ip_addr, uint16_t tcp_port,
osmo_gsup_read_cb_t read_cb,
struct llist_head *lu_op_lst)
struct llist_head *lu_op_lst, void *priv)
{
struct osmo_gsup_server *gsups;
int rc;
@ -312,6 +312,7 @@ osmo_gsup_server_create(void *ctx, const char *ip_addr, uint16_t tcp_port,
goto failed;
gsups->read_cb = read_cb;
gsups->priv = priv;
rc = ipa_server_link_open(gsups->link);
if (rc < 0)

View File

@ -16,6 +16,9 @@ struct osmo_gsup_conn;
typedef int (*osmo_gsup_read_cb_t)(struct osmo_gsup_conn *conn, struct msgb *msg);
struct osmo_gsup_server {
/* private data of the application/user */
void *priv;
/* list of osmo_gsup_conn */
struct llist_head clients;
@ -53,7 +56,8 @@ struct osmo_gsup_server *osmo_gsup_server_create(void *ctx,
const char *ip_addr,
uint16_t tcp_port,
osmo_gsup_read_cb_t read_cb,
struct llist_head *lu_op_lst);
struct llist_head *lu_op_lst,
void *priv);
void osmo_gsup_server_destroy(struct osmo_gsup_server *gsups);

View File

@ -600,7 +600,7 @@ int main(int argc, char **argv)
}
g_hlr->gs = osmo_gsup_server_create(hlr_ctx, g_hlr->gsup_bind_addr, OSMO_GSUP_PORT,
read_cb, &g_lu_ops);
read_cb, &g_lu_ops, g_hlr);
if (!g_hlr->gs) {
LOGP(DMAIN, LOGL_FATAL, "Error starting GSUP server\n");
exit(1);