sccp_node: Use defines for the atoms and use different names for cmd/res
This commit is contained in:
parent
6f9b5139f3
commit
9addf6e44f
|
@ -16,6 +16,14 @@
|
||||||
|
|
||||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
#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 {
|
struct osmo_erl_addr {
|
||||||
uint8_t sccp_ssn;
|
uint8_t sccp_ssn;
|
||||||
int use_poi;
|
int use_poi;
|
||||||
|
@ -109,7 +117,7 @@ send_empty:
|
||||||
hdr = erl_mk_binary(&null, 0);
|
hdr = erl_mk_binary(&null, 0);
|
||||||
data = 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_send(fd, fromp, resp);
|
||||||
erl_free_term(resp);
|
erl_free_term(resp);
|
||||||
erl_free_term(hdr);
|
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));
|
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);
|
erl_send(fd, fromp, resp);
|
||||||
|
|
||||||
free_data:
|
free_data:
|
||||||
|
@ -231,9 +239,9 @@ static int handle_command(int fd) {
|
||||||
argp = erl_element(2, tuplep);
|
argp = erl_element(2, tuplep);
|
||||||
|
|
||||||
if (ERL_IS_ATOM(fnp)) {
|
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);
|
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);
|
wrap_udt(fd, fromp, argp);
|
||||||
} else {
|
} else {
|
||||||
printf("unknown command '%s'\n", ERL_ATOM_PTR(fnp));
|
printf("unknown command '%s'\n", ERL_ATOM_PTR(fnp));
|
||||||
|
|
Reference in New Issue