116 lines
1.7 KiB
C
116 lines
1.7 KiB
C
|
|
#pragma once
|
||
|
|
|
||
|
|
#ifdef __cplusplus
|
||
|
|
extern "C"
|
||
|
|
{
|
||
|
|
#endif
|
||
|
|
|
||
|
|
#include "../plugin_manager_interna.h"
|
||
|
|
|
||
|
|
#include "stellar/session.h"
|
||
|
|
#include "tuple/tuple.h"
|
||
|
|
|
||
|
|
//mock stellar
|
||
|
|
struct stellar
|
||
|
|
{
|
||
|
|
struct plugin_manager_schema *plug_mgr;
|
||
|
|
};
|
||
|
|
|
||
|
|
enum packet_type
|
||
|
|
{
|
||
|
|
UNKNOWN,
|
||
|
|
IPv4,
|
||
|
|
IPv6,
|
||
|
|
UDP,
|
||
|
|
TCP,
|
||
|
|
TCP_STREAM,
|
||
|
|
CONTROL,
|
||
|
|
};
|
||
|
|
|
||
|
|
struct packet
|
||
|
|
{
|
||
|
|
struct stellar *st;
|
||
|
|
enum packet_type type;
|
||
|
|
unsigned char ip_proto;
|
||
|
|
};
|
||
|
|
|
||
|
|
|
||
|
|
struct session
|
||
|
|
{
|
||
|
|
struct plugin_manager_runtime *plug_mgr_rt;
|
||
|
|
enum session_type type;
|
||
|
|
enum session_state state;
|
||
|
|
int sess_pkt_cnt;
|
||
|
|
};
|
||
|
|
|
||
|
|
struct plugin_manager_schema * stellar_get_plugin_manager(struct stellar *st)
|
||
|
|
{
|
||
|
|
return st->plug_mgr;
|
||
|
|
}
|
||
|
|
|
||
|
|
int stellar_set_plugin_manger(struct stellar *st, struct plugin_manager_schema *pm)
|
||
|
|
{
|
||
|
|
st->plug_mgr=pm;
|
||
|
|
return 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
int stellar_get_worker_thread_num(struct stellar *st)
|
||
|
|
{
|
||
|
|
return 16;
|
||
|
|
}
|
||
|
|
|
||
|
|
uint16_t stellar_get_current_thread_index()
|
||
|
|
{
|
||
|
|
return 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
unsigned char packet_get_ip_protocol(struct packet *pkt)
|
||
|
|
{
|
||
|
|
return pkt->ip_proto;
|
||
|
|
}
|
||
|
|
|
||
|
|
enum session_type session_get_type(const struct session *sess)
|
||
|
|
{
|
||
|
|
return sess->type;
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
void session_set_user_data(struct session *sess, void *user_data)
|
||
|
|
{
|
||
|
|
sess->plug_mgr_rt = (struct plugin_manager_runtime *)user_data;
|
||
|
|
}
|
||
|
|
|
||
|
|
void *session_get_user_data(const struct session *sess)
|
||
|
|
{
|
||
|
|
return sess->plug_mgr_rt;
|
||
|
|
}
|
||
|
|
|
||
|
|
void *packet_get_user_data(const struct packet *pkt)
|
||
|
|
{
|
||
|
|
return pkt->st->plug_mgr;
|
||
|
|
}
|
||
|
|
|
||
|
|
int packet_get_innermost_tuple6(const struct packet *pkt, struct tuple6 *tuple)
|
||
|
|
{
|
||
|
|
tuple->ip_proto = pkt->ip_proto;
|
||
|
|
return 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
uint8_t packet_is_ctrl(const struct packet *pkt)
|
||
|
|
{
|
||
|
|
return 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
struct tcp_segment *session_get_tcp_segment(struct session *sess)
|
||
|
|
{
|
||
|
|
return NULL;
|
||
|
|
}
|
||
|
|
|
||
|
|
void session_free_tcp_segment(struct session *sess, struct tcp_segment *seg)
|
||
|
|
{
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
#ifdef __cplusplus
|
||
|
|
}
|
||
|
|
#endif
|