X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?p=sim%2Fe2-interface.git;a=blobdiff_plain;f=e2sim%2Fe2apv1sim%2Fricsim.cpp;h=d91c9e57d60cd3653db0bd06814ead476b29faeb;hp=28f87d49b4c09284c76d51a9f7653b25698be0b6;hb=b57063d875ff4f1f554c2f00122f2a4c21824b6f;hpb=5c3fd8f88224475176792cfeb82d533cc81c2586 diff --git a/e2sim/e2apv1sim/ricsim.cpp b/e2sim/e2apv1sim/ricsim.cpp index 28f87d4..d91c9e5 100644 --- a/e2sim/e2apv1sim/ricsim.cpp +++ b/e2sim/e2apv1sim/ricsim.cpp @@ -62,6 +62,8 @@ struct { } */ +int client_fd = 0; + void encode_and_send_sctp_data(E2AP_PDU_t* pdu, int client_fd) { uint8_t *buf; @@ -73,6 +75,18 @@ void encode_and_send_sctp_data(E2AP_PDU_t* pdu, int client_fd) sctp_send_data(client_fd, data); } + +void encode_and_send_sctp_data(E2AP_PDU_t* pdu) +{ + uint8_t *buf; + sctp_buffer_t data; + + data.len = e2ap_asn1c_encode_pdu(pdu, &buf); + memcpy(data.buffer, buf, min(data.len, MAX_SCTP_BUFFER)); + + sctp_send_data(client_fd, data); +} + void wait_for_sctp_data(int client_fd) { sctp_buffer_t recv_buf; @@ -93,7 +107,7 @@ int main(int argc, char* argv[]){ options_t ops = read_input_options(argc, argv); int server_fd = sctp_start_server(ops.server_ip, ops.server_port); - int client_fd = sctp_accept_connection(ops.server_ip, server_fd); + client_fd = sctp_accept_connection(ops.server_ip, server_fd); sctp_buffer_t recv_buf;