summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@gnumonks.org>2013-08-02 21:14:14 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-08-27 12:21:43 +0200
commit326b5d80b38727b1f7b840d00c90ac135d0d638c (patch)
tree985796d0b9b2e88c77814469f62b9c079f726f3d
parentd81fec021ee11c3d818044b4494317e6ed81cfb7 (diff)
libmgcp: add enum mgcp_role
This enum indicates if the mgcp is running on the BSC or the BSC-NAT.
-rw-r--r--openbsc/include/openbsc/mgcp.h10
-rw-r--r--openbsc/src/libmgcp/mgcp_vty.c4
-rw-r--r--openbsc/src/osmo-bsc_mgcp/mgcp_main.c2
-rw-r--r--openbsc/src/osmo-bsc_nat/bsc_nat.c2
4 files changed, 14 insertions, 4 deletions
diff --git a/openbsc/include/openbsc/mgcp.h b/openbsc/include/openbsc/mgcp.h
index 811dcfd..4e22e0f 100644
--- a/openbsc/include/openbsc/mgcp.h
+++ b/openbsc/include/openbsc/mgcp.h
@@ -125,6 +125,11 @@ struct mgcp_trunk_config {
struct mgcp_endpoint *endpoints;
};
+enum mgcp_role {
+ MGCP_BSC = 0,
+ MGCP_BSC_NAT,
+};
+
struct mgcp_config {
int source_port;
char *local_ip;
@@ -162,11 +167,14 @@ struct mgcp_config {
/* only used for start with a static configuration */
int last_net_port;
int last_bts_port;
+
+ enum mgcp_role role;
};
/* config management */
struct mgcp_config *mgcp_config_alloc(void);
-int mgcp_parse_config(const char *config_file, struct mgcp_config *cfg);
+int mgcp_parse_config(const char *config_file, struct mgcp_config *cfg,
+ enum mgcp_role role);
int mgcp_vty_init(void);
int mgcp_endpoints_allocate(struct mgcp_trunk_config *cfg);
void mgcp_free_endp(struct mgcp_endpoint *endp);
diff --git a/openbsc/src/libmgcp/mgcp_vty.c b/openbsc/src/libmgcp/mgcp_vty.c
index 69984ee..833908a 100644
--- a/openbsc/src/libmgcp/mgcp_vty.c
+++ b/openbsc/src/libmgcp/mgcp_vty.c
@@ -898,7 +898,8 @@ static int allocate_trunk(struct mgcp_trunk_config *trunk)
return 0;
}
-int mgcp_parse_config(const char *config_file, struct mgcp_config *cfg)
+int mgcp_parse_config(const char *config_file, struct mgcp_config *cfg,
+ enum mgcp_role role)
{
int rc;
struct mgcp_trunk_config *trunk;
@@ -935,6 +936,7 @@ int mgcp_parse_config(const char *config_file, struct mgcp_config *cfg)
return -1;
}
}
+ cfg->role = role;
return 0;
}
diff --git a/openbsc/src/osmo-bsc_mgcp/mgcp_main.c b/openbsc/src/osmo-bsc_mgcp/mgcp_main.c
index 540f760..596ea8a 100644
--- a/openbsc/src/osmo-bsc_mgcp/mgcp_main.c
+++ b/openbsc/src/osmo-bsc_mgcp/mgcp_main.c
@@ -223,7 +223,7 @@ int main(int argc, char **argv)
handle_options(argc, argv);
- rc = mgcp_parse_config(config_file, cfg);
+ rc = mgcp_parse_config(config_file, cfg, MGCP_BSC);
if (rc < 0)
return rc;
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat.c b/openbsc/src/osmo-bsc_nat/bsc_nat.c
index 897c657..1eac983 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat.c
@@ -1515,7 +1515,7 @@ int main(int argc, char **argv)
/* init vty and parse */
telnet_init(tall_bsc_ctx, NULL, 4244);
- if (mgcp_parse_config(config_file, nat->mgcp_cfg) < 0) {
+ if (mgcp_parse_config(config_file, nat->mgcp_cfg, MGCP_BSC_NAT) < 0) {
fprintf(stderr, "Failed to parse the config file: '%s'\n", config_file);
return -3;
}