add socks_decoder, stratum_decoder and session_flags
This commit is contained in:
167
test/decoders/session_flags/dummy.c
Normal file
167
test/decoders/session_flags/dummy.c
Normal file
@@ -0,0 +1,167 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "dummy.h"
|
||||
|
||||
#define UNUSED(x) (void)(x)
|
||||
|
||||
struct session g_sess;
|
||||
|
||||
void session_set_current_payload(struct session *sess, char *payload, int payload_len)
|
||||
{
|
||||
UNUSED(sess);
|
||||
g_sess.payload_len = payload_len;
|
||||
g_sess.payload = payload;
|
||||
}
|
||||
|
||||
int session_exdata_set(struct session *sess, int idx, void *ex_ptr)
|
||||
{
|
||||
UNUSED(sess);
|
||||
UNUSED(idx);
|
||||
UNUSED(ex_ptr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct logger *stellar_get_logger(struct stellar *st)
|
||||
{
|
||||
UNUSED(st);
|
||||
|
||||
return (struct logger *)1;
|
||||
}
|
||||
|
||||
void *session_exdata_get(struct session *sess, int idx)
|
||||
{
|
||||
UNUSED(sess);
|
||||
UNUSED(idx);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const struct packet *session_get0_current_packet(const struct session *sess)
|
||||
{
|
||||
UNUSED(sess);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
uint16_t packet_get_payload_len(const struct packet *pkt)
|
||||
{
|
||||
UNUSED(pkt);
|
||||
|
||||
return g_sess.payload_len;
|
||||
}
|
||||
|
||||
const char *packet_get_payload(const struct packet *pkt)
|
||||
{
|
||||
UNUSED(pkt);
|
||||
|
||||
return g_sess.payload;
|
||||
}
|
||||
|
||||
enum session_direction session_get_direction(const struct session *sess)
|
||||
{
|
||||
UNUSED(sess);
|
||||
|
||||
return SESSION_DIRECTION_OUTBOUND;
|
||||
}
|
||||
|
||||
enum flow_type session_get_flow_type(const struct session *sess)
|
||||
{
|
||||
UNUSED(sess);
|
||||
|
||||
return FLOW_TYPE_C2S;
|
||||
}
|
||||
|
||||
const char *session_get0_readable_addr(const struct session *sess)
|
||||
{
|
||||
UNUSED(sess);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
uint16_t packet_get_raw_len(const struct packet *pkt)
|
||||
{
|
||||
UNUSED(pkt);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const struct timeval *packet_get_timeval(const struct packet *pkt)
|
||||
{
|
||||
UNUSED(pkt);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void stellar_session_plugin_dettach_current_session(struct session *sess)
|
||||
{
|
||||
UNUSED(sess);
|
||||
}
|
||||
|
||||
int session_mq_publish_message(struct session *sess, int topic_id, void *msg)
|
||||
{
|
||||
UNUSED(sess);
|
||||
UNUSED(topic_id);
|
||||
UNUSED(msg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int stellar_exdata_new_index(struct stellar *st, const char *name, stellar_exdata_free *free_func,void *arg)
|
||||
{
|
||||
UNUSED(st);
|
||||
UNUSED(name);
|
||||
UNUSED(free_func);
|
||||
UNUSED(arg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int stellar_mq_create_topic(struct stellar *st, const char *topic_name, stellar_msg_free_cb_func *msg_free_cb, void *msg_free_arg)
|
||||
{
|
||||
UNUSED(st);
|
||||
UNUSED(topic_name);
|
||||
UNUSED(msg_free_cb);
|
||||
UNUSED(msg_free_arg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int stellar_mq_get_topic_id(struct stellar *st, const char *topic_name)
|
||||
{
|
||||
UNUSED(st);
|
||||
|
||||
if (strcmp(topic_name, TOPIC_TCP_INPUT) == 0)
|
||||
{
|
||||
return DUMMY_TCP_TOPIC_ID;
|
||||
}
|
||||
else if (strcmp(topic_name, TOPIC_UDP_INPUT) == 0)
|
||||
{
|
||||
return DUMMY_UDP_TOPIC_ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
int stellar_session_mq_subscribe(struct stellar *st, int topic_id, on_session_msg_cb_func *plugin_on_msg_cb, int plugin_id)
|
||||
{
|
||||
UNUSED(st);
|
||||
UNUSED(topic_id);
|
||||
UNUSED(plugin_on_msg_cb);
|
||||
UNUSED(plugin_id);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int stellar_session_plugin_register(struct stellar *st, session_ctx_new_func session_ctx_new, session_ctx_free_func session_ctx_free, void *plugin_env)
|
||||
{
|
||||
UNUSED(st);
|
||||
UNUSED(session_ctx_new);
|
||||
UNUSED(session_ctx_free);
|
||||
UNUSED(plugin_env);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user