mirror of
				https://gitea.osmocom.org/cellular-infrastructure/osmo-cbc.git
				synced 2025-11-03 21:53:37 +00:00 
			
		
		
		
	Move cbc_cell_id2str() and make it public
It will be used later on to log whenever new cell ids are added to a message_peer. Change-Id: I74ccbbc810a2fa76fb2999a7588b3f67d4d21e03
This commit is contained in:
		@@ -39,6 +39,8 @@ struct cbc_cell_id {
 | 
				
			|||||||
	} num_compl;
 | 
						} num_compl;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const char *cbc_cell_id2str(const struct cbc_cell_id *cid);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*********************************************************************************
 | 
					/*********************************************************************************
 | 
				
			||||||
 * CBC itself
 | 
					 * CBC itself
 | 
				
			||||||
 *********************************************************************************/
 | 
					 *********************************************************************************/
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -35,6 +35,39 @@
 | 
				
			|||||||
#include <osmocom/cbc/rest_it_op.h>
 | 
					#include <osmocom/cbc/rest_it_op.h>
 | 
				
			||||||
#include <osmocom/cbc/debug.h>
 | 
					#include <osmocom/cbc/debug.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const char *cbc_cell_id2str(const struct cbc_cell_id *cid)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						static char buf[256];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						switch (cid->id_discr) {
 | 
				
			||||||
 | 
						case CBC_CELL_ID_NONE:
 | 
				
			||||||
 | 
							snprintf(buf, sizeof(buf), "NONE");
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						case CBC_CELL_ID_BSS:
 | 
				
			||||||
 | 
							snprintf(buf, sizeof(buf), "BSS");
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						case CBC_CELL_ID_CGI:
 | 
				
			||||||
 | 
							snprintf(buf, sizeof(buf), "CGI %s", osmo_cgi_name(&cid->u.cgi));
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						case CBC_CELL_ID_LAC_CI:
 | 
				
			||||||
 | 
							snprintf(buf, sizeof(buf), "LAC %u CI %u", cid->u.lac_and_ci.lac, cid->u.lac_and_ci.ci);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						case CBC_CELL_ID_LAI:
 | 
				
			||||||
 | 
							snprintf(buf, sizeof(buf), "LAI %s", osmo_lai_name(&cid->u.lai));
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						case CBC_CELL_ID_LAC:
 | 
				
			||||||
 | 
							snprintf(buf, sizeof(buf), "LAC %u", cid->u.lac);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						case CBC_CELL_ID_CI:
 | 
				
			||||||
 | 
							snprintf(buf, sizeof(buf), "CI %u", cid->u.ci);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						default:
 | 
				
			||||||
 | 
							snprintf(buf, sizeof(buf), "<invalid>");
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return buf;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct cbc *cbc_alloc(void *ctx)
 | 
					struct cbc *cbc_alloc(void *ctx)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct cbc *cbc;
 | 
						struct cbc *cbc;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -174,39 +174,6 @@ DEFUN(delete_message_expired, delete_message_expired_cmd,
 | 
				
			|||||||
	return CMD_SUCCESS;
 | 
						return CMD_SUCCESS;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const char *cbc_cell_id2str(const struct cbc_cell_id *cid)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	static char buf[256];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	switch (cid->id_discr) {
 | 
					 | 
				
			||||||
	case CBC_CELL_ID_NONE:
 | 
					 | 
				
			||||||
		snprintf(buf, sizeof(buf), "NONE");
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case CBC_CELL_ID_BSS:
 | 
					 | 
				
			||||||
		snprintf(buf, sizeof(buf), "BSS");
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case CBC_CELL_ID_CGI:
 | 
					 | 
				
			||||||
		snprintf(buf, sizeof(buf), "CGI %s", osmo_cgi_name(&cid->u.cgi));
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case CBC_CELL_ID_LAC_CI:
 | 
					 | 
				
			||||||
		snprintf(buf, sizeof(buf), "LAC %u CI %u", cid->u.lac_and_ci.lac, cid->u.lac_and_ci.ci);
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case CBC_CELL_ID_LAI:
 | 
					 | 
				
			||||||
		snprintf(buf, sizeof(buf), "LAI %s", osmo_lai_name(&cid->u.lai));
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case CBC_CELL_ID_LAC:
 | 
					 | 
				
			||||||
		snprintf(buf, sizeof(buf), "LAC %u", cid->u.lac);
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case CBC_CELL_ID_CI:
 | 
					 | 
				
			||||||
		snprintf(buf, sizeof(buf), "CI %u", cid->u.ci);
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	default:
 | 
					 | 
				
			||||||
		snprintf(buf, sizeof(buf), "<invalid>");
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	return buf;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void dump_one_msg_peer(struct vty *vty, const struct cbc_message_peer *msg_peer, const char *pfx)
 | 
					static void dump_one_msg_peer(struct vty *vty, const struct cbc_message_peer *msg_peer, const char *pfx)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct cbc_cell_id *cid;
 | 
						struct cbc_cell_id *cid;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user