aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/include/openbsc
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-04-04 18:09:10 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-04-04 18:09:10 +0200
commitbbfff6ec39d6499404f1b603da2ee9091b3c899c (patch)
treecd23692a531b790a52f261eb1a1060cb135d7f5f /openbsc/include/openbsc
parentdc0914df098f754ec8f6af5fddccce5521f6332a (diff)
nat: Make rewrite work on string, read to a string first, copy to msgb
The MGCP protocol parsing is adding '\0' to make sure we do not parse beyond where we should parse. This does not mix with strtok or similiar routines. For now we will read the msg into a global array first, then copy it to the msgb for mgcp protocol handling and if we are required to forward it to the MGCP we have a untouched copy we will modify into our own msgb.
Diffstat (limited to 'openbsc/include/openbsc')
-rw-r--r--openbsc/include/openbsc/bsc_nat.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h
index cb85ce0e4..6ec666a17 100644
--- a/openbsc/include/openbsc/bsc_nat.h
+++ b/openbsc/include/openbsc/bsc_nat.h
@@ -153,7 +153,8 @@ struct bsc_nat {
/* MGCP config */
struct mgcp_config *mgcp_cfg;
struct write_queue mgcp_queue;
- struct msgb *mgcp_msg;
+ u_int8_t mgcp_msg[4096];
+ int mgcp_length;
struct bsc_endpoint *bsc_endpoints;
};
@@ -199,7 +200,7 @@ void bsc_mgcp_free_endpoints(struct bsc_nat *nat);
int bsc_mgcp_init(struct bsc_nat *nat);
struct bsc_connection *bsc_mgcp_find_con(struct bsc_nat *, int endpoint_number);
-struct msgb *bsc_mgcp_rewrite(struct msgb *msg, const char *ip, int port);
+struct msgb *bsc_mgcp_rewrite(char *input, int length, const char *ip, int port);
void bsc_mgcp_forward(struct bsc_connection *bsc, struct msgb *msg);
int bsc_mgcp_parse_response(const char *str, int *code, char transaction[60]);