mirror of
				https://gitea.osmocom.org/cellular-infrastructure/osmo-cbc.git
				synced 2025-11-04 06:03:35 +00:00 
			
		
		
		
	Rename fields in cbc_{cbsp,sbcap}_mgr
* link -> srv_link to avoid confusing with cbsp/sbcap links * clients -> links, since it holds links, which in the future will be both TCP/SCTP clients and servers. Change-Id: I4717f49413af45b45059c1601a667f4161b4ca8a
This commit is contained in:
		@@ -15,10 +15,10 @@ struct cbc_peer;
 | 
			
		||||
/* Holder of all CBSP conn related information: */
 | 
			
		||||
struct cbc_cbsp_mgr {
 | 
			
		||||
	/* libosmo-netif stream server */
 | 
			
		||||
	struct osmo_stream_srv_link *link;
 | 
			
		||||
	struct osmo_stream_srv_link *srv_link;
 | 
			
		||||
 | 
			
		||||
	/* BSCs / clients connected to this CBC */
 | 
			
		||||
	struct llist_head clients;
 | 
			
		||||
	/* BSCs / links connected to this CBC */
 | 
			
		||||
	struct llist_head links;
 | 
			
		||||
 | 
			
		||||
	/* receive call-back; called for every received message */
 | 
			
		||||
	int (*rx_cb)(struct cbc_cbsp_link *link, struct osmo_cbsp_decoded *dec);
 | 
			
		||||
@@ -28,7 +28,7 @@ struct cbc_cbsp_mgr *cbc_cbsp_mgr_create(void *ctx);
 | 
			
		||||
 | 
			
		||||
/* a CBSP link with a single (remote) peer connected to us */
 | 
			
		||||
struct cbc_cbsp_link {
 | 
			
		||||
	/* entry in osmo_cbsp_cbc.clients */
 | 
			
		||||
	/* entry in osmo_cbsp_cbc.links */
 | 
			
		||||
	struct llist_head list;
 | 
			
		||||
	/* stream server connection for this link */
 | 
			
		||||
	struct osmo_stream_srv *conn;
 | 
			
		||||
 
 | 
			
		||||
@@ -18,10 +18,10 @@ struct cbc_peer;
 | 
			
		||||
/* Holder of all SBc-AP conn related information: */
 | 
			
		||||
struct cbc_sbcap_mgr {
 | 
			
		||||
	/* libosmo-netif stream server */
 | 
			
		||||
	struct osmo_stream_srv_link *link;
 | 
			
		||||
	struct osmo_stream_srv_link *srv_link;
 | 
			
		||||
 | 
			
		||||
	/* MMEs / clients connected to this CBC */
 | 
			
		||||
	struct llist_head clients;
 | 
			
		||||
	/* MMEs / links connected to this CBC */
 | 
			
		||||
	struct llist_head links;
 | 
			
		||||
 | 
			
		||||
	/* receive call-back; called for every received message */
 | 
			
		||||
	int (*rx_cb)(struct cbc_sbcap_link *link, SBcAP_SBC_AP_PDU_t *pdu);
 | 
			
		||||
@@ -30,7 +30,7 @@ struct cbc_sbcap_mgr *cbc_sbcap_mgr_create(void *ctx);
 | 
			
		||||
 | 
			
		||||
/* an SBc-AP link with a single (remote) peer connected to us */
 | 
			
		||||
struct cbc_sbcap_link {
 | 
			
		||||
	/* entry in osmo_sbcap_cbc.clients */
 | 
			
		||||
	/* entry in osmo_sbcap_cbc.links */
 | 
			
		||||
	struct llist_head list;
 | 
			
		||||
	/* stream server connection for this link */
 | 
			
		||||
	struct osmo_stream_srv *conn;
 | 
			
		||||
 
 | 
			
		||||
@@ -138,7 +138,7 @@ static int cbsp_cbc_accept_cb(struct osmo_stream_srv_link *srv_link, int fd)
 | 
			
		||||
		talloc_free(link);
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
	llist_add_tail(&link->list, &cbc->clients);
 | 
			
		||||
	llist_add_tail(&link->list, &cbc->links);
 | 
			
		||||
 | 
			
		||||
	/* Match link to peer */
 | 
			
		||||
	link->peer = cbc_peer_by_addr_proto(remote_ip, remote_port, CBC_PEER_PROTO_CBSP);
 | 
			
		||||
@@ -210,22 +210,22 @@ struct cbc_cbsp_mgr *cbc_cbsp_mgr_create(void *ctx)
 | 
			
		||||
 | 
			
		||||
	OSMO_ASSERT(cbc);
 | 
			
		||||
	cbc->rx_cb = cbc_cbsp_link_rx_cb;
 | 
			
		||||
	INIT_LLIST_HEAD(&cbc->clients);
 | 
			
		||||
	cbc->link = osmo_stream_srv_link_create(cbc);
 | 
			
		||||
	osmo_stream_srv_link_set_data(cbc->link, cbc);
 | 
			
		||||
	osmo_stream_srv_link_set_nodelay(cbc->link, true);
 | 
			
		||||
	osmo_stream_srv_link_set_port(cbc->link, bind_port);
 | 
			
		||||
	INIT_LLIST_HEAD(&cbc->links);
 | 
			
