Commit Graph

133 Commits

Author SHA1 Message Date
Stig Bjørlykke e8e3f1011b Removed a wrong sanity check in ByteArray base64_decode.
svn path=/trunk/; revision=54379
2013-12-23 12:19:16 +00:00
Stig Bjørlykke df25b7a7e0 Improved out-of-bounds check in TvbRange ustringz and le_ustringz.
This functions should probably be marked as obsoleted now that we
have support for encoding in stringz.

svn path=/trunk/; revision=54372
2013-12-22 22:19:41 +00:00
Stig Bjørlykke 8a4f419f60 Made TvbRange strsize take an optional encoding argument.
svn path=/trunk/; revision=54371
2013-12-22 22:09:06 +00:00
Stig Bjørlykke a48a5a164f Made TvbRange string and stringz take an optional encoding argument, and
removed the yet-another-string-function string_enc and stringz_enc.

Documented the encoding argument.

svn path=/trunk/; revision=54356
2013-12-22 13:08:39 +00:00
Jakub Zawadzki be733f3041 Move epan/base64.[ch] to wsutil/ with function name change.
svn path=/trunk/; revision=54326
2013-12-21 14:38:51 +00:00
Guy Harris 0f86a86f47 Add new string_enc and stringz_enc methods that take an encoding value
as an argument, just as the add_packet_field method for a tree does.

Use tvb_get_string_enc() and tvb_get_stringz_enc() rather than
tvb_get_string(), tvb_get_stringz(), tvb_get_unicode_string(), and
tvb_get_unicode_stringz().  Treat "ustring" as meaning "UTF-16-encoded
Unicode string" rather than "UCS-2-encoded subset-of-Unicode string".

svn path=/trunk/; revision=54310
2013-12-20 20:29:27 +00:00
Evan Huus a6415ece0a Rename a couple of to_str functions to have ep_ in the name. This makes it
obvious that the returned string is ephemeral, and opens up the original names
in the API for versions that take a wmem pool (and thus can work in any scope).

svn path=/trunk/; revision=54249
2013-12-19 15:49:09 +00:00
Stig Bjørlykke 3b73e8b479 Renamed new_TvbRange to push_TvbRange and use this when creating a new
TvbRange from a FieldInfo.

This should fix the crash in bug #9483.

svn path=/trunk/; revision=54247
2013-12-19 15:26:31 +00:00
Martin Mathieson 485faca86d Add cast to try to fix buildbot failure
svn path=/trunk/; revision=54218
2013-12-18 13:37:20 +00:00
Stig Bjørlykke 52a05e6275 Added ByteArray base64_decode().
svn path=/trunk/; revision=54215
2013-12-18 12:55:43 +00:00
Stig Bjørlykke 52ce5acbdf Detect out-of-bounds when handling zero terminated strings from a TvbRange.
This avoids a wireshark crash.

svn path=/trunk/; revision=53470
2013-11-21 08:42:21 +00:00
Jakub Zawadzki 8c11584ce1 Make wslua byte_to_str[] array of char[3] instead of pointers to char.
XXX, it should use byte_to_hex() from to_str.c

svn path=/trunk/; revision=53350
2013-11-15 23:33:02 +00:00
Pascal Quantin 102c452bcb More emem -> wmem conversion:
- tvb_get_g_stringz()/tvb_get_ephemeral_stringz()/tvb_get_seasonal_stringz() -> tvb_get_stringz()
- tvb_get_g_stringz_enc()/tvb_get_ephemeral_stringz_enc() -> tvb_get_stringz_enc()
- tvb_get_ephemeral_unicode_stringz() -> tvb_get_unicode_stringz()
- tvb_bcd_dig_to_ep_str() -> tvb_bcd_dig_to_wmem_packet_str()
- update docs accordingly

svn path=/trunk/; revision=52180
2013-09-22 20:04:35 +00:00
Pascal Quantin a0c53ffaa1 emem -> wmem conversion:
- ep_tvb_get_bits() -> wmem_packet_tvb_get_bits()
- tvb_g_memdup()/ep_tvb_memdup() -> tvb_memdup()
- tvb_fake_unicode()/tvb_get_ephemeral_faked_unicode() -> tvb_get_faked_unicode()
- tvb_get_g_string()/tvb_get_ephemeral_string()/tvb_get_seasonal_string() -> tvb_get_string()
- tvb_get_g_unicode_string()/tvb_get_ephemeral_unicode_string() -> tvb_get_unicode_string()
- tvb_get_ephemeral_string_enc() -> tvb_get_string_enc()
- update docs accordingly

