2016-12-21 13 views
-1

私はpcapファイルの情報をプロジェクトに解析したいと思っています。 私はサイレントコールでエラーを見つけることができるアナライザーを作成しています。私はそのような情報を保持できるクラスを作成しました(今はそれらのすべてではありません)。私はWindowsとCodeblocks C++を使用し、Windows用のpcapライブラリをインストールしました。 これを達成する最も簡単な方法は何ですか?pcapファイルを解析してC++でメッセージを表示する

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;}; 
    }; 
+1

私は「広すぎる」と締めくくった。あるいは、ツールの推奨事項を尋ねているかもしれません。 *あなたはpcapファイルの解析方法を決める必要があります。 –

答えて

0

あなたはlibpcapをチェックしたいかもしれません。 pcap_handlerがあなたのコールバック関数である

pcap_t *pcap = pcap_open_offline(pcap_filename, errbuf); 
int link_layer_type = pcap_datalink(pcap); 
pcap_loop(pcap, -1, pcap_handler, NULL); 
pcap_close(pcap); 

typedef void (*pcap_handler)(u_char *user, const struct pcap_pkthdr *h, const u_char *bytes); 

詳細hereを探すあなたはとのpcapファイルを解析することができます。

関連する問題