将kni合并到tfe中
This commit is contained in:
@@ -10,6 +10,18 @@
|
||||
#include <dirent.h> //scan_dir
|
||||
#include <stdbool.h>
|
||||
|
||||
#define LOG_TAG_POLICY "POLICY"
|
||||
#define LOG_TAG_UTILS "UTILS"
|
||||
#define LOG_TAG_RAWPKT "RAW_PACKET"
|
||||
#define LOG_TAG_CTRLPKT "CTRL_PACKET"
|
||||
#define LOG_TAG_STABLE "SESSION_TABLE"
|
||||
#define LOG_TAG_PKTIO "PACKET_IO"
|
||||
#define LOG_TAG_METRICS "G_METRICS"
|
||||
#define LOG_TAG_SF_METRICS "SF_METRICS"
|
||||
#define LOG_TAG_SF_STATUS "SF_STATUS"
|
||||
#define LOG_TAG_SCE "SCE"
|
||||
#define LOG_TAG_TIMESTAMP "TIMESTAMP"
|
||||
|
||||
#define TFE_STRING_MAX 2048
|
||||
#define TFE_PATH_MAX 256
|
||||
#define TFE_SYMBOL_MAX 64
|
||||
@@ -170,4 +182,59 @@ int tfe_scandir(const char *dir, struct dirent ***namelist,
|
||||
char *tfe_read_file(const char *filename, size_t *filelen);
|
||||
|
||||
const char * tfe_version();
|
||||
int tfe_decode_base64url(u_char *dst, u_char *src);
|
||||
int tfe_decode_base64url(u_char *dst, u_char *src);
|
||||
|
||||
/******************************************************************************
|
||||
* sids
|
||||
******************************************************************************/
|
||||
|
||||
#include <marsio.h>
|
||||
|
||||
struct sids
|
||||
{
|
||||
int num;
|
||||
sid_t elems[MR_SID_LIST_MAXLEN];
|
||||
};
|
||||
|
||||
void sids_write_once(struct sids *dst, struct sids *src);
|
||||
void sids_copy(struct sids *dst, struct sids *src);
|
||||
|
||||
/******************************************************************************
|
||||
* route_ctx
|
||||
******************************************************************************/
|
||||
|
||||
struct route_ctx
|
||||
{
|
||||
char data[64];
|
||||
int len;
|
||||
};
|
||||
|
||||
int route_ctx_is_empty(struct route_ctx *ctx);
|
||||
void route_ctx_copy(struct route_ctx *dst, struct route_ctx *src);
|
||||
|
||||
/******************************************************************************
|
||||
* protocol
|
||||
******************************************************************************/
|
||||
|
||||
struct udp_hdr
|
||||
{
|
||||
u_int16_t uh_sport; /* source port */
|
||||
u_int16_t uh_dport; /* destination port */
|
||||
u_int16_t uh_ulen; /* udp length */
|
||||
u_int16_t uh_sum; /* udp checksum */
|
||||
} __attribute__((__packed__));
|
||||
|
||||
void build_udp_header(const char *l3_hdr, int l3_hdr_len, struct udp_hdr *udp_hdr, u_int16_t udp_sport, u_int16_t udp_dport, int payload_len);
|
||||
void build_ip_header(struct ip *ip_hdr, u_int8_t next_protocol, const char *src_addr, const char *dst_addr, uint16_t payload_len);
|
||||
void build_ether_header(struct ethhdr *eth_hdr, uint16_t next_protocol, const char *src_mac, const char *dst_mac);
|
||||
|
||||
int str_to_mac(const char *str, char *mac_buff);
|
||||
int get_mac_by_device_name(const char *dev_name, char *mac_buff);
|
||||
|
||||
struct throughput_metrics
|
||||
{
|
||||
uint64_t n_pkts;
|
||||
uint64_t n_bytes;
|
||||
};
|
||||
|
||||
void throughput_metrics_inc(struct throughput_metrics *iterm, uint64_t n_pkts, uint64_t n_bytes);
|
||||
|
||||
Reference in New Issue
Block a user