Ask Your Question

# Revision history [back]

### writing a modular dissector plugin

Hello

After having spent a few hours in prototyping my custom protocol dissector with LUA, I decided to switch to C implementation as we already have a code base in C/C++ parsing the frames.

I have now a basic dissector written in C. (on Win10 x64 / VS2015 / 2.9.0rc of WS)

I wanted to split my packet-foo.c file into several .h/.c/(*.cpp) files. (I didn't write any C code for a long time, but I think I may not be too far). I get something like that:

#include "config.h"
#include <epan/packet.h>
#include "fooheader.h"   //doesn't find how to preprocess that file just sitting in the same folder!

static int proto_foo = -1;

static int
dissect_foo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
//...
extractHeader();
//...
}


I tried different things in the CMakeList.txt, but didn't find out how to remedy. What did I miss?

I had already extracted some code in that fooheader.cpp/fooheader.h file for the header extraction. Including "fooheader.h" from fooheader.c doesn't seem to be a problem. Why is it the case from the base file (packet-foo.c)?

Thanks

Christophe

### writing a modular dissector plugin

Hello

After having spent a few hours in prototyping my custom protocol dissector with LUA, I decided to switch to C implementation as we already have a code base in C/C++ parsing the frames.

I have now a basic dissector written in C. (on Win10 x64 / VS2015 / 2.9.0rc of WS)

I wanted to split my packet-foo.c file into several .h/.c/(*.cpp) files. (I didn't write any C code for a long time, but I think I may not be too far). I get something like that:

#include "config.h"
#include <epan/packet.h>
#include "fooheader.h"   //doesn't find how to preprocess that file just sitting in the same folder!
//HERE IS MY PROBLEM
//I'm getting the following:
//Error C1083   Cannot open include file: 'sopheader.h': No such file or directory

static int proto_foo = -1;

static int
dissect_foo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
//...
extractHeader();
//...
}


I tried different things in the CMakeList.txt, but didn't find out how to remedy. What did I miss?

I had already extracted some code in that fooheader.cpp/fooheader.h file for the header extraction. Including "fooheader.h" from fooheader.c doesn't seem to be a problem. Why is it the case from the base file (packet-foo.c)?

Thanks

Christophe

### writing a modular dissector plugin

Hello

After having spent a few hours in prototyping my custom protocol dissector with LUA, I decided to switch to C implementation as we already have a code base in C/C++ parsing the frames.

I have now a basic dissector written in C. (on Win10 x64 / VS2015 / 2.9.0rc of WS)

I wanted to split my packet-foo.c file into several .h/.c/(*.cpp) files. (I didn't write any C code for a long time, but I think I may not be too far). I get something like that:

#include "config.h"
#include <epan/packet.h>
#include "fooheader.h"   //HERE IS MY PROBLEM
//I'm getting the following:
//Error C1083   Cannot open include file: 'sopheader.h': 'fooheader.h': No such file or directory

static int proto_foo = -1;

static int
dissect_foo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
//...
extractHeader();
//...
}


I tried different things in the CMakeList.txt, but didn't find out how to remedy. What did I miss?

I had already extracted some code in that fooheader.cpp/fooheader.h file for the header extraction. Including "fooheader.h" from fooheader.c doesn't seem to be a problem. Why is it the case from the base file (packet-foo.c)?

Thanks

Christophe