diff options
author | lego <lego@f5534014-38df-0310-8fa8-9805f1628bb7> | 2006-12-22 05:48:57 +0000 |
---|---|---|
committer | lego <lego@f5534014-38df-0310-8fa8-9805f1628bb7> | 2006-12-22 05:48:57 +0000 |
commit | 5bea294fc07174367669ec84066233efc0abc60d (patch) | |
tree | a906e7958e2150d942ee95190cf03de317ba750e /epan/wslua | |
parent | 357eb61e323630ba28081feace256240e9d8e027 (diff) |
- Fix the name of the disable_lua variable.
== improve documentation
make-doc.pl ( make doc ) generates an almost complete reference manual.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@20192 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/wslua')
-rw-r--r-- | epan/wslua/init_wslua.c | 12 | ||||
-rwxr-xr-x | epan/wslua/make-doc.pl | 92 | ||||
-rw-r--r-- | epan/wslua/taps | 85 | ||||
-rw-r--r-- | epan/wslua/wslua_proto.c | 174 | ||||
-rw-r--r-- | epan/wslua/wslua_tvb.c | 9 |
5 files changed, 267 insertions, 105 deletions
diff --git a/epan/wslua/init_wslua.c b/epan/wslua/init_wslua.c index 2822f71992..285ddc20b1 100644 --- a/epan/wslua/init_wslua.c +++ b/epan/wslua/init_wslua.c @@ -263,16 +263,16 @@ int wslua_init(lua_State* LS) { } /* check if lua is to be disabled */ - lua_pushstring(L,"lua_disabled"); + lua_pushstring(L,"disable_lua"); lua_gettable(L, LUA_GLOBALSINDEX); if (lua_isboolean(L,-1) && lua_toboolean(L,-1)) { - /* disable lua */ - lua_close(L); - L = NULL; - return 0; + /* disable lua */ + lua_close(L); + L = NULL; + return 0; } - + /* check whether we should run other scripts even if running superuser */ lua_pushstring(L,"run_user_scripts_when_superuser"); lua_gettable(L, LUA_GLOBALSINDEX); diff --git a/epan/wslua/make-doc.pl b/epan/wslua/make-doc.pl index 5097c31e85..f8877f7cd8 100755 --- a/epan/wslua/make-doc.pl +++ b/epan/wslua/make-doc.pl @@ -87,24 +87,6 @@ my $docbook_template = { non_method_functions_footer => "\t\t</section> <!-- Non method -->\n", }; -my %metamethods = %{{ - __tostring => "tostring(__)", - __index => "__[]", - __newindex => "__[] = ", - __add => "__ + __", - __sub => "__ - __", - __mul => "__ * __", - __div => "__ / __", - __mod => "__ % __", - __pow => "__ ^ __", - __unm => "-___", - __concat => "__ .. __", - __len => "#__", - __call => "__()", - __eq => "__ == __", - __lt => "__ < __", - __le => "__ <= __", -}}; my $template_ref = $docbook_template; my $out_extension = "xml"; @@ -134,7 +116,6 @@ sub { descr=> gorolla($4), constructors => [], methods => [], - metamethods => [], attributes => [] }; $classes{$1} = $class; @@ -154,7 +135,7 @@ sub { push @functions, $function; } ] , -[ 'WSLUA_CONSTRUCTOR\s+([A-Za-z]+)_([a-z_]+).*?\173' . $TRAILING_COMMENT_RE, +[ 'WSLUA_CONSTRUCTOR\s+([A-Za-z0-9]+)_([a-z0-9_]+).*?\173' . $TRAILING_COMMENT_RE, sub { deb ">cc=$1=$2=$3=$4=$5=$6=$7=\n"; $function = { @@ -168,54 +149,86 @@ sub { push @{${$class}{constructors}}, $function; } ] , -[ 'WSLUA_METHOD\s+([A-Za-z]+)_([a-z_]+)[^\173]*\173' . $TRAILING_COMMENT_RE, +[ '_WSLUA_CONSTRUCTOR_\s+([A-Za-z0-9]+)_([a-z0-9_]+)\s*(.*?)\052\057', + sub { + deb ">cc=$1=$2=$3=$4=$5=$6=$7=\n"; + $function = { + returns => [], + arglist => [], + args => {}, + name => "$1.$2", + descr => gorolla($3), + type => 'constructor' + }; + push @{${$class}{constructors}}, $function; + } ] , + +[ 'WSLUA_METHOD\s+([A-Za-z]+)_([a-z0-9_]+)[^\173]*\173' . $TRAILING_COMMENT_RE, sub { deb ">cm=$1=$2=$3=$4=$5=$6=$7=\n"; + my $name = "$1"; + $name =~ tr/A-Z/a-z/; + $name .= ":$2"; $function = { returns => [], arglist => [], args => {}, - name => "$1:$2", + name => $name, descr => gorolla($5), type => 'method' }; push @{${$class}{methods}}, $function; } ] , -[ 'WSLUA_METAMETHOD\s+([A-Za-z]+)(__[a-z]+)[^\173]*\173' . $TRAILING_COMMENT_RE, +[ 'WSLUA_METAMETHOD\s+([A-Za-z]+)(__[a-z0-9]+)[^\173]*\173' . $TRAILING_COMMENT_RE, sub { deb ">cm=$1=$2=$3=$4=$5=$6=$7=\n"; - my $name = $metamethods{$2}; + my $name = "$1"; + $name =~ tr/A-Z/a-z/; + $name .= ":$2"; my ($c,$d) = ($1,$5); $function = { returns => [], arglist => [], args => {}, - name => "$1:$2", + name => $name, descr => gorolla($5), type => 'metamethod' }; - push @{${$class}{metamethods}}, $function; + push @{${$class}{methods}}, $function; } ] , -[ '#define WSLUA_(OPT)?ARG_([a-z_]+)_([A-Z0-9]+)\s+\d+' . $TRAILING_COMMENT_RE, +[ '#define WSLUA_(OPT)?ARG_([a-z0-9_]+)_([A-Z0-9]+)\s+\d+' . $TRAILING_COMMENT_RE, sub { deb ">a=$1=$2=$3=$4=$5=$6=$7=\n"; - push @{${$function}{arglist}} , $3; - ${${$function}{args}}{$3} = {descr=>$6} + my $name = $1 eq 'OPT' ? "[$3]" : $3; + push @{${$function}{arglist}} , $name; + ${${$function}{args}}{$name} = {descr=>$6,} +} ], + +[ '\057\052\s*WSLUA_(OPT)?ARG_([A-Za-z0-9_]+)_([A-Z0-9]+)\s*(.*?)\052\057', + sub { + deb ">a=$1=$2=$3=$4=$5=$6=$7=\n"; + my $name = $1 eq 'OPT' ? "[$3]" : $3; + push @{${$function}{arglist}} , $name; + ${${$function}{args}}{$name} = {descr=>$4,} } ], [ '#define WSLUA_(OPT)?ARG_([A-Za-z]+)_([a-z_]+)_([A-Z0-9]+)\s+\d+' . $TRAILING_COMMENT_RE, sub { deb ">ca=$1=$2=$3=$4=$5=$6=$7=\n"; - push @{${$function}{arglist}} , $4; - ${${$function}{args}}{$4} = {descr=>$7} + my $name = $1 eq 'OPT' ? "[$4]" : $4; + push @{${$function}{arglist}} , $name; + ${${$function}{args}}{$name} = {descr=>$7,optional => $1 eq '' ? 1 : 0 } } ], [ '/\052\s+WSLUA_ATTRIBUTE\s+([A-Za-z]+)_([a-z_]+)\s+([A-Z]*)\s*(.*?)\052/', sub { deb ">at=$1=$2=$3=$4=$5=$6=$7=\n"; - push @{${$class}{attributes}}, { name => "$1.$2", descr => gorolla($4), mode=>$3 }; + my $name = "$1"; + $name =~ tr/A-Z/a-z/; + $name .= ".$2"; + push @{${$class}{attributes}}, { name => $name, descr => gorolla($4), mode=>$3 }; } ], [ '/\052\s+WSLUA_MOREARGS\s+([A-Za-z_]+)\s+(.*?)\052/', @@ -231,6 +244,12 @@ sub { push @{${$function}{returns}} , gorolla($4) if $4 ne ''; } ], +[ '\057\052\s*_WSLUA_RETURNS_\s*(.*?)\052\057', + sub { + deb ">fr2=$1=$2=$3=$4=$5=$6=$7=\n"; + push @{${$function}{returns}} , gorolla($1) if $1 ne ''; +} ], + [ 'WSLUA_ERROR\s*\050\s*(([A-Z][A-Za-z]+)_)?([a-z_]+),' . $QUOTED_RE , sub { deb ">e=$1=$2=$3=$4=$5=$6=$7=\n"; @@ -325,11 +344,7 @@ while ( $file = shift) { for my $m (@{${$cl}{methods}}) { function_descr($m); } - - for my $m (@{${$cl}{metamethods}}) { - function_descr($m); - } - + # printf D ${$template_ref}{class_methods_footer}, $cname, $cname; } @@ -420,7 +435,8 @@ sub function_descr { for my $argname (@{${$f}{arglist}}) { my $arg = ${${$f}{args}}{$argname}; $argname =~ tr/A-Z/a-z/; - + $argname =~ s/\[(.*)\]/$1 (optional)/; + printf D ${$template_ref}{function_arg_header}, $argname, $argname; printf D ${$template_ref}{function_arg_descr}, ${$arg}{descr} , ${$arg}{descr} if ${$arg}{descr}; diff --git a/epan/wslua/taps b/epan/wslua/taps index a35d61ccf1..0791f07e7c 100644 --- a/epan/wslua/taps +++ b/epan/wslua/taps @@ -36,46 +36,45 @@ ip ../dissectors/packet-ip.h e_ip udp ../dissectors/packet-udp.h e_udphdr http ../dissectors/packet-http.h http_info_value_t h225 ../dissectors/packet-h225.h h225_packet_info h225_msg_type h225_cs_type - -#actrace -#afp -#ansi_a -#ansi_map -#bootp -#dcerpc -#dccp -#dtls -#epl -#eth -#fc -#fddi -#gsm_a -#gsm_map -#h245 -#h245dg -#wlan -#ipx -#isup -#jxta -#ldap -#mtp3 -#ncp_srt -#ncp_hdr -#ntlmssp -#q931 -#rpc -#rsvp -#rtpevent -#rtp -#scsi -#sctp -#sdp -#sip -#smb -#smb2 -#ssl -#t38 -#tcp -#teredo -#tr -#wsp +actrace ../dissectors/packet-actrace.h actrace_info_t +#afp ../dissectors/packet-afp.h +ansi_a ../dissectors/packet-ansi_a.h ansi_a_tap_rec_t +ansi_map ../dissectors/packet-ansi_map.h ansi_map_tap_rec_t +#bootp ../dissectors/packet-bootp.h bootp_info_t +#dcerpc ../dissectors/packet-dcerpc.h dcerpc_info_t +#dccp ../dissectors/packet-dccp.h dccp_info_t +#dtls ../dissectors/packet-dtls.h dtls_info_t +#epl ../dissectors/packet-epl.h epl_info_t +eth ../dissectors/packet-eth.h eth_hdr +#fc ../dissectors/packet-fc.h fc_hdr +#fddi ../dissectors/packet-fddi.h fddi_info_t +#gsm_a ../dissectors/packet-gsm_a.h gsm_a_info_t +#gsm_map ../dissectors/packet-gsm_map.h gsm_map_info_t +#h245 ../dissectors/packet-h245.h h245_info_t +#h245dg ../dissectors/packet-h245dg.h h245dg_info_t +#wlan ../dissectors/packet-wlan.h wlan_info_t +#ipx ../dissectors/packet-ipx.h ipx_info_t +#isup ../dissectors/packet-isup.h isup_info_t +#jxta ../dissectors/packet-jxta.h jxta_info_t +#ldap ../dissectors/packet-ldap.h ldap_info_t +#mtp3 ../dissectors/packet-mtp3.h mtp3_info_t +#ncp_srt ../dissectors/packet-ncp_srt.h ncp_srt_info_t +#ncp_hdr ../dissectors/packet-ncp_hdr.h ncp_hdr_info_t +#ntlmssp ../dissectors/packet-ntlmssp.h ntlmssp_info_t +#q931 ../dissectors/packet-q931.h q931_info_t +#rpc ../dissectors/packet-rpc.h rpc_info_t +#rsvp ../dissectors/packet-rsvp.h rsvp_info_t +#rtpevent ../dissectors/packet-rtpevent.h rtpevent_info_t +#rtp ../dissectors/packet-rtp.h rtp_info_t +#scsi ../dissectors/packet-scsi.h scsi_info_t +#sctp ../dissectors/packet-sctp.h sctp_info_t +#sdp ../dissectors/packet-sdp.h sdp_info_t +#sip ../dissectors/packet-sip.h sip_info_t +#smb ../dissectors/packet-smb.h smb_info_t +#smb2 ../dissectors/packet-smb2.h smb2_info_t +#ssl ../dissectors/packet-ssl.h ssl_info_t +#t38 ../dissectors/packet-t38.h t38_info_t +#tcp ../dissectors/packet-tcp.h tcp_info_t +#teredo ../dissectors/packet-teredo.h teredo_info_t +#tr ../dissectors/packet-tr.h tr_info_t +#wsp ../dissectors/packet-wsp.h wsp_info_t diff --git a/epan/wslua/wslua_proto.c b/epan/wslua/wslua_proto.c index 0ac56a95d2..8fbb2b0bba 100644 --- a/epan/wslua/wslua_proto.c +++ b/epan/wslua/wslua_proto.c @@ -474,23 +474,105 @@ static int ProtoField_integer(lua_State* L, enum ftenum type) { } #define PROTOFIELD_INTEGER(lower,FT) static int ProtoField_##lower(lua_State* L) { return ProtoField_integer(L,FT); } -/* WSLUA_SECTION Protofield integer constructors */ -/* WSLUA_TEXT integer type ProtoField constructors use the following arguments */ -/* WSLUA_ARG_DESC Protofield_integer ABBR abbreviated name of the field (the string used in filters) */ -/* WSLUA_OPTARG_DESC Protofield_integer NAME Actual name of the field (the string that appears in the tree) */ -/* WSLUA_ARGDESC Protofield_integer DESC description of the field */ -/* _WSLUA_RETURNS_ Protofield_integer a protofiled item to be added to a ProtoFieldArray */ /* _WSLUA_CONSTRUCTOR_ ProtoField_uint8 */ +/* WSLUA_ARG_Protofield_uint8_ABBR abbreviated name of the field (the string used in filters) */ +/* WSLUA_OPTARG_Protofield_uint8_NAME Actual name of the field (the string that appears in the tree) */ +/* WSLUA_OPTARG_Protofield_uint8_BASE one of base.DEC, base.HEX or base.OCT */ +/* WSLUA_OPTARG_Protofield_uint8_VALUESTRING a table containing the text that corresponds to the values */ +/* WSLUA_OPTARG_Protofield_uint8_MASK integer mask of this field */ +/* WSLUA_OPTARG_Protofield_uint8_DESC description of the field */ +/* _WSLUA_RETURNS_ a protofield item to be added to a ProtoFieldArray */ + /* _WSLUA_CONSTRUCTOR_ ProtoField_uint16 */ +/* WSLUA_ARG_Protofield_uint8_ABBR abbreviated name of the field (the string used in filters) */ +/* WSLUA_OPTARG_Protofield_uint8_NAME Actual name of the field (the string that appears in the tree) */ +/* WSLUA_OPTARG_Protofield_uint8_BASE one of base.DEC, base.HEX or base.OCT */ +/* WSLUA_OPTARG_Protofield_uint8_VALUESTRING a table containing the text that corresponds to the values */ +/* WSLUA_OPTARG_Protofield_uint8_MASK integer mask of this field */ +/* WSLUA_OPTARG_Protofield_uint8_DESC description of the field */ +/* _WSLUA_RETURNS_ a protofield item to be added to a ProtoFieldArray */ + /* _WSLUA_CONSTRUCTOR_ ProtoField_uint24 */ +/* WSLUA_ARG_Protofield_uint8_ABBR abbreviated name of the field (the string used in filters) */ +/* WSLUA_OPTARG_Protofield_uint8_NAME Actual name of the field (the string that appears in the tree) */ +/* WSLUA_OPTARG_Protofield_uint8_BASE one of base.DEC, base.HEX or base.OCT */ +/* WSLUA_OPTARG_Protofield_uint8_VALUESTRING a table containing the text that corresponds to the values */ +/* WSLUA_OPTARG_Protofield_uint8_MASK integer mask of this field */ +/* WSLUA_OPTARG_Protofield_uint8_DESC description of the field */ +/* _WSLUA_RETURNS_ a protofield item to be added to a ProtoFieldArray */ + /* _WSLUA_CONSTRUCTOR_ ProtoField_uint32 */ +/* WSLUA_ARG_Protofield_uint8_ABBR abbreviated name of the field (the string used in filters) */ +/* WSLUA_OPTARG_Protofield_uint8_NAME Actual name of the field (the string that appears in the tree) */ +/* WSLUA_OPTARG_Protofield_uint8_BASE one of base.DEC, base.HEX or base.OCT */ +/* WSLUA_OPTARG_Protofield_uint8_VALUESTRING a table containing the text that corresponds to the values */ +/* WSLUA_OPTARG_Protofield_uint8_MASK integer mask of this field */ +/* WSLUA_OPTARG_Protofield_uint8_DESC description of the field */ +/* _WSLUA_RETURNS_ a protofield item to be added to a ProtoFieldArray */ + /* _WSLUA_CONSTRUCTOR_ ProtoField_uint64 */ +/* WSLUA_ARG_Protofield_uint8_ABBR abbreviated name of the field (the string used in filters) */ +/* WSLUA_OPTARG_Protofield_uint8_NAME Actual name of the field (the string that appears in the tree) */ +/* WSLUA_OPTARG_Protofield_uint8_BASE one of base.DEC, base.HEX or base.OCT */ +/* WSLUA_OPTARG_Protofield_uint8_VALUESTRING a table containing the text that corresponds to the values */ +/* WSLUA_OPTARG_Protofield_uint8_MASK integer mask of this field */ +/* WSLUA_OPTARG_Protofield_uint8_DESC description of the field */ +/* _WSLUA_RETURNS_ a protofield item to be added to a ProtoFieldArray */ + /* _WSLUA_CONSTRUCTOR_ ProtoField_int8 */ +/* WSLUA_ARG_Protofield_uint8_ABBR abbreviated name of the field (the string used in filters) */ +/* WSLUA_OPTARG_Protofield_uint8_NAME Actual name of the field (the string that appears in the tree) */ +/* WSLUA_OPTARG_Protofield_uint8_BASE one of base.DEC, base.HEX or base.OCT */ +/* WSLUA_OPTARG_Protofield_uint8_VALUESTRING a table containing the text that corresponds to the values */ +/* WSLUA_OPTARG_Protofield_uint8_MASK integer mask of this field */ +/* WSLUA_OPTARG_Protofield_uint8_DESC description of the field */ +/* _WSLUA_RETURNS_ a protofield item to be added to a ProtoFieldArray */ + /* _WSLUA_CONSTRUCTOR_ ProtoField_int16 */ +/* WSLUA_ARG_Protofield_uint8_ABBR abbreviated name of the field (the string used in filters) */ +/* WSLUA_OPTARG_Protofield_uint8_NAME Actual name of the field (the string that appears in the tree) */ +/* WSLUA_OPTARG_Protofield_uint8_BASE one of base.DEC, base.HEX or base.OCT */ +/* WSLUA_OPTARG_Protofield_uint8_VALUESTRING a table containing the text that corresponds to the values */ +/* WSLUA_OPTARG_Protofield_uint8_MASK integer mask of this field */ +/* WSLUA_OPTARG_Protofield_uint8_DESC description of the field */ +/* _WSLUA_RETURNS_ a protofield item to be added to a ProtoFieldArray */ + /* _WSLUA_CONSTRUCTOR_ ProtoField_int24 */ +/* WSLUA_ARG_Protofield_uint8_ABBR abbreviated name of the field (the string used in filters) */ +/* WSLUA_OPTARG_Protofield_uint8_NAME Actual name of the field (the string that appears in the tree) */ +/* WSLUA_OPTARG_Protofield_uint8_BASE one of base.DEC, base.HEX or base.OCT */ +/* WSLUA_OPTARG_Protofield_uint8_VALUESTRING a table containing the text that corresponds to the values */ +/* WSLUA_OPTARG_Protofield_uint8_MASK integer mask of this field */ +/* WSLUA_OPTARG_Protofield_uint8_DESC description of the field */ +/* _WSLUA_RETURNS_ a protofield item to be added to a ProtoFieldArray */ + /* _WSLUA_CONSTRUCTOR_ ProtoField_int32 */ +/* WSLUA_ARG_Protofield_uint8_ABBR abbreviated name of the field (the string used in filters) */ +/* WSLUA_OPTARG_Protofield_uint8_NAME Actual name of the field (the string that appears in the tree) */ +/* WSLUA_OPTARG_Protofield_uint8_BASE one of base.DEC, base.HEX or base.OCT */ +/* WSLUA_OPTARG_Protofield_uint8_VALUESTRING a table containing the text that corresponds to the values */ +/* WSLUA_OPTARG_Protofield_uint8_MASK integer mask of this field */ +/* WSLUA_OPTARG_Protofield_uint8_DESC description of the field */ +/* _WSLUA_RETURNS_ a protofield item to be added to a ProtoFieldArray */ + /* _WSLUA_CONSTRUCTOR_ ProtoField_int64 */ -/* _WSLUA_CONSTRUCTOR_ ProtoField_framenum */ +/* WSLUA_ARG_Protofield_uint8_ABBR abbreviated name of the field (the string used in filters) */ +/* WSLUA_OPTARG_Protofield_uint8_NAME Actual name of the field (the string that appears in the tree) */ +/* WSLUA_OPTARG_Protofield_uint8_BASE one of base.DEC, base.HEX or base.OCT */ +/* WSLUA_OPTARG_Protofield_uint8_VALUESTRING a table containing the text that corresponds to the values */ +/* WSLUA_OPTARG_Protofield_uint8_MASK integer mask of this field */ +/* WSLUA_OPTARG_Protofield_uint8_DESC description of the field */ +/* _WSLUA_RETURNS_ a protofield item to be added to a ProtoFieldArray */ + +/* _WSLUA_CONSTRUCTOR_ ProtoField_framenum a frame number (for hyperlinks between frames) */ +/* WSLUA_ARG_Protofield_uint8_ABBR abbreviated name of the field (the string used in filters) */ +/* WSLUA_OPTARG_Protofield_uint8_NAME Actual name of the field (the string that appears in the tree) */ +/* WSLUA_OPTARG_Protofield_uint8_BASE one of base.DEC, base.HEX or base.OCT */ +/* WSLUA_OPTARG_Protofield_uint8_VALUESTRING a table containing the text that corresponds to the values */ +/* WSLUA_OPTARG_Protofield_uint8_MASK integer mask of this field */ +/* WSLUA_OPTARG_Protofield_uint8_DESC description of the field */ +/* _WSLUA_RETURNS_ a protofield item to be added to a ProtoFieldArray */ + PROTOFIELD_INTEGER(uint8,FT_UINT8) PROTOFIELD_INTEGER(uint16,FT_UINT16) PROTOFIELD_INTEGER(uint24,FT_UINT24) @@ -525,24 +607,78 @@ static int ProtoField_other(lua_State* L,enum ftenum type) { } #define PROTOFIELD_OTHER(lower,FT) static int ProtoField_##lower(lua_State* L) { return ProtoField_other(L,FT); } -/* WSLUA_SECTION Protofield integer constructors */ -/* WSLUA_TEXT integer type ProtoField constructors use the following arguments */ -/* WSLUA_ARG_DESC Protofield_integer ABBR abbreviated name of the field (the string used in filters) */ -/* WSLUA_OPTARG_DESC Protofield_integer NAME Actual name of the field (the string that appears in the tree) */ -/* WSLUA_ARGDESC Protofield_integer DESC : description of the field */ -/* _WSLUA_RETURNS_ Protofield non integer : a protofiled item to be added to a ProtoFieldArray */ /* _WSLUA_CONSTRUCTOR_ ProtoField_ipv4 */ +/* WSLUA_ARG_Protofield_uint8_ABBR abbreviated name of the field (the string used in filters) */ +/* WSLUA_OPTARG_Protofield_uint8_NAME Actual name of the field (the string that appears in the tree) */ +/* WSLUA_OPTARG_Protofield_uint8_DESC description of the field */ +/* _WSLUA_RETURNS_ a protofield item to be added to a ProtoFieldArray */ + /* _WSLUA_CONSTRUCTOR_ ProtoField_ipv6 */ +/* WSLUA_ARG_Protofield_uint8_ABBR abbreviated name of the field (the string used in filters) */ +/* WSLUA_OPTARG_Protofield_uint8_NAME Actual name of the field (the string that appears in the tree) */ +/* WSLUA_OPTARG_Protofield_uint8_DESC description of the field */ +/* _WSLUA_RETURNS_ a protofield item to be added to a ProtoFieldArray */ + /* _WSLUA_CONSTRUCTOR_ ProtoField_ether */ +/* WSLUA_ARG_Protofield_uint8_ABBR abbreviated name of the field (the string used in filters) */ +/* WSLUA_OPTARG_Protofield_uint8_NAME Actual name of the field (the string that appears in the tree) */ +/* WSLUA_OPTARG_Protofield_uint8_DESC description of the field */ +/* _WSLUA_RETURNS_ a protofield item to be added to a ProtoFieldArray */ + /* _WSLUA_CONSTRUCTOR_ ProtoField_float */ +/* WSLUA_ARG_Protofield_uint8_ABBR abbreviated name of the field (the string used in filters) */ +/* WSLUA_OPTARG_Protofield_uint8_NAME Actual name of the field (the string that appears in the tree) */ +/* WSLUA_OPTARG_Protofield_uint8_DESC description of the field */ +/* _WSLUA_RETURNS_ a protofield item to be added to a ProtoFieldArray */ + /* _WSLUA_CONSTRUCTOR_ ProtoField_double */ +/* WSLUA_ARG_Protofield_uint8_ABBR abbreviated name of the field (the string used in filters) */ +/* WSLUA_OPTARG_Protofield_uint8_NAME Actual name of the field (the string that appears in the tree) */ +/* WSLUA_OPTARG_Protofield_uint8_DESC description of the field */ +/* _WSLUA_RETURNS_ a protofield item to be added to a ProtoFieldArray */ + /* _WSLUA_CONSTRUCTOR_ ProtoField_string */ +/* WSLUA_ARG_Protofield_uint8_ABBR abbreviated name of the field (the string used in filters) */ +/* WSLUA_OPTARG_Protofield_uint8_NAME Actual name of the field (the string that appears in the tree) */ +/* WSLUA_OPTARG_Protofield_uint8_DESC description of the field */ +/* _WSLUA_RETURNS_ a protofield item to be added to a ProtoFieldArray */ + /* _WSLUA_CONSTRUCTOR_ ProtoField_strigz */ +/* WSLUA_ARG_Protofield_uint8_ABBR abbreviated name of the field (the string used in filters) */ +/* WSLUA_OPTARG_Protofield_uint8_NAME Actual name of the field (the string that appears in the tree) */ +/* WSLUA_OPTARG_Protofield_uint8_DESC description of the field */ +/* _WSLUA_RETURNS_ a protofield item to be added to a ProtoFieldArray */ + /* _WSLUA_CONSTRUCTOR_ ProtoField_bytes */ +/* WSLUA_ARG_Protofield_uint8_ABBR abbreviated name of the field (the string used in filters) */ +/* WSLUA_OPTARG_Protofield_uint8_NAME Actual name of the field (the string that appears in the tree) */ +/* WSLUA_OPTARG_Protofield_uint8_DESC description of the field */ +/* _WSLUA_RETURNS_ a protofield item to be added to a ProtoFieldArray */ + /* _WSLUA_CONSTRUCTOR_ ProtoField_ubytes */ +/* WSLUA_ARG_Protofield_uint8_ABBR abbreviated name of the field (the string used in filters) */ +/* WSLUA_OPTARG_Protofield_uint8_NAME Actual name of the field (the string that appears in the tree) */ +/* WSLUA_OPTARG_Protofield_uint8_DESC description of the field */ +/* _WSLUA_RETURNS_ a protofield item to be added to a ProtoFieldArray */ + /* _WSLUA_CONSTRUCTOR_ ProtoField_guid */ +/* WSLUA_ARG_Protofield_uint8_ABBR abbreviated name of the field (the string used in filters) */ +/* WSLUA_OPTARG_Protofield_uint8_NAME Actual name of the field (the string that appears in the tree) */ +/* WSLUA_OPTARG_Protofield_uint8_DESC description of the field */ +/* _WSLUA_RETURNS_ a protofield item to be added to a ProtoFieldArray */ + /* _WSLUA_CONSTRUCTOR_ ProtoField_oid */ +/* WSLUA_ARG_Protofield_uint8_ABBR abbreviated name of the field (the string used in filters) */ +/* WSLUA_OPTARG_Protofield_uint8_NAME Actual name of the field (the string that appears in the tree) */ +/* WSLUA_OPTARG_Protofield_uint8_DESC description of the field */ +/* _WSLUA_RETURNS_ a protofield item to be added to a ProtoFieldArray */ + /* _WSLUA_CONSTRUCTOR_ ProtoField_bool */ +/* WSLUA_ARG_Protofield_uint8_ABBR abbreviated name of the field (the string used in filters) */ +/* WSLUA_OPTARG_Protofield_uint8_NAME Actual name of the field (the string that appears in the tree) */ +/* WSLUA_OPTARG_Protofield_uint8_DESC description of the field */ +/* _WSLUA_RETURNS_ a protofield item to be added to a ProtoFieldArray */ + PROTOFIELD_OTHER(ipv4,FT_IPv4) PROTOFIELD_OTHER(ipv6,FT_IPv6) PROTOFIELD_OTHER(ipx,FT_IPXNET) @@ -560,7 +696,8 @@ PROTOFIELD_OTHER(oid,FT_OID) PROTOFIELD_OTHER(bool,FT_BOOLEAN) -static int ProtoField_tostring(lua_State* L) { +WSLUA_METAMETHOD ProtoField_tostring(lua_State* L) { + /* Returns a string w/ info about a protofiled (for debugging purposes) */ ProtoField f = checkProtoField(L,1); gchar* s = g_strdup_printf("ProtoField(%i): %s %s %s %s %p %.8x %s",f->hfid,f->name,f->abbr,ftenum_to_string(f->type),base_to_string(f->base),f->vs,f->mask,f->blob); @@ -717,7 +854,9 @@ static int Proto_tostring(lua_State* L) { return 1; } -WSLUA_FUNCTION wslua_register_postdissector(lua_State* L) { +WSLUA_FUNCTION wslua_register_postdissector(lua_State* L) { + /* make a protocol (with a dissector) a postdissector. It will be called for every frame after dissection */ +#define WSLUA_ARG_register_postdissector_PROTO 1 /* the protocol to be used as postdissector */ Proto proto = checkProto(L,1); if (!proto) return 0; @@ -1037,7 +1176,7 @@ WSLUA_METHOD Dissector_call(lua_State* L) { } -static int Dissector_tostring(lua_State* L) { +WSLUA_METAMETHOD Dissector_tostring(lua_State* L) { Dissector d = checkDissector(L,1); if (!d) return 0; lua_pushstring(L,dissector_handle_get_short_name(d)); @@ -1293,7 +1432,8 @@ WSLUA_METHOD DissectorTable_get_dissector (lua_State *L) { } -static int DissectorTable_tostring(lua_State* L) { +WSLUA_METAMETHOD DissectorTable_tostring(lua_State* L) { +/**/ /* XXX It would be nice to iterate and print which dissectors it has */ DissectorTable dt = checkDissectorTable(L,1); GString* s; diff --git a/epan/wslua/wslua_tvb.c b/epan/wslua/wslua_tvb.c index 490ba11170..6de754904b 100644 --- a/epan/wslua/wslua_tvb.c +++ b/epan/wslua/wslua_tvb.c @@ -436,7 +436,14 @@ static const luaL_reg Tvb_methods[] = { }; static int Tvb_range(lua_State* L); - +#if USED_FOR_DOC_PURPOSES +WSLUA_METAMETHOD Tvb__call(lua_State* L) { + /* equivalent to tvb:range(...) */ + return 0 +} +#endif + + */ static const luaL_reg Tvb_meta[] = { {"__call", Tvb_range}, {"__tostring", Tvb__tostring}, |