summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author杨威 <[email protected]>2023-04-07 20:31:43 +0800
committer杨威 <[email protected]>2023-04-07 20:31:43 +0800
commit2492af994b5932aa7fa3048a52cb0db8f0ce0d2a (patch)
tree326e56e768f322436d9ec619fa32bb974e872f8c
parent1d2719f907e1e48b6f5b60ed9117dc026e03b163 (diff)
🦄 refactor(packet io marsio): fix clang warning
-rw-r--r--include/private/sapp_private_api.h4
-rw-r--r--include/private/stream_internal.h1
-rw-r--r--src/packet_io/packet_io_marsio.c23
3 files changed, 16 insertions, 12 deletions
diff --git a/include/private/sapp_private_api.h b/include/private/sapp_private_api.h
index e33164b..f23980f 100644
--- a/include/private/sapp_private_api.h
+++ b/include/private/sapp_private_api.h
@@ -33,8 +33,8 @@
#include "private/duplicate_pkt_distinguish.h"
#if IOMODE_MARSIO
-#include "/opt/mrzcpd/include/marsio.h"
-#include "/opt/mrzcpd/include/mrtunnat.h"
+#include "marsio.h"
+#include "mrtunnat.h"
#endif
#endif
diff --git a/include/private/stream_internal.h b/include/private/stream_internal.h
index 4acf232..b074713 100644
--- a/include/private/stream_internal.h
+++ b/include/private/stream_internal.h
@@ -1,6 +1,7 @@
#ifndef _APP_STREAM_INTERNAL_H_
#define _APP_STREAM_INTERNAL_H_
+#include "mesa_net.h"
#include "public/stream.h"
#include "private/mesa_net.h"
#include "private/sysinfo.h"
diff --git a/src/packet_io/packet_io_marsio.c b/src/packet_io/packet_io_marsio.c
index 1eee02a..e76b85c 100644
--- a/src/packet_io/packet_io_marsio.c
+++ b/src/packet_io/packet_io_marsio.c
@@ -7,6 +7,8 @@ extern "C" {
#include "sapp_declaration.h"
#include <assert.h>
+#include "marsio.h"
+#include "mrtunnat.h"
/*
netconnection_mode:
1: ���������ղ���
@@ -241,12 +243,12 @@ int marsio_dl_io_set_capture_filter(const char *filter_rule)
int i,j;
int pcap_link_type = DLT_EN10MB;
- for (i = 0; i < (unsigned int)g_packet_io_thread_num; i++)
+ for (i = 0; i < g_packet_io_thread_num; i++)
{
if (pcap_compile_nopcap(65535, pcap_link_type, &MARSIO_BPF_FILTER[i], filter_rule, 100, 0) < 0)
{
printf("Compile pcap filter '%s' error\n", filter_rule);
- for(j = 0; j < (unsigned int )g_packet_io_thread_num; j++)
+ for(j = 0; j < g_packet_io_thread_num; j++)
{
pcap_freecode(&MARSIO_BPF_FILTER[j]);
}
@@ -305,7 +307,7 @@ void marsio_dl_io_free_sendbuf(void *phandle, int thread_seq)
}
/* 2020-10-30 lijia add, in/forward/inject����tcpdump_mesa, ����debug. */
-static void marsio_pkt_dump(int thread_seq, const marsio_buff_t *send_mbuf, enum _pkt_classify class)
+static void marsio_pkt_dump(int thread_seq, const marsio_buff_t *send_mbuf, enum _pkt_classify classify)
{
raw_pkt_t to_tcpdump_mesa;
@@ -316,7 +318,7 @@ static void marsio_pkt_dump(int thread_seq, const marsio_buff_t *send_mbuf, enum
to_tcpdump_mesa.low_layer_type = ADDR_TYPE_MAC;
to_tcpdump_mesa.raw_pkt_data = ptr_marsio_buff_mtod((marsio_buff_t *)send_mbuf);
to_tcpdump_mesa.raw_pkt_len = ptr_marsio_buff_buflen((marsio_buff_t *)send_mbuf);
- cycle_pkt_dump_by_classify(thread_seq, &to_tcpdump_mesa, class);
+ cycle_pkt_dump_by_classify(thread_seq, &to_tcpdump_mesa, classify);
}
@@ -394,7 +396,8 @@ int marsio_dl_io_raw_pkt_send(void *phandle, unsigned char *data,int datalen, vo
}
}
- ptr_marsio_buff_ctrlzone_set(send_mbuf[0], 0, &mr_ctrlzone, sizeof(struct mr_tunnat_ctrlzone));
+ ptr_marsio_buff_ctrlzone_set(send_mbuf[0], 0, &mr_ctrlzone, sizeof(struct mr_tunnat_ctrlzone));
+
ret = ptr_marsio_send_burst_with_options((struct mr_sendpath *)arg, thread_seq, send_mbuf, 1, send_option);
if(ret < 0){
@@ -408,7 +411,7 @@ int marsio_dl_io_low_level_send(void *phandle, UINT8 *data,int datalen,
int eth_carry_layer_addr_type, int dir,int thread_num,const raw_pkt_t *raw_pkt)
{
int ret;
- struct mesa_ethernet_hdr *ehdr = (struct mesa_ethernet_hdr *)data;
+ //struct mesa_ethernet_hdr *ehdr = (struct mesa_ethernet_hdr *)data;
//��˫����͸��ģʽ(transparent)��, ����dirѡ��up or down device����.
if(NET_CONN_SERIAL_2CARD == g_marsio4_topology_mode){
assert((dir >= 0) && (dir <= 1));
@@ -447,9 +450,9 @@ int marsio_dl_io_forward_rawpkt(const raw_pkt_t *raw_pkt, int thread_seq)
int ret = 0;
if(raw_pkt->io_lib_pkt_reference != NULL)
{
- marsio_update_trace_id(raw_pkt, (void *)raw_pkt->io_lib_pkt_reference);
- marsio_update_sid_list(raw_pkt, (void *)raw_pkt->io_lib_pkt_reference);
- ret = marsio4_pkt_forward(thread_seq, g_mr4_sendpath_up_set[raw_pkt->device_index], (marsio_buff_t *)raw_pkt->io_lib_pkt_reference);
+ marsio_update_trace_id(raw_pkt, (void *)(raw_pkt->io_lib_pkt_reference));
+ marsio_update_sid_list(raw_pkt, (void *)(raw_pkt->io_lib_pkt_reference));
+ ret = marsio4_pkt_forward(thread_seq, g_mr4_sendpath_up_set[raw_pkt->device_index], (marsio_buff_t *)(raw_pkt->io_lib_pkt_reference));
}
return ret;
}
@@ -1271,7 +1274,7 @@ int marsio_set_vlan_id_to_mbuff(void *pkt_reference, unsigned int vlan_id_host_o
int marsio_dl_io_init(int argc, char *argv[])
{
int i, ret;
- char app_name[32];
+ //char app_name[32];
int max_send_queue_num;
if(marsio_dl_get_function_entry() < 0){