svn path=/trunk/; revision=52172
2013-09-22 15:50:55 +00:00
Evan Huus 6df83e8078 Add _g_ to the names of functions that allocate glib memory. This is a bit more
explicit, and frees up the "generic" names (like tvb_memdup) for new signatures
that take the appropriate wmem pool.

Majority of the conversion done with sed.

svn path=/trunk/; revision=52164
2013-09-21 17:04:41 +00:00
Jörg Mayer f348cd5678 Explicit inclusion of emem.h
svn path=/trunk/; revision=52000
2013-09-13 08:49:38 +00:00
Stig Bjørlykke f74bd06ecf Removed return value from ByteArray append and prepend, as this did push
the same ByteArray twice (and thus calling the GC twice).
This should fix bug 4461.

Changed ByteArray concat to create a new array to be returned.

svn path=/trunk/; revision=51872
2013-09-09 17:49:22 +00:00
Stig Bjørlykke 5f35d91ace Added TvbRange strsize().
svn path=/trunk/; revision=51470
2013-08-22 11:58:32 +00:00
Stig Bjørlykke 7d7bf98a8e Added TvbRange uncompress().
svn path=/trunk/; revision=48422
2013-03-19 17:15:27 +00:00
Anders Broman 27744ecc2d From beroset:
remove C++ incompatibilities 
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416

svn path=/trunk/; revision=48337
2013-03-16 08:12:29 +00:00
Bill Meier 9e436c6c4a Fix a misspelled word; Do some minor tweaking of the wording of a few comments.
svn path=/trunk/; revision=47903
2013-02-26 15:10:28 +00:00
Bill Meier 96a24cc79f Fix spelling/typos found using a list of commonly misspelled words.
The misspellings were mostly in comments but some were
in text strings visible to the user.


svn path=/trunk/; revision=47899
2013-02-26 04:42:26 +00:00
Bill Meier a6e56df8b6 it's ==> its & its ==> it's as needed.
svn path=/trunk/; revision=47898
2013-02-26 02:38:52 +00:00
Michael Mann 2c7844cc69 Fix typos/errors and make Lua API more consistent.
From Hadriel Kaplan, bug 8393 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8393)

svn path=/trunk/; revision=47885
2013-02-25 22:05:28 +00:00
Anders Broman 68160dac5c From "temp4746":
wslua TvbRange:le_ustring/ustring buffer overflow's.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8175

svn path=/trunk/; revision=47012
2013-01-10 06:55:16 +00:00
Stig Bjørlykke 55aae6767c From mathewt via bug 8012:
Fixed lua le_int64() and le_uint64().

svn path=/trunk/; revision=46151
2012-11-23 11:20:35 +00:00
Jeff Morriss 3729335973 We always HAVE_CONFIG_H so don't bother checking whether we have it or not.
svn path=/trunk/; revision=45016
2012-09-20 01:48:30 +00:00
Jakub Zawadzki bf81b42e1e Update Free Software Foundation address.
(COPYING will be updated in next commit)

svn path=/trunk/; revision=43536
2012-06-28 22:56:06 +00:00
Anders Broman 6efe4ea27c From Tony Trinh:
Update Lua from 5.1 to 5.2

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7400

svn path=/trunk/; revision=43479
2012-06-25 20:28:14 +00:00
Jeff Morriss fe5f076b5c Fix Coverity 702397: reference tvbr *after* checking that it is not NULL.
svn path=/trunk/; revision=43115
2012-06-05 15:26:09 +00:00
Anders Broman 7d17553acc From Evan Huus: Fix memory leaks in wslua_tvb.c fix typos in wslu_proto.c https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7202
svn path=/trunk/; revision=42281
2012-04-27 06:02:45 +00:00
Stig Bjørlykke 0352ac8e8f From Robert G. Jakabosky via bug 5575:
Fix memory errors in Lua dissectors.
- Free Tvb when created from ByteArray.
- Free TvbRange correctly.
- Free string from get_persconffile_path and get_datafile_path.
- Some code cleanup.

