Files
firegex-traffic-viewer/backend/binsrc/proxytun/stream_ctx.cpp

38 lines
738 B
C++
Raw Normal View History

2025-02-14 01:04:29 +01:00
#ifndef STREAM_CTX_CPP
#define STREAM_CTX_CPP
#include <iostream>
#include <tins/tcp_ip/stream_identifier.h>
using namespace std;
typedef Tins::TCPIP::StreamIdentifier stream_id;
struct pyfilter_ctx {
void * pyglob; // TODO python glob???
string pycode;
};
typedef map<stream_id, pyfilter_ctx*> matching_map;
2025-02-14 01:04:29 +01:00
struct stream_ctx {
matching_map streams_ctx;
2025-02-14 01:04:29 +01:00
void clean_stream_by_id(stream_id sid){
auto stream_search = streams_ctx.find(sid);
if (stream_search != streams_ctx.end()){
auto stream_match = stream_search->second;
//DEALLOC PY GLOB TODO
delete stream_match;
2025-02-14 01:04:29 +01:00
}
}
void clean(){
for (auto ele: streams_ctx){
//TODO dealloc ele.second.pyglob
delete ele.second;
2025-02-14 01:04:29 +01:00
}
}
};
#endif // STREAM_CTX_CPP