diff options
Diffstat (limited to 'test/lua/dissector.lua')
-rw-r--r-- | test/lua/dissector.lua | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/test/lua/dissector.lua b/test/lua/dissector.lua index 632ae87f9b..3fb835f289 100644 --- a/test/lua/dissector.lua +++ b/test/lua/dissector.lua @@ -28,7 +28,7 @@ -- Once the script is loaded, it creates a new protocol named "MyDNS" (or "MYDNS" in some places). If you have -- a capture file with DNS packets in it, simply select one in the Packet List pane, right-click on it, and -- select "Decode As ...", and then in the dialog box that shows up scroll down the list of protocols to one --- called "MYDNS", select that and click the "ok" or "apply" button. Voila`, your'e now decoding DNS packets +-- called "MYDNS", select that and click the "ok" or "apply" button. Voila`, you're now decoding DNS packets -- using the simplistic dissector in this script. Another way is to download the capture file made for -- this script, and open that - since the DNS packets in it use UDP port 65333 (instead of the default 53), -- and since the MyDNS protocol in this script has been set to automatically decode UDP port 65333, it will @@ -123,7 +123,7 @@ local pf_query_class = ProtoField.uint16("mydns.query.class", "Class", ba ---------------------------------------- -- this actually registers the ProtoFields above, into our new Protocol --- in a real script I wouldn't do it this way; I'd build a table of fields programaticaly +-- in a real script I wouldn't do it this way; I'd build a table of fields programmatically -- and then set dns.fields to it, so as to avoid forgetting a field dns.fields = { pf_trasaction_id, pf_flags, pf_num_questions, pf_num_answers, pf_num_authority_rr, pf_num_additional_rr, @@ -200,7 +200,7 @@ function dns.dissector(tvbuf,pktinfo,root) -- We want to check that the packet size is rational during dissection, so let's get the length of the -- packet buffer (Tvb). - -- Because DNS has no additonal payload data other than itself, and it rides on UDP without padding, + -- Because DNS has no additional payload data other than itself, and it rides on UDP without padding, -- we can use tvb:len() or tvb:reported_len() here; but I prefer tvb:reported_length_remaining() as it's safer. local pktlen = tvbuf:reported_length_remaining() @@ -224,7 +224,7 @@ function dns.dissector(tvbuf,pktinfo,root) tree:add(pf_trasaction_id, tvbuf:range(0,2)) -- We'd like to put the transaction id number in the GUI row for this packet, in its - -- INFO column/cell. Firt we need the transaction id value, though. Since we just + -- INFO column/cell. First we need the transaction id value, though. Since we just -- dissected it with the previous code line, we could now get it using a Field's -- FieldInfo extractor, but instead we'll get it directly from the TvbRange just -- to show how to do that. We'll use Field/FieldInfo extractors later on... @@ -303,7 +303,7 @@ function dns.dissector(tvbuf,pktinfo,root) -- now add the first query to the 'Queries' child tree we just created -- we're going to change the string generated by this later, after we figure out the subsequent fields. - -- the whole query field is the query name field length we just got, plus the 20byte type and 2-byte class + -- the whole query field is the query name field length we just got, plus the 20 byte type and 2-byte class local q_tree = queries_tree:add(pf_query, tvbuf:range(pos, name_len + 4)) q_tree:add(pf_query_name, tvbuf:range(pos, name_len), name) @@ -353,7 +353,7 @@ udp_encap_table:add(MYDNS_PROTO_UDP_PORT, dns) -- dissect it if it's for us, and we need to return true if it's for us, or else false -- figuring out if it's for us or not is not easy -- we need to try as hard as possible, or else we'll think it's for us when it's --- not and block other heuristic dissectors from getting their chanc +-- not and block other heuristic dissectors from getting their chance -- -- in practice, you'd never set a dissector like this to be heuristic, because there -- just isn't enough information to safely detect if it's DNS or not @@ -370,7 +370,7 @@ local function heur_dissect_dns(tvbuf,pktinfo,root) local tvbr = tvbuf:range(0,DNS_HDR_LEN) - -- the first 2 bytes are tansaction id, which can be anything so no point in checking those + -- the first 2 bytes are transaction id, which can be anything so no point in checking those -- the next 2 bytes contain flags, a couple of which have some values we can check against -- the opcode has to be 0, 1, 2, 4 or 5 @@ -403,13 +403,13 @@ local function heur_dissect_dns(tvbuf,pktinfo,root) dprint2("heur_dissect_dns: everything looks good calling the real dissector") - -- don't do this line in your script - I'm just doing it so our testsuite can + -- don't do this line in your script - I'm just doing it so our test-suite can -- verify this script root:add("Heuristic dissector used"):set_generated() -- ok, looks like it's ours, so go dissect it -- note: calling the dissector directly like this is new in 1.11.3 - -- also note that calling a Dissector objkect, as this does, means we don't + -- also note that calling a Dissector object, as this does, means we don't -- get back the return value of the dissector function we created previously -- so it might be better to just call the function directly instead of doing -- this, but this script is used for testing and this tests the call() function |