fix compile error

This commit is contained in:
luwenpeng
2024-08-28 19:00:32 +08:00
parent 3e6b837318
commit 283d591e6b
24 changed files with 159 additions and 113 deletions

View File

@@ -1,7 +1,5 @@
#include "checksum.h"
#include <arpa/inet.h>
uint16_t checksum(const void *data, int len)
{
uint16_t *ptr = (uint16_t *)data;

View File

@@ -6,6 +6,7 @@ extern "C"
#endif
#include <stdint.h>
#include <arpa/inet.h>
uint16_t checksum(const void *data, int len);
uint16_t checksum_v4(const void *l4_hdr_ptr, uint16_t l4_total_len, uint8_t l4_proto, struct in_addr *src_addr, struct in_addr *dst_addr);

View File

@@ -5,6 +5,8 @@ extern "C"
{
#endif
struct packet;
// return 0: success
// return -1: failed
int packet_dump_pcap(const struct packet *pkt, const char *file);

View File

@@ -5,6 +5,8 @@ extern "C"
{
#endif
struct packet;
// Duplicated Packet Filter for IPv4 Packet
struct packet_filter;
struct packet_filter *packet_filter_new(uint32_t capacity, uint32_t timeout, double error_rate, uint64_t now);

View File

@@ -8,6 +8,7 @@ extern "C"
#include "utils.h"
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <arpa/inet.h>
#include <linux/if_ether.h>
#include <netinet/ip.h>

View File

@@ -9,7 +9,7 @@
#include "packet_private.h"
#include "packet_parser.h"
#define PACKET_PARSE_LOG_DEBUG(format, ...) void(0) // STELLAR_LOG_DEBUG(__thread_local_logger, "packet parse", format, ##__VA_ARGS__)
#define PACKET_PARSE_LOG_DEBUG(format, ...) // STELLAR_LOG_DEBUG(__thread_local_logger, "packet parse", format, ##__VA_ARGS__)
#define PACKET_PARSE_LOG_ERROR(format, ...) STELLAR_LOG_ERROR(__thread_local_logger, "packet parse", format, ##__VA_ARGS__)
#define PACKET_PARSE_LOG_WARN(format, ...) STELLAR_LOG_WARN(__thread_local_logger, "packet parse", format, ##__VA_ARGS__)
@@ -214,6 +214,7 @@ static inline const char *parse_ppp(struct packet *pkt, const char *data, uint16
uint16_t hdr_len = 0;
uint16_t next_proto = 0;
struct layer_private *layer = NULL;
// ppp header 1 byte
next_proto = *((uint8_t *)data);
@@ -236,7 +237,7 @@ static inline const char *parse_ppp(struct packet *pkt, const char *data, uint16
hdr_len = 4;
success:
struct layer_private *layer = get_free_layer(pkt);
layer = get_free_layer(pkt);
if (unlikely(layer == NULL))
{
return data;

View File

@@ -5,6 +5,7 @@ extern "C"
{
#endif
#include "tuple.h"
#include "stellar/packet.h"
#define PACKET_MAX_LAYERS 32