encode actual hostname in RSPRO
The RSPRO ComponentIdentity includes a 'name' for each remsim component. So far we always used "fixme-name" instead of something meaningful. Let's use the hostname of the system instead. Change-Id: I14925f16ae242dae89fa853a2fe31c5c1b32981d
This commit is contained in:
parent
e9e505c7c5
commit
eea631bff0
|
@ -59,6 +59,7 @@ static void handle_sig_mapadd(int sig);
|
||||||
__thread void *talloc_asn1_ctx;
|
__thread void *talloc_asn1_ctx;
|
||||||
struct bankd *g_bankd;
|
struct bankd *g_bankd;
|
||||||
static void *g_tall_ctx;
|
static void *g_tall_ctx;
|
||||||
|
static char g_hostname[256];
|
||||||
|
|
||||||
static void *worker_main(void *arg);
|
static void *worker_main(void *arg);
|
||||||
|
|
||||||
|
@ -91,7 +92,7 @@ static void bankd_init(struct bankd *bankd)
|
||||||
bankd->srvc.bankd.num_slots = 8;
|
bankd->srvc.bankd.num_slots = 8;
|
||||||
|
|
||||||
bankd->comp_id.type = ComponentType_remsimBankd;
|
bankd->comp_id.type = ComponentType_remsimBankd;
|
||||||
OSMO_STRLCPY_ARRAY(bankd->comp_id.name, "fixme-name");
|
OSMO_STRLCPY_ARRAY(bankd->comp_id.name, g_hostname);
|
||||||
OSMO_STRLCPY_ARRAY(bankd->comp_id.software, "remsim-bankd");
|
OSMO_STRLCPY_ARRAY(bankd->comp_id.software, "remsim-bankd");
|
||||||
OSMO_STRLCPY_ARRAY(bankd->comp_id.sw_version, PACKAGE_VERSION);
|
OSMO_STRLCPY_ARRAY(bankd->comp_id.sw_version, PACKAGE_VERSION);
|
||||||
/* FIXME: other members of app_comp_id */
|
/* FIXME: other members of app_comp_id */
|
||||||
|
@ -363,6 +364,9 @@ int main(int argc, char **argv)
|
||||||
g_bankd = talloc_zero(NULL, struct bankd);
|
g_bankd = talloc_zero(NULL, struct bankd);
|
||||||
OSMO_ASSERT(g_bankd);
|
OSMO_ASSERT(g_bankd);
|
||||||
|
|
||||||
|
if (gethostname(g_hostname, sizeof(g_hostname)) < 0)
|
||||||
|
OSMO_STRLCPY_ARRAY(g_hostname, "unknown");
|
||||||
|
|
||||||
bankd_init(g_bankd);
|
bankd_init(g_bankd);
|
||||||
|
|
||||||
srvc = &g_bankd->srvc;
|
srvc = &g_bankd->srvc;
|
||||||
|
@ -370,7 +374,7 @@ int main(int argc, char **argv)
|
||||||
srvc->server_port = 9998;
|
srvc->server_port = 9998;
|
||||||
srvc->handle_rx = bankd_srvc_handle_rx;
|
srvc->handle_rx = bankd_srvc_handle_rx;
|
||||||
srvc->own_comp_id.type = ComponentType_remsimBankd;
|
srvc->own_comp_id.type = ComponentType_remsimBankd;
|
||||||
OSMO_STRLCPY_ARRAY(srvc->own_comp_id.name, "fixme-name");
|
OSMO_STRLCPY_ARRAY(srvc->own_comp_id.name, g_hostname);
|
||||||
OSMO_STRLCPY_ARRAY(srvc->own_comp_id.software, "remsim-bankd");
|
OSMO_STRLCPY_ARRAY(srvc->own_comp_id.software, "remsim-bankd");
|
||||||
OSMO_STRLCPY_ARRAY(srvc->own_comp_id.sw_version, PACKAGE_VERSION);
|
OSMO_STRLCPY_ARRAY(srvc->own_comp_id.sw_version, PACKAGE_VERSION);
|
||||||
|
|
||||||
|
|
|
@ -125,7 +125,6 @@ struct client_thread {
|
||||||
|
|
||||||
/* configuration of client thread; passed in from IFD thread */
|
/* configuration of client thread; passed in from IFD thread */
|
||||||
struct client_thread_cfg {
|
struct client_thread_cfg {
|
||||||
const char *name;
|
|
||||||
const char *server_host;
|
const char *server_host;
|
||||||
int server_port;
|
int server_port;
|
||||||
int client_id;
|
int client_id;
|
||||||
|
@ -367,8 +366,12 @@ static void *client_pthread_main(void *arg)
|
||||||
struct client_thread_cfg *cfg = arg;
|
struct client_thread_cfg *cfg = arg;
|
||||||
struct client_config *ccfg;
|
struct client_config *ccfg;
|
||||||
struct client_thread *ct;
|
struct client_thread *ct;
|
||||||
|
char hostname[256];
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
if (gethostname(hostname, sizeof(hostname)) < 0)
|
||||||
|
OSMO_STRLCPY_ARRAY(hostname, "unknown");
|
||||||
|
|
||||||
osmo_select_init();
|
osmo_select_init();
|
||||||
rc = osmo_ctx_init("client");
|
rc = osmo_ctx_init("client");
|
||||||
OSMO_ASSERT(rc == 0);
|
OSMO_ASSERT(rc == 0);
|
||||||
|
@ -387,7 +390,7 @@ static void *client_pthread_main(void *arg)
|
||||||
if (!talloc_asn1_ctx)
|
if (!talloc_asn1_ctx)
|
||||||
talloc_asn1_ctx= talloc_named_const(ct, 0, "asn1");
|
talloc_asn1_ctx= talloc_named_const(ct, 0, "asn1");
|
||||||
|
|
||||||
ct->bc = remsim_client_create(ct, cfg->name, "remsim_ifdhandler", ccfg);
|
ct->bc = remsim_client_create(ct, hostname, "remsim_ifdhandler", ccfg);
|
||||||
OSMO_ASSERT(ct->bc);
|
OSMO_ASSERT(ct->bc);
|
||||||
ct->bc->data = ct;
|
ct->bc->data = ct;
|
||||||
|
|
||||||
|
@ -560,7 +563,6 @@ RESPONSECODE IFDHCreateChannelByName(DWORD Lun, LPSTR DeviceName)
|
||||||
{
|
{
|
||||||
struct ifd_client *ic;
|
struct ifd_client *ic;
|
||||||
struct client_thread_cfg cfg = {
|
struct client_thread_cfg cfg = {
|
||||||
.name = "fixme-name",
|
|
||||||
.server_host = "127.0.0.1",
|
.server_host = "127.0.0.1",
|
||||||
.server_port = -1,
|
.server_port = -1,
|
||||||
.client_id = 0,
|
.client_id = 0,
|
||||||
|
|
|
@ -80,9 +80,13 @@ static void handle_options(int argc, char **argv)
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
char hostname[256];
|
||||||
void *talloc_rest_ctx;
|
void *talloc_rest_ctx;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
if (gethostname(hostname, sizeof(hostname)) < 0)
|
||||||
|
OSMO_STRLCPY_ARRAY(hostname, "unknown");
|
||||||
|
|
||||||
g_tall_ctx = talloc_named_const(NULL, 0, "global");
|
g_tall_ctx = talloc_named_const(NULL, 0, "global");
|
||||||
talloc_asn1_ctx = talloc_named_const(g_tall_ctx, 0, "asn1");
|
talloc_asn1_ctx = talloc_named_const(g_tall_ctx, 0, "asn1");
|
||||||
talloc_rest_ctx = talloc_named_const(g_tall_ctx, 0, "rest");
|
talloc_rest_ctx = talloc_named_const(g_tall_ctx, 0, "rest");
|
||||||
|
@ -106,7 +110,7 @@ int main(int argc, char **argv)
|
||||||
goto out_rspro;
|
goto out_rspro;
|
||||||
|
|
||||||
g_rps->comp_id.type = ComponentType_remsimServer;
|
g_rps->comp_id.type = ComponentType_remsimServer;
|
||||||
OSMO_STRLCPY_ARRAY(g_rps->comp_id.name, "fixme-name");
|
OSMO_STRLCPY_ARRAY(g_rps->comp_id.name, hostname);
|
||||||
OSMO_STRLCPY_ARRAY(g_rps->comp_id.software, "remsim-server");
|
OSMO_STRLCPY_ARRAY(g_rps->comp_id.software, "remsim-server");
|
||||||
OSMO_STRLCPY_ARRAY(g_rps->comp_id.sw_version, PACKAGE_VERSION);
|
OSMO_STRLCPY_ARRAY(g_rps->comp_id.sw_version, PACKAGE_VERSION);
|
||||||
/* FIXME: other members of app_comp_id */
|
/* FIXME: other members of app_comp_id */
|
||||||
|
|
Loading…
Reference in New Issue