erlang
/
osmo-map-masq
Archived
4
0
Fork 0

sccp_node: Use defines for the atoms and use different names for cmd/res

This commit is contained in:
Holger Hans Peter Freyther 2010-08-03 03:16:55 +08:00
parent 6f9b5139f3
commit 9addf6e44f
1 changed files with 12 additions and 4 deletions

View File

@ -16,6 +16,14 @@
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define UDT_SPLIT_CMD "udt_split_cmd"
#define UDT_SPLIT_RES "udt_split_res"
#define UDT_SPLIT_ERR "udt_split_err"
#define UDT_WRAP_CMD "udt_wrap_cmd"
#define UDT_WRAP_RES "udt_wrap_res"
#define UDT_WRAP_ERR "udt_wrap_err"
struct osmo_erl_addr {
uint8_t sccp_ssn;
int use_poi;
@ -109,7 +117,7 @@ send_empty:
hdr = erl_mk_binary(&null, 0);
data = erl_mk_binary(&null, 0);
resp = erl_format("{split_udt, {~w, ~w}}", hdr, data);
resp = erl_format("{~a, {~w, ~w}}", UDT_SPLIT_RES, hdr, data);
erl_send(fd, fromp, resp);
erl_free_term(resp);
erl_free_term(hdr);
@ -154,7 +162,7 @@ static int wrap_udt(int fd, ETERM *fromp, ETERM *argp)
}
data = erl_mk_binary((const char * )msg->l2h, msgb_l2len(msg));
resp = erl_format("{wrap_udt, ~w}", data);
resp = erl_format("{~a, ~w}", UDT_WRAP_RES, data);
erl_send(fd, fromp, resp);
free_data:
@ -231,9 +239,9 @@ static int handle_command(int fd) {
argp = erl_element(2, tuplep);
if (ERL_IS_ATOM(fnp)) {
if (strcmp(ERL_ATOM_PTR(fnp), "split_udt") == 0) {
if (strcmp(ERL_ATOM_PTR(fnp), UDT_SPLIT_CMD) == 0) {
split_udt(fd, fromp, argp);
} else if (strcmp(ERL_ATOM_PTR(fnp), "wrap_udt") == 0) {
} else if (strcmp(ERL_ATOM_PTR(fnp), UDT_WRAP_CMD) == 0) {
wrap_udt(fd, fromp, argp);
} else {
printf("unknown command '%s'\n", ERL_ATOM_PTR(fnp));