Add User-level metrics
[sim/e2-interface.git] / e2sim / e2apv1sim / ricsim.cpp
index 28f87d4..d91c9e5 100644 (file)
@@ -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;