remove tuple.h from include/stellar
This commit is contained in:
@@ -7,7 +7,7 @@ extern "C"
|
||||
#endif
|
||||
|
||||
#include "log.h"
|
||||
#include "stellar/tuple.h"
|
||||
#include "tuple.h"
|
||||
|
||||
#define EVICTED_SESSION_FILTER_LOG_ERROR(format, ...) LOG_ERROR("evicted session filter", format, ##__VA_ARGS__)
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ extern "C"
|
||||
#include <stdio.h>
|
||||
|
||||
#include "log.h"
|
||||
#include "stellar/tuple.h"
|
||||
#include "tuple.h"
|
||||
#include "stellar/packet.h"
|
||||
|
||||
#define PACKET_MAX_LAYERS 32
|
||||
@@ -60,6 +60,24 @@ void packet_print_str(const struct packet *pkt);
|
||||
// direction 0: I2E
|
||||
uint64_t packet_get_hash(const struct packet *pkt, enum ldbc_method method, int direction);
|
||||
|
||||
// return 0: found
|
||||
// return -1: not found
|
||||
int packet_get_innermost_tuple2(const struct packet *pkt, struct tuple2 *tuple);
|
||||
int packet_get_outermost_tuple2(const struct packet *pkt, struct tuple2 *tuple);
|
||||
|
||||
// return 0: found
|
||||
// return -1: not found
|
||||
int packet_get_innermost_tuple4(const struct packet *pkt, struct tuple4 *tuple);
|
||||
int packet_get_outermost_tuple4(const struct packet *pkt, struct tuple4 *tuple);
|
||||
|
||||
// return 0: found
|
||||
// return -1: not found
|
||||
int packet_get_innermost_tuple6(const struct packet *pkt, struct tuple6 *tuple);
|
||||
int packet_get_outermost_tuple6(const struct packet *pkt, struct tuple6 *tuple);
|
||||
|
||||
const struct packet_layer *packet_get_innermost_layer(const struct packet *pkt, enum layer_type type);
|
||||
const struct packet_layer *packet_get_outermost_layer(const struct packet *pkt, enum layer_type type);
|
||||
|
||||
/******************************************************************************
|
||||
* Utils
|
||||
******************************************************************************/
|
||||
|
||||
@@ -10,7 +10,7 @@ extern "C"
|
||||
#include "packet_priv.h"
|
||||
#include "timeout.h"
|
||||
#include "uthash.h"
|
||||
#include "stellar/tuple.h"
|
||||
#include "tuple.h"
|
||||
#include "stellar/session.h"
|
||||
#include "tcp_reassembly.h"
|
||||
#include "session_manager.h"
|
||||
@@ -84,7 +84,10 @@ void session_init(struct session *sess);
|
||||
void session_set_id(struct session *sess, uint64_t id);
|
||||
|
||||
void session_set_tuple(struct session *sess, const struct tuple6 *key);
|
||||
const struct tuple6 *session_get_tuple6(const struct session *sess);
|
||||
|
||||
void session_set_tuple_direction(struct session *sess, enum flow_direction dir);
|
||||
enum flow_direction session_get_tuple6_direction(const struct session *sess);
|
||||
|
||||
void session_set_direction(struct session *sess, enum session_direction dir);
|
||||
void session_set_current_flow_direction(struct session *sess, enum flow_direction dir);
|
||||
|
||||
@@ -1,13 +1,5 @@
|
||||
LIBSTELLAR_DEVEL {
|
||||
global:
|
||||
packet_get_innermost_tuple2;
|
||||
packet_get_outermost_tuple2;
|
||||
packet_get_innermost_tuple4;
|
||||
packet_get_outermost_tuple4;
|
||||
packet_get_innermost_tuple6;
|
||||
packet_get_outermost_tuple6;
|
||||
packet_get_innermost_layer;
|
||||
packet_get_outermost_layer;
|
||||
packet_get_direction;
|
||||
packet_get_session_id;
|
||||
packet_prepend_sid_list;
|
||||
@@ -19,6 +11,12 @@ global:
|
||||
packet_get_payload_len;
|
||||
packet_set_action;
|
||||
packet_get_action;
|
||||
packet_get_addr;
|
||||
packet_get_port;
|
||||
packet_get_ip_hdr;
|
||||
packet_get_ip6_hdr;
|
||||
packet_get_tcp_hdr;
|
||||
packet_get_udp_hdr;
|
||||
|
||||
session_exdata_free;
|
||||
stellar_session_exdata_new_index;
|
||||
@@ -44,8 +42,6 @@ global:
|
||||
session_get_direction;
|
||||
session_get_current_flow_direction;
|
||||
session_get_first_packet;
|
||||
session_get_tuple6;
|
||||
session_get_tuple6_direction;
|
||||
session_get_id;
|
||||
session_get_timestamp;
|
||||
session_get_stat;
|
||||
@@ -64,22 +60,5 @@ global:
|
||||
stellar_inject_ctrl_msg;
|
||||
stellar_main;
|
||||
|
||||
tuple2_hash;
|
||||
tuple4_hash;
|
||||
tuple5_hash;
|
||||
tuple6_hash;
|
||||
tuple2_cmp;
|
||||
tuple4_cmp;
|
||||
tuple5_cmp;
|
||||
tuple6_cmp;
|
||||
tuple2_reverse;
|
||||
tuple4_reverse;
|
||||
tuple5_reverse;
|
||||
tuple6_reverse;
|
||||
tuple2_to_str;
|
||||
tuple4_to_str;
|
||||
tuple5_to_str;
|
||||
tuple6_to_str;
|
||||
|
||||
local: *;
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "stellar/tuple.h"
|
||||
#include "tuple.h"
|
||||
|
||||
TEST(TUPLE, TUPLE2)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "stellar/tuple.h"
|
||||
#include "tuple.h"
|
||||
#include "crc32_hash.h"
|
||||
|
||||
uint32_t tuple2_hash(const struct tuple2 *tuple)
|
||||
|
||||
89
src/tuple/tuple.h
Normal file
89
src/tuple/tuple.h
Normal file
@@ -0,0 +1,89 @@
|
||||
#ifndef _TUPLE_H
|
||||
#define _TUPLE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <arpa/inet.h>
|
||||
|
||||
enum ip_type
|
||||
{
|
||||
IP_TYPE_V4,
|
||||
IP_TYPE_V6,
|
||||
};
|
||||
|
||||
union ip_address
|
||||
{
|
||||
struct in_addr v4; /* network order */
|
||||
struct in6_addr v6; /* network order */
|
||||
};
|
||||
|
||||
struct tuple2
|
||||
{
|
||||
enum ip_type ip_type;
|
||||
union ip_address src_addr; /* network order */
|
||||
union ip_address dst_addr; /* network order */
|
||||
};
|
||||
|
||||
struct tuple4
|
||||
{
|
||||
enum ip_type ip_type;
|
||||
union ip_address src_addr; /* network order */
|
||||
union ip_address dst_addr; /* network order */
|
||||
|
||||
in_port_t src_port; /* network order */
|
||||
in_port_t dst_port; /* network order */
|
||||
};
|
||||
|
||||
struct tuple5
|
||||
{
|
||||
enum ip_type ip_type;
|
||||
union ip_address src_addr; /* network order */
|
||||
union ip_address dst_addr; /* network order */
|
||||
|
||||
in_port_t src_port; /* network order */
|
||||
in_port_t dst_port; /* network order */
|
||||
|
||||
uint16_t ip_proto; /* network order */
|
||||
};
|
||||
|
||||
struct tuple6
|
||||
{
|
||||
enum ip_type ip_type;
|
||||
union ip_address src_addr; /* network order */
|
||||
union ip_address dst_addr; /* network order */
|
||||
|
||||
uint16_t src_port; /* network order */
|
||||
uint16_t dst_port; /* network order */
|
||||
|
||||
uint16_t ip_proto; /* network order */
|
||||
uint64_t domain;
|
||||
};
|
||||
|
||||
uint32_t tuple2_hash(const struct tuple2 *tuple);
|
||||
uint32_t tuple4_hash(const struct tuple4 *tuple);
|
||||
uint32_t tuple5_hash(const struct tuple5 *tuple);
|
||||
uint32_t tuple6_hash(const struct tuple6 *tuple);
|
||||
|
||||
int tuple2_cmp(const struct tuple2 *tuple_a, const struct tuple2 *tuple_b);
|
||||
int tuple4_cmp(const struct tuple4 *tuple_a, const struct tuple4 *tuple_b);
|
||||
int tuple5_cmp(const struct tuple5 *tuple_a, const struct tuple5 *tuple_b);
|
||||
int tuple6_cmp(const struct tuple6 *tuple_a, const struct tuple6 *tuple_b);
|
||||
|
||||
void tuple2_reverse(const struct tuple2 *in, struct tuple2 *out);
|
||||
void tuple4_reverse(const struct tuple4 *in, struct tuple4 *out);
|
||||
void tuple5_reverse(const struct tuple5 *in, struct tuple5 *out);
|
||||
void tuple6_reverse(const struct tuple6 *in, struct tuple6 *out);
|
||||
|
||||
void tuple2_to_str(const struct tuple2 *tuple, char *buf, uint32_t size);
|
||||
void tuple4_to_str(const struct tuple4 *tuple, char *buf, uint32_t size);
|
||||
void tuple5_to_str(const struct tuple5 *tuple, char *buf, uint32_t size);
|
||||
void tuple6_to_str(const struct tuple6 *tuple, char *buf, uint32_t size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user