		||||
	cbc->srv_link = osmo_stream_srv_link_create(cbc);
 | 
			
		||||
	osmo_stream_srv_link_set_data(cbc->srv_link, cbc);
 | 
			
		||||
	osmo_stream_srv_link_set_nodelay(cbc->srv_link, true);
 | 
			
		||||
	osmo_stream_srv_link_set_port(cbc->srv_link, bind_port);
 | 
			
		||||
	if (bind_ip)
 | 
			
		||||
		osmo_stream_srv_link_set_addr(cbc->link, bind_ip);
 | 
			
		||||
	osmo_stream_srv_link_set_accept_cb(cbc->link, cbsp_cbc_accept_cb);
 | 
			
		||||
	rc = osmo_stream_srv_link_open(cbc->link);
 | 
			
		||||
		osmo_stream_srv_link_set_addr(cbc->srv_link, bind_ip);
 | 
			
		||||
	osmo_stream_srv_link_set_accept_cb(cbc->srv_link, cbsp_cbc_accept_cb);
 | 
			
		||||
	rc = osmo_stream_srv_link_open(cbc->srv_link);
 | 
			
		||||
	if (rc < 0) {
 | 
			
		||||
		osmo_stream_srv_link_destroy(cbc->link);
 | 
			
		||||
		osmo_stream_srv_link_destroy(cbc->srv_link);
 | 
			
		||||
		talloc_free(cbc);
 | 
			
		||||
		return NULL;
 | 
			
		||||
	}
 | 
			
		||||
	LOGP(DCBSP, LOGL_NOTICE, "Listening for CBSP at %s\n",
 | 
			
		||||
		osmo_stream_srv_link_get_sockname(cbc->link));
 | 
			
		||||
		osmo_stream_srv_link_get_sockname(cbc->srv_link));
 | 
			
		||||
 | 
			
		||||
	return cbc;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -166,7 +166,7 @@ static int sbcap_cbc_accept_cb(struct osmo_stream_srv_link *srv_link, int fd)
 | 
			
		||||
		talloc_free(link);
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
	llist_add_tail(&link->list, &cbc->clients);
 | 
			
		||||
	llist_add_tail(&link->list, &cbc->links);
 | 
			
		||||
 | 
			
		||||
	/* Match link to peer */
 | 
			
		||||
	link->peer = cbc_peer_by_addr_proto(remote_ip, remote_port, CBC_PEER_PROTO_SBcAP);
 | 
			
		||||
@@ -238,19 +238,19 @@ struct cbc_sbcap_mgr *cbc_sbcap_mgr_create(void *ctx)
 | 
			
		||||
 | 
			
		||||
	OSMO_ASSERT(cbc);
 | 
			
		||||
	cbc->rx_cb = cbc_sbcap_link_rx_cb;
 | 
			
		||||
	INIT_LLIST_HEAD(&cbc->clients);
 | 
			
		||||
	cbc->link = osmo_stream_srv_link_create(cbc);
 | 
			
		||||
	osmo_stream_srv_link_set_proto(cbc->link, IPPROTO_SCTP);
 | 
			
		||||
	osmo_stream_srv_link_set_data(cbc->link, cbc);
 | 
			
		||||
	osmo_stream_srv_link_set_nodelay(cbc->link, true);
 | 
			
		||||
	osmo_stream_srv_link_set_port(cbc->link, bind_port);
 | 
			
		||||
	osmo_stream_srv_link_set_addrs(cbc->link, (const char **)g_cbc->config.sbcap.local_host,
 | 
			
		||||
	INIT_LLIST_HEAD(&cbc->links);
 | 
			
		||||
	cbc->srv_link = osmo_stream_srv_link_create(cbc);
 | 
			
		||||
	osmo_stream_srv_link_set_proto(cbc->srv_link, IPPROTO_SCTP);
 | 
			
		||||
	osmo_stream_srv_link_set_data(cbc->srv_link, cbc);
 | 
			
		||||
	osmo_stream_srv_link_set_nodelay(cbc->srv_link, true);
 | 
			
		||||
	osmo_stream_srv_link_set_port(cbc->srv_link, bind_port);
 | 
			
		||||
	osmo_stream_srv_link_set_addrs(cbc->srv_link, (const char **)g_cbc->config.sbcap.local_host,
 | 
			
		||||
				       g_cbc->config.sbcap.num_local_host);
 | 
			
		||||
	osmo_stream_srv_link_set_accept_cb(cbc->link, sbcap_cbc_accept_cb);
 | 
			
		||||
	rc = osmo_stream_srv_link_open(cbc->link);
 | 
			
		||||
	osmo_stream_srv_link_set_accept_cb(cbc->srv_link, sbcap_cbc_accept_cb);
 | 
			
		||||
	rc = osmo_stream_srv_link_open(cbc->srv_link);
 | 
			
		||||
	OSMO_ASSERT(rc == 0);
 | 
			
		||||
	LOGP(DSBcAP, LOGL_NOTICE, "Listening for SBc-AP at %s\n",
 | 
			
		||||
		osmo_stream_srv_link_get_sockname(cbc->link));
 | 
			
		||||
		osmo_stream_srv_link_get_sockname(cbc->srv_link));
 | 
			
		||||
 | 
			
		||||
	return cbc;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user