Skip to content

Commit

Permalink
fixed a problem with extern C methods
Browse files Browse the repository at this point in the history
  • Loading branch information
joeferner committed Jan 25, 2012
1 parent 900f2c3 commit 48aad43
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 31 deletions.
3 changes: 1 addition & 2 deletions examples/package.json
Expand Up @@ -4,7 +4,6 @@
"private": true,
"dependencies": {
"optimist": "~0.3.1",
"pcap-parser": "~0.0.3",
"nodeshark": "~0.0.1"
"pcap-parser": "~0.0.3"
}
}
2 changes: 1 addition & 1 deletion examples/print.js
@@ -1,7 +1,7 @@
#!/usr/bin/env node

var optimist = require('optimist');
var nodeshark = require("nodeshark");
var nodeshark = require("../");
var pcapp = require("pcap-parser");

var argv = optimist
Expand Down
26 changes: 14 additions & 12 deletions src/dissector.h
Expand Up @@ -11,18 +11,20 @@
#include <ctype.h>
#include <locale.h>
#include <limits.h>
#include <config.h>
#include <epan/epan.h>
#include <wsutil/privileges.h>
#include <epan/epan_dissect.h>
#include <epan/to_str.h>
#include <epan/timestamp.h>
#include <epan/prefs.h>
#include <epan/column.h>
#include <epan/packet.h>
#include <epan/plugins.h>
#include <cfile.h>
#include <log.h>
extern "C" {
#include <config.h>
#include <epan/epan.h>
#include <wsutil/privileges.h>
#include <epan/epan_dissect.h>
#include <epan/to_str.h>
#include <epan/timestamp.h>
#include <epan/prefs.h>
#include <epan/column.h>
#include <epan/packet.h>
#include <epan/plugins.h>
#include <cfile.h>
#include <log.h>
}
#include <glib.h>
#include <string>

Expand Down
12 changes: 7 additions & 5 deletions src/dissectorNode.h
Expand Up @@ -4,19 +4,21 @@

#include <v8.h>
#include <node.h>
#include <config.h>
#include <epan/epan.h>
extern "C" {
#include <config.h>
#include <epan/epan.h>
}

class DissectorNode : node::ObjectWrap {
public:
static void Init(v8::Handle<v8::Object> target);
static v8::Local<v8::Object> New(DissectorNode *root, frame_data *fdata, epan_dissect_t *edt, proto_node *node);
bool isRoot() { return this == m_root; }

private:
DissectorNode(DissectorNode *root, frame_data *fdata, epan_dissect_t *edt, proto_node *node);
~DissectorNode();

static void NotImplementedSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
static v8::Handle<v8::Value> AbbreviationGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
static int getPositionInPacket(proto_node *node, field_info *fi);
Expand All @@ -36,7 +38,7 @@ class DissectorNode : node::ObjectWrap {
static void rawDataSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
v8::Handle<v8::Value> getAbbreviation(proto_node *node);
static v8::Handle<v8::Value> getRepresentation(proto_node *node);

static v8::Persistent<v8::FunctionTemplate> s_ct;
DissectorNode *m_root;
frame_data *m_fdata;
Expand Down
12 changes: 7 additions & 5 deletions src/lazyDataSource.h
Expand Up @@ -4,8 +4,10 @@

#include <v8.h>
#include <node.h>
#include <config.h>
#include <epan/epan.h>
extern "C" {
#include <config.h>
#include <epan/epan.h>
}
#include <node_buffer.h>

class DissectorNode;
Expand All @@ -15,12 +17,12 @@ class LazyDataSource : node::ObjectWrap {
static void Init(v8::Handle<v8::Object> target);
static v8::Local<v8::Object> New(DissectorNode *parent, tvbuff_t *tvb);
node::Buffer* createBuffer();
DissectorNode* getParent() { return m_parent; }
DissectorNode* getParent() { return m_parent; }

private:
LazyDataSource(DissectorNode *parent, tvbuff_t *tvb);
~LazyDataSource();

static v8::Persistent<v8::FunctionTemplate> s_ct;
DissectorNode *m_parent;
tvbuff_t *m_tvb;
Expand Down
10 changes: 6 additions & 4 deletions src/lazyDissectorNode.h
Expand Up @@ -4,19 +4,21 @@

#include <v8.h>
#include <node.h>
#include <config.h>
#include <epan/epan.h>
extern "C" {
#include <config.h>
#include <epan/epan.h>
}

class LazyDissectorNode : node::ObjectWrap {
public:
static void Init(v8::Handle<v8::Object> target);
static v8::Local<v8::Object> New(frame_data *fdata, epan_dissect_t *edt, proto_node *node);
proto_node* getProtoNode() { return m_node; }

private:
LazyDissectorNode(frame_data *fdata, epan_dissect_t *edt, proto_node *node);
~LazyDissectorNode();

static v8::Persistent<v8::FunctionTemplate> s_ct;
frame_data *m_fdata;
epan_dissect_t *m_edt;
Expand Down
6 changes: 4 additions & 2 deletions src/nodeshark.h
Expand Up @@ -11,8 +11,10 @@
#include <ctype.h>
#include <locale.h>
#include <limits.h>
#include <config.h>
#include <epan/epan.h>
extern "C" {
#include <config.h>
#include <epan/epan.h>
}

class NodeShark : node::ObjectWrap {
public:
Expand Down

0 comments on commit 48aad43

Please sign in to comment.