Skip to content

Commit

Permalink
32-bit and Mac fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pathorn committed Jul 23, 2009
1 parent b64d6e3 commit ddd6933
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .gitignore
@@ -0,0 +1,4 @@
*.o
sst.so
usr
wireshark-dev*.deb
10 changes: 7 additions & 3 deletions Makefile
Expand Up @@ -2,9 +2,11 @@ OUT=sst.so
CXXSRC=packet-ssttcp.cpp packet-protobufs.cpp
CSRC=plugin.c

CFLAGS=-g -DWS_VAR_IMPORT=extern -DHAVE_STDARG_H -fPIC -DHAVE_VPRINTF -I/usr/include/wireshark $(shell pkg-config --cflags gmodule-2.0)
# ar -p wireshark-dev_1.0.2-3+lenny5_i386.deb data.tar.gz | tar -zxvf -

CFLAGS=-g -DWS_VAR_IMPORT=extern -DHAVE_STDARG_H -fPIC -DHAVE_VPRINTF -I./usr/include/wireshark -I/usr/include/wireshark $(shell pkg-config --cflags gmodule-2.0)
CXXFLAGS=$(CFLAGS)
LDFLAGS=-g -L/usr/lib/wireshark -lwireshark -shared -fPIC
LDFLAGS=-g -L/Applications/Wireshark.app/Contents/Resources/lib -L/usr/lib/wireshark -lwireshark -shared -dynamiclib -fPIC

OBJ=$(CXXSRC:.cpp=.o) $(CSRC:.c=.o)

Expand All @@ -14,6 +16,8 @@ $(OUT): $(OBJ)
clean:
rm -f $(OBJ) $(OUT)

install: $(OUT)
linux-install: $(OUT)
install -t /usr/lib/wireshark/plugins -m 0755 $(OUT)

mac-install: $(OUT)
install -m 0755 $(OUT) /Applications/Wireshark.app/Contents/Resources/lib/wireshark/plugins/
7 changes: 4 additions & 3 deletions packet-protobufs.cpp
Expand Up @@ -111,7 +111,8 @@ bool parse_protobufs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
if (length-offset >= 8){
guint64 flipvalue = tvb_get_letoh64(tvb, offset);
gdouble fltvalue = *(gdouble*)&flipvalue;
guint64 curtime = time(NULL)*1000000;
guint64 curtime = time(NULL);
curtime *= 1000000LL;
if (tree) {
guint64 unsignedflipvalue = (flipvalue&0x7fffffffffffffffULL);
if (unsignedflipvalue >= 0x7FF0000000000000ULL) {
Expand All @@ -120,7 +121,7 @@ bool parse_protobufs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
signstr = "-";
}
const char *message="?";
if (flipvalue == 0xFFF8000000000000U) {
if (flipvalue == 0xFFF8000000000000ULL) {
message = "Indeterminite NaN";
signstr = "";
} else if (unsignedflipvalue >= 0x7FF8000000000001LL && unsignedflipvalue <= 0x7FFFFFFFFFFFFFFFLL) {
Expand All @@ -133,7 +134,7 @@ bool parse_protobufs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
proto_tree_add_uint64_format(tree, hf_proto_int, tvb, offset, 8, flipvalue, "%d: 0x%08llX [%s%s Double]", field, (long long int)flipvalue, signstr, message);
} else if (fltvalue > -1e+8 && fltvalue < 1e+8 && (fltvalue > 1e-8 || fltvalue < -1e-8)) {
proto_tree_add_uint64_format(tree, hf_proto_int, tvb, offset, 8, flipvalue, "%d: %lf", field, fltvalue);
} else if (flipvalue > curtime-1000000000000 && flipvalue < curtime+1000000000000) { // +/- 12 days
} else if (flipvalue > curtime-1000000000000LL && flipvalue < curtime+1000000000000LL) { // +/- 12 days
char mystr[100];
time_t thistime = flipvalue/1000000;
char *ctime_str = ctime_r(&thistime, mystr);
Expand Down

0 comments on commit ddd6933

Please sign in to comment.