svn path=/trunk/; revision=39744
2011-11-06 17:39:13 +00:00
Stig Bjørlykke 72cdab4c31 From Alex Vallee via bug 6346:
Added Lua TvbRange unicode string methods.

svn path=/trunk/; revision=39225
2011-10-02 17:02:10 +00:00
Stig Bjørlykke 9c7e12c572 Introduce NSTime Lua object to handle nstime_t.
This object can be used to retreive other absolute and relative time fields,
create and modify nstime_t values and put generated time values in the tree.

Also added ProtoField.absolute_time and ProtoField.relative_time.

svn path=/trunk/; revision=38616
2011-08-19 08:36:02 +00:00
Jeff Morriss 23c5165169 Clarify that Tvb_reported_length_remaining may return -1
svn path=/trunk/; revision=38485
2011-08-11 13:45:42 +00:00
Jeff Morriss fa4d32113c From Alexander Stein via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6175 :
The attached patch adds the method reported_length_remaining to tvb.

svn path=/trunk/; revision=38464
2011-08-11 00:49:43 +00:00
Jeff Morriss 4ee1d732fb Add a Tvb_reported_len Lua API; this may help satisfy bug 6175.
svn path=/trunk/; revision=38461
2011-08-10 21:45:53 +00:00
Stig Bjørlykke b3d0f00015 From Tony Trinh via bug 5960:
Fix TvbRange:string() so that it returns a string that contains all bytes
of the range, including zeroes (instead of being truncated at first zero).

svn path=/trunk/; revision=37763
2011-06-23 11:06:34 +00:00
Stig Bjørlykke 5934925554 Rename Tvb_new_real to ByteArray_tvb, as it's a ByteArray function.
Documentation is generated from code.

This fixes bug 5199.

svn path=/trunk/; revision=37761
2011-06-23 10:43:49 +00:00
Stig Bjørlykke 6df263d634 Rename Tvb_tvb to TvbRange_tvb, as it's a TvbRange function.
Documentation is generated from code.

This fixes bug 5006.

svn path=/trunk/; revision=37760
2011-06-23 10:28:53 +00:00
Jeff Morriss f3f9f2697f Make TVBs opaque for most users.
Convert TVB_RAW_OFFSET() and TVB_GET_DS_TVB() into functions.

svn path=/trunk/; revision=37422
2011-05-27 03:06:50 +00:00
Stig Bjørlykke 43851d797d Include config.h only from .c files.
This avoids a warning building epan.c which includes both config.h and wslua.h
(duplicate defines from config.h)

svn path=/trunk/; revision=36751
2011-04-21 13:13:39 +00:00
Bill Meier 8a07e469f3 Fix a number of msvc level 4 "Unreachable code" warnings by removing unneeded
return statements.

svn path=/trunk/; revision=35709
2011-01-30 22:32:25 +00:00
Jeff Morriss 9f3acc1e25 Aw, man, I knew this code was parsed, but I missed the docbook part. Revert 34598 and 34599.
svn path=/trunk/; revision=34602
2010-10-21 12:41:15 +00:00
Jeff Morriss 383df3dfe5 Make the indentation consistent.
Pull function names to column 0 - except when necessary for autoregistration.
Put function comments before the function.
For readability, put the macros for functions before the function too.
Put class functions before the class.

svn path=/trunk/; revision=34599
2010-10-21 02:50:27 +00:00
Stig Bjørlykke 6defe828fc Made more generic concat meta method for TvbRange, Int64 and UInt64.
This way we can concat more objects in one line.

svn path=/trunk/; revision=31461
2010-01-07 12:40:23 +00:00
Stig Bjørlykke 703aa03948 Added concat meta method for TvbRange, Int64 and UInt64.
svn path=/trunk/; revision=31458
2010-01-06 22:14:25 +00:00
Stig Bjørlykke c5fac7edc4 Fix some documentation typos.
svn path=/trunk/; revision=31453
2010-01-06 10:13:56 +00:00
Stig Bjørlykke e619752c58 Added signed integer TvbRange methods.
svn path=/trunk/; revision=31452
2010-01-05 20:25:04 +00:00
Stig Bjørlykke a5c2c6fb0d Use correct method names in TvbRange error messages.
svn path=/trunk/; revision=31450
2010-01-05 16:07:21 +00:00
Stig Bjørlykke 3988c9b848 Add missing stringz tvbrange method.
This fixes bug 2244.

