i want to parse some information from pcap file to my project. I'm creating analizer that can find errors in sip calls. I created the class that can hold such information (not all of them for now). I use Windows and Codeblocks c++ and have installed the pcap library for windows. What is the easiest way to achieve this ?
class Messege
{
private:
int number;
string cseq;
string method;
string callId;
string source;
string destination;
string request;
public:
//set
void setCseq (string newCseq){cseq=newCseq;};
void setNumber (int newNumber){number=newNumber;};
void setMethod (string newMethod){method=newMethod;};
void setSource (string newSource){source=newSource;};
void setDestination (string newDestination){destination = newDestination;};
void setCallId (string newCallId){callId = newCallId;};
void setRequest (string newRequest){request = newRequest;};
//get
int getNumber (){return number;};
string getCseq (){return cseq;};
string getMethod (){return method;};
string getSource (){return source;};
string getDestination () {return destination;};
string getCallId (){return callId;};
string getRequest (){return request;};
};
Your might want to check out libpcap. You can parse a pcap file with:
where pcap_handler is your call back function:
Find details here.