aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-08-08 07:27:23 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-08-08 07:27:23 +0800
commitc7bd29e6d7eb038ba6c1189de633dedfbcd56cc1 (patch)
treea2220775504c2a769b5a9c2e5aa798e4dd0f7cd0
parent137523ef7cfc35210f830d7200f5a32da7d570d5 (diff)
mgcp: Make the CI uint32_t all the way to avoid mismatch
Conflicts: openbsc/include/openbsc/mgcp.h openbsc/src/nat/bsc_mgcp_utils.c
-rw-r--r--openbsc/include/openbsc/bsc_nat.h2
-rw-r--r--openbsc/include/openbsc/mgcp.h5
-rw-r--r--openbsc/include/openbsc/mgcp_internal.h2
-rw-r--r--openbsc/src/mgcp/mgcp_protocol.c14
4 files changed, 12 insertions, 11 deletions
diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h
index cb0f76188..7d4ce47bd 100644
--- a/openbsc/include/openbsc/bsc_nat.h
+++ b/openbsc/include/openbsc/bsc_nat.h
@@ -322,7 +322,7 @@ void bsc_mgcp_forward(struct bsc_connection *bsc, struct msgb *msg);
void bsc_mgcp_clear_endpoints_for(struct bsc_connection *bsc);
int bsc_mgcp_parse_response(const char *str, int *code, char transaction[60]);
-int bsc_mgcp_extract_ci(const char *resp);
+uint32_t bsc_mgcp_extract_ci(const char *resp);
int bsc_write(struct bsc_connection *bsc, struct msgb *msg, int id);
diff --git a/openbsc/include/openbsc/mgcp.h b/openbsc/include/openbsc/mgcp.h
index 912df2cb5..1a83bd501 100644
--- a/openbsc/include/openbsc/mgcp.h
+++ b/openbsc/include/openbsc/mgcp.h
@@ -115,9 +115,6 @@ struct mgcp_config {
struct mgcp_port_range net_ports;
int endp_dscp;
- /* only used in forward mode */
- unsigned int last_call_id;
-
/* endpoint configuration */
unsigned int number_endpoints;
struct mgcp_endpoint *endpoints;
@@ -130,6 +127,8 @@ struct mgcp_config {
mgcp_policy policy_cb;
mgcp_reset reset_cb;
void *data;
+
+ uint32_t last_call_id;
};
/* config management */
diff --git a/openbsc/include/openbsc/mgcp_internal.h b/openbsc/include/openbsc/mgcp_internal.h
index 19e8e3f2b..d7be0a244 100644
--- a/openbsc/include/openbsc/mgcp_internal.h
+++ b/openbsc/include/openbsc/mgcp_internal.h
@@ -85,7 +85,7 @@ struct mgcp_rtp_tap {
};
struct mgcp_endpoint {
- int ci;
+ uint32_t ci;
char *callid;
char *local_options;
int conn_mode;
diff --git a/openbsc/src/mgcp/mgcp_protocol.c b/openbsc/src/mgcp/mgcp_protocol.c
index f5eef5671..b7b955cb9 100644
--- a/openbsc/src/mgcp/mgcp_protocol.c
+++ b/openbsc/src/mgcp/mgcp_protocol.c
@@ -89,7 +89,7 @@ static struct msgb *handle_delete_con(struct mgcp_config *cfg, struct msgb *msg)
static struct msgb *handle_modify_con(struct mgcp_config *cfg, struct msgb *msg);
static struct msgb *handle_rsip(struct mgcp_config *cfg, struct msgb *msg);
-static int generate_call_id(struct mgcp_config *cfg)
+static uint32_t generate_call_id(struct mgcp_config *cfg)
{
int i;
@@ -170,7 +170,7 @@ static struct msgb *create_response_with_sdp(struct mgcp_endpoint *endp,
addr = endp->cfg->source_addr;
snprintf(sdp_record, sizeof(sdp_record) - 1,
- "I: %d\n\n"
+ "I: %u\n\n"
"v=0\r\n"
"c=IN IP4 %s\r\n"
"m=audio %d RTP/AVP %d\r\n"
@@ -324,11 +324,13 @@ static int verify_call_id(const struct mgcp_endpoint *endp,
}
static int verify_ci(const struct mgcp_endpoint *endp,
- const char *ci)
+ const char *_ci)
{
- if (atoi(ci) != endp->ci) {
- LOGP(DMGCP, LOGL_ERROR, "ConnectionIdentifiers do not match on 0x%x. %d != %s\n",
- ENDPOINT_NUMBER(endp), endp->ci, ci);
+ uint32_t ci = strtoul(_ci, NULL, 10);
+
+ if (ci != endp->ci) {
+ LOGP(DMGCP, LOGL_ERROR, "ConnectionIdentifiers do not match on 0x%x. %u != %s\n",
+ ENDPOINT_NUMBER(endp), endp->ci, _ci);
return -1;
}