svn path=/trunk/; revision=31398
2010-01-01 15:57:14 +00:00
Stig Bjørlykke ca0379ca2a Make more functions static.
svn path=/trunk/; revision=30517
2009-10-11 16:27:37 +00:00
Stig Bjørlykke 9fd1f3d487 Removed redundant prototype of Tvb_range().
svn path=/trunk/; revision=30239
2009-10-01 17:24:29 +00:00
Balint Reczey a909a692de Minor documentation fix
svn path=/trunk/; revision=29021
2009-07-08 14:20:59 +00:00
Stig Bjørlykke 08797664b3 From Sam Roberts:
Added TvbRange:range()

From me:
Added TvbRange:bitfield()
Fixed some indents.

svn path=/trunk/; revision=28656
2009-06-08 08:14:36 +00:00
Stig Bjørlykke b7207572ac Changed g_strdup_printf -> ep_strdup_printf.
Use correct modifier for converting gint64 and guint64 to string.
Added __gc for Int64 and UInt64.
Fixed some indents.

svn path=/trunk/; revision=28655
2009-06-08 08:02:15 +00:00
Stig Bjørlykke 65eed611a8 Fix a typo in a comment.
svn path=/trunk/; revision=28327
2009-05-10 16:02:57 +00:00
Stig Bjørlykke 3dc9b64560 Adjusted arguments used in Lua Pref.statictext()
Update Lua documentation:
- Fixed Pref.enum, Pref.range and Pref.statictext
- Fixed the equivalent comment for pinfo.cols
- Do not have a comment star (*) in the documentation
- Be consistent and start all sentences with a capital letter

svn path=/trunk/; revision=28304
2009-05-08 16:40:38 +00:00
Stig Bjørlykke b09f8fcff5 Corrected some defines. Use defines when appropriate.
Document last argument to DissectorTable.new().

svn path=/trunk/; revision=27309
2009-01-27 14:36:46 +00:00
Stig Bjørlykke b28ca9c930 Fixed some typos.
svn path=/trunk/; revision=27308
2009-01-27 12:41:33 +00:00
Stig Bjørlykke ec8b88f947 Document the new lua functions.
svn path=/trunk/; revision=26660
2008-10-31 20:02:42 +00:00
Balint Reczey 33294f830c Provide TvbRange:{offset|len}() instead of TvbRange.{offset|len}.
Write access to offset and len from Lua is gone, too.
This fixes bug 2243.

svn path=/trunk/; revision=26657
2008-10-31 18:14:47 +00:00
Gerald Combs d934f6786d Fix compilation under Windows (uint -> guint).
svn path=/trunk/; revision=26217
2008-09-16 18:26:43 +00:00
Balint Reczey 8566c6046e Adds 64 bit integer handling to Lua interface.
Fixes bug 2750.

svn path=/trunk/; revision=26216
2008-09-16 14:37:00 +00:00
Balint Reczey d3c1fca78d Fix for bug 1965:
Fix ByteArray append() and set_size()

svn path=/trunk/; revision=26215
2008-09-16 14:00:48 +00:00
Luis Ontanon 42c3239a1a luis.ontanon@gmail.com => luis@ontanon.org
svn path=/trunk/; revision=25937
2008-08-05 21:03:46 +00:00
Luis Ontanon 9bf9f8615f Try to get the docbook buildbot runnig.
Do not generate doc items for wslua garbage collectors (they are transparet)


svn path=/trunk/; revision=25857
2008-07-29 00:23:58 +00:00
Luis Ontanon 006e41af12 From Balint Reczey
Fix for https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2453

The patch fixes the problem by extending the original "outstanding stuff"
approach.

Now the pointer itself won't be NULLified, instead we track the pointers with
their expiry state in structs in the outstanding_stuff list.
The Lua objects refers to those structs instead of the actual pointers and
checks the expiry state of the pointers before accessing them.
The pointers are marked expired when the dissection of the frame is finished
and the allocated struct is freed by Lua's garbage collector.

