[GTP] xact: Avoid exporting internally used functions (#1329)

* [GTP] xact: Fix trailing whitespace

* [GTP] xact: Avoid exporting internally used functions

This simplifies the API header hiding unneeded APIs from external
components, and lets the compiler further optimize by
marking the functions as static.

* [GTP] xact: Drop unused API ogs_gtp_xact_find

After making it static, it became clear to the compiler that this
function is not used anywhere, warning about it. Let's drop it.
This commit is contained in:
Pau Espin 2022-01-19 11:54:44 +01:00 committed by GitHub
parent 8955fdcd5d
commit ed3a3a527a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 19 deletions

View File

@ -32,8 +32,13 @@ static uint32_t g_xact_id = 0;
static OGS_POOL(pool, ogs_gtp_xact_t);
static ogs_gtp_xact_t *ogs_gtp_xact_remote_create(ogs_gtp_node_t *gnode, uint32_t sqn);
static ogs_gtp_xact_stage_t ogs_gtp_xact_get_stage(uint8_t type, uint32_t sqn);
static int ogs_gtp_xact_delete(ogs_gtp_xact_t *xact);
static int ogs_gtp_xact_update_rx(ogs_gtp_xact_t *xact, uint8_t type);
static ogs_gtp_xact_t *ogs_gtp_xact_find(ogs_index_t index);
static ogs_gtp_xact_t *ogs_gtp_xact_find_by_xid(
ogs_gtp_node_t *gnode, uint8_t type, uint32_t xid);
static void response_timeout(void *data);
static void holding_timeout(void *data);
@ -98,7 +103,7 @@ ogs_gtp_xact_t *ogs_gtp_xact_local_create(ogs_gtp_node_t *gnode,
ogs_assert(xact->tm_holding);
xact->holding_rcount = ogs_app()->time.message.gtp.n3_holding_rcount,
ogs_list_add(xact->org == OGS_GTP_LOCAL_ORIGINATOR ?
ogs_list_add(xact->org == OGS_GTP_LOCAL_ORIGINATOR ?
&xact->gnode->local_list : &xact->gnode->remote_list, xact);
rv = ogs_gtp_xact_update_tx(xact, hdesc, pkbuf);
@ -117,7 +122,7 @@ ogs_gtp_xact_t *ogs_gtp_xact_local_create(ogs_gtp_node_t *gnode,
return xact;
}
ogs_gtp_xact_t *ogs_gtp_xact_remote_create(ogs_gtp_node_t *gnode, uint32_t sqn)
static ogs_gtp_xact_t *ogs_gtp_xact_remote_create(ogs_gtp_node_t *gnode, uint32_t sqn)
{
char buf[OGS_ADDRSTRLEN];
ogs_gtp_xact_t *xact = NULL;
@ -143,7 +148,7 @@ ogs_gtp_xact_t *ogs_gtp_xact_remote_create(ogs_gtp_node_t *gnode, uint32_t sqn)
ogs_assert(xact->tm_holding);
xact->holding_rcount = ogs_app()->time.message.gtp.n3_holding_rcount,
ogs_list_add(xact->org == OGS_GTP_LOCAL_ORIGINATOR ?
ogs_list_add(xact->org == OGS_GTP_LOCAL_ORIGINATOR ?
&xact->gnode->local_list : &xact->gnode->remote_list, xact);
ogs_debug("[%d] %s Create peer [%s]:%d",
@ -177,7 +182,7 @@ int ogs_gtp_xact_update_tx(ogs_gtp_xact_t *xact,
ogs_gtp_xact_stage_t stage;
ogs_gtp_header_t *h = NULL;
int gtp_hlen = 0;
ogs_assert(xact);
ogs_assert(xact->gnode);
ogs_assert(hdesc);
@ -278,7 +283,7 @@ int ogs_gtp_xact_update_tx(ogs_gtp_xact_t *xact,
return OGS_OK;
}
int ogs_gtp_xact_update_rx(ogs_gtp_xact_t *xact, uint8_t type)
static int ogs_gtp_xact_update_rx(ogs_gtp_xact_t *xact, uint8_t type)
{
int rv = OGS_OK;
char buf[OGS_ADDRSTRLEN];
@ -460,7 +465,7 @@ int ogs_gtp_xact_commit(ogs_gtp_xact_t *xact)
uint8_t type;
ogs_pkbuf_t *pkbuf = NULL;
ogs_gtp_xact_stage_t stage;
ogs_assert(xact);
ogs_assert(xact->gnode);
@ -685,11 +690,6 @@ int ogs_gtp_xact_receive(
return rv;
}
ogs_gtp_xact_t *ogs_gtp_xact_find(ogs_index_t index)
{
return ogs_pool_find(&pool, index);
}
static ogs_gtp_xact_stage_t ogs_gtp_xact_get_stage(uint8_t type, uint32_t xid)
{
ogs_gtp_xact_stage_t stage = GTP_XACT_UNKNOWN_STAGE;
@ -741,7 +741,7 @@ static ogs_gtp_xact_stage_t ogs_gtp_xact_get_stage(uint8_t type, uint32_t xid)
return stage;
}
ogs_gtp_xact_t *ogs_gtp_xact_find_by_xid(
static ogs_gtp_xact_t *ogs_gtp_xact_find_by_xid(
ogs_gtp_node_t *gnode, uint8_t type, uint32_t xid)
{
char buf[OGS_ADDRSTRLEN];
@ -849,4 +849,3 @@ static int ogs_gtp_xact_delete(ogs_gtp_xact_t *xact)
return OGS_OK;
}

View File

@ -111,23 +111,17 @@ void ogs_gtp_xact_final(void);
ogs_gtp_xact_t *ogs_gtp_xact_local_create(ogs_gtp_node_t *gnode,
ogs_gtp_header_t *hdesc, ogs_pkbuf_t *pkbuf,
void (*cb)(ogs_gtp_xact_t *xact, void *data), void *data);
ogs_gtp_xact_t *ogs_gtp_xact_remote_create(
ogs_gtp_node_t *gnode, uint32_t sqn);
ogs_gtp_xact_t *ogs_gtp_xact_cycle(ogs_gtp_xact_t *xact);
void ogs_gtp_xact_delete_all(ogs_gtp_node_t *gnode);
int ogs_gtp_xact_update_tx(ogs_gtp_xact_t *xact,
ogs_gtp_header_t *hdesc, ogs_pkbuf_t *pkbuf);
int ogs_gtp_xact_update_rx(ogs_gtp_xact_t *xact, uint8_t type);
int ogs_gtp_xact_commit(ogs_gtp_xact_t *xact);
int ogs_gtp_xact_receive(ogs_gtp_node_t *gnode,
ogs_gtp_header_t *h, ogs_gtp_xact_t **xact);
ogs_gtp_xact_t *ogs_gtp_xact_find(ogs_index_t index);
ogs_gtp_xact_t *ogs_gtp_xact_find_by_xid(
ogs_gtp_node_t *gnode, uint8_t type, uint32_t xid);
void ogs_gtp_xact_associate(ogs_gtp_xact_t *xact1, ogs_gtp_xact_t *xact2);
void ogs_gtp_xact_deassociate(ogs_gtp_xact_t *xact1, ogs_gtp_xact_t *xact2);