mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-cbc.git
synced 2025-10-23 08:22:19 +00:00
Refactor {cbsp,sbcap}_cbc_accept_cb
Delay allocating the structures until really needed. First do checks agains the opened connection, and if an issue is detected simply close the fd. Next, fetch or allocate the related peer. Finally, create the link from the fd. This makes it easier to add early extra checks later when peers will contain info on link_mode (client|server|disabled) later on. Change-Id: Id4f83ec6b0b14e556b1caa9c80e7f68d062fec57
This commit is contained in:
@@ -40,6 +40,8 @@ struct cbc_cbsp_link {
|
||||
struct cbc_peer *peer;
|
||||
};
|
||||
|
||||
struct cbc_cbsp_link *cbc_cbsp_link_alloc(struct cbc_cbsp_mgr *cbc, struct cbc_peer *peer);
|
||||
void cbc_cbsp_link_free(struct cbc_cbsp_link *link);
|
||||
const char *cbc_cbsp_link_name(const struct cbc_cbsp_link *link);
|
||||
void cbc_cbsp_link_tx(struct cbc_cbsp_link *link, struct osmo_cbsp_decoded *cbsp);
|
||||
void cbc_cbsp_link_close(struct cbc_cbsp_link *link);
|
||||
|
@@ -38,6 +38,8 @@ struct cbc_sbcap_link {
|
||||
struct cbc_peer *peer;
|
||||
};
|
||||
|
||||
struct cbc_sbcap_link *cbc_sbcap_link_alloc(struct cbc_sbcap_mgr *cbc, struct cbc_peer *peer);
|
||||
void cbc_sbcap_link_free(struct cbc_sbcap_link *link);
|
||||
const char *cbc_sbcap_link_name(const struct cbc_sbcap_link *link);
|
||||
void cbc_sbcap_link_tx(struct cbc_sbcap_link *link, SBcAP_SBC_AP_PDU_t *pdu);
|
||||
void cbc_sbcap_link_close(struct cbc_sbcap_link *link);
|
||||
|
Reference in New Issue
Block a user