If the garbage collector hits the struct when it holds a not expired pointer,
it marks it as expired (that means we don't have any object in Lua referring to
the pointer) and the struct will be freed at the end of the dissection of the
frame.

this is for the 1.0 branch


svn path=/trunk/; revision=25845
2008-07-26 23:41:31 +00:00
Jaap Keuter a923b5491c From: Márton Németh:
The luaL_reg structure consists of two pointers: char* and a pointer to a function. 
The last entry should also reflect this: it should be { NULL, NULL } instead of { 0, 0 }.

svn path=/trunk/; revision=25175
2008-04-25 18:59:20 +00:00
Stig Bjørlykke 88f296224c From Marton Nemeth (bug 2447):
In help the not all of the following chapters begins with uppercase:

10.4.1. saving capture files 
10.4.2. obtaining dissection data 
10.4.3. GUI support 
10.4.4. post-dissection packet analysis 
10.4.5. obtaining packet information 
10.4.6. functions for writing dissectors 
10.4.7. adding information to the dissection tree 
10.4.8. functions for handling packet data 
10.4.9. Utility Functions

svn path=/trunk/; revision=24933
2008-04-12 13:56:28 +00:00
Luis Ontanon 2a96b4aff6 fix http://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2448
Tvb:xxx() functions are unpropperly named Tvb:get_xxx in the wsluarm


svn path=/trunk/; revision=24887
2008-04-10 23:59:19 +00:00
Sake Blok 6bec9d3d9e From tmiller@hcjbtech.org : Spelling error on GDS DB protocol dissector: "Buffer lenght:"
(recursively grepped through the source and corrected all occurences, even 
the ones just in comments)



svn path=/trunk/; revision=23211
2007-10-16 23:42:33 +00:00
Luis Ontanon 5f5f656108 From: Balint Reczey
I would like to handle the rare situation of Little Endian encoded
IP addresses, so i added a function which reads the address with
tvb_get_ipv4(), then swaps the bytes before SET_ADDRESS().


svn path=/trunk/; revision=21397
2007-04-12 22:45:22 +00:00
Luis Ontanon 5b08821866 have tvbrange:get_ipv4() not modifying the byte order of the extraced data.
have Proto.new() registering the protocol by name.


svn path=/trunk/; revision=21385
2007-04-11 19:24:19 +00:00
Luis Ontanon 3472c0fa67 Fix docbook documentation
svn path=/trunk/; revision=20577
2007-01-27 02:33:21 +00:00
Gerald Combs 1f955f3fcf Fix compilation (under Windows, at least).
svn path=/trunk/; revision=20541
2007-01-24 01:06:24 +00:00
Luis Ontanon 6f5c055c81 add range to the metatable of Tvb.
svn path=/trunk/; revision=20540
2007-01-23 23:36:28 +00:00
Luis Ontanon e9d3877fb8 tvb:range did not appear under Tvb in generated refman
pinfo.curr_proto appeared as pinfo.match
pinfo.columns in the refman was pinfo.cols in lua (now it is both in lua and in refman)


svn path=/trunk/; revision=20539
2007-01-23 23:34:41 +00:00
Luis Ontanon 1234c207f6 fix a typo.
svn path=/trunk/; revision=20193
2006-12-22 05:54:12 +00:00
Luis Ontanon 74cb1d2b46 - Fix the name of the disable_lua variable.
== improve documentation
   make-doc.pl ( make doc ) generates an almost complete reference manual.
 



svn path=/trunk/; revision=20192
2006-12-22 05:48:57 +00:00
Luis Ontanon 0072205e18 Have Lua disabled by default.
Add more documentation to the code. 
change make-dco.pl so that it creates more readable docbook output.

This should be copied over to 0.99.4



svn path=/trunk/; revision=19670
2006-10-24 13:16:57 +00:00
Luis Ontanon 125c6243f6 Add module information for generated docs
svn path=/trunk/; revision=19595
2006-10-18 18:45:24 +00:00
Luis Ontanon 6462d05044 Move the Lua interface into epan... (not a plugin anymore).
- Rename Tap into Listener
- add a mechanism to pass protocols' tap data to the Listener


svn path=/trunk/; revision=19319
2006-09-25 01:09:00 +00:00