9 MATE: Meta Analysis and Tracing Engine
11 What is MATE? Well, to keep it very short, with MATE you can create user
12 configurable extension(s) of the display filter engine.
14 MATE's goal is to enable users to filter frames based on information extracted
15 from related frames or information on how frames relate to each other. MATE
16 was written to help troubleshooting gateways and other systems where a "use"
17 involves more protocols. However, MATE can be used as well to analyze other
18 issues regarding an interaction between packets like response times,
19 incompleteness of transactions, presence/absence of certain attributes in a
20 group of Protocol Data Units (PDUs) and more.
22 MATE is a Wireshark plugin that allows the user to specify how different
23 frames are related to each other. To do so, MATE extracts data from the frames'
24 tree and then, using that information, tries to group the frames based on how
25 MATE is configured. Once the PDUs are related, MATE will create a "protocol"
26 tree with fields the user can filter with. The fields will be almost the same
27 for all the related frames, so one can filter a complete session spanning
28 several frames containing more protocols based on an attribute appearing in
29 some related frame. Other than that MATE allows to filter frames based on
30 response times, number of PDUs in a group and a lot more.
32 So far MATE has been used to:
34 * Filter all packets of a call using various protocols knowing just the
35 calling number. (MATE's original goal)
36 * Filter all packets of all calls using various protocols based on the release
37 cause of one of its "segments".
38 * Extrapolate slow transactions from very "dense" captures. (finding requests
40 * Find incomplete transactions (no responses)
41 * Follow requests through more gateways/proxies.
44 [#ChMateGettingStarted]
48 These are the steps to try out MATE:
50 * Run Wireshark and check if the plugin is installed (MATE should
51 appear in Help->About Wireshark:Plugins)
52 * Get a configuration file e.g., <<File_tcp_mate,tcp.mate>> (see {wireshark-wiki-url}Mate/Examples[Mate/Examples]
53 for more) and place it somewhere on your harddisk.
54 * Go to Edit->Preferences...->Protocols->MATE and set the Configuration Filename to the file
55 you want to use and restart Wireshark.
56 * Load a corresponding capture file (e.g.,
57 {wireshark-wiki-url}uploads/27707187aeb30df68e70c8fb9d614981/http.cap[http.cap]) and see if MATE
58 has added some new display filter fields, something like: `mate tcp_pdu:1->tcp_ses:1`
59 or, at prompt: `path_to/wireshark -o "mate.config: tcp.mate" -r http.cap`.
61 If everything went well, your packet details might look something like this:
63 .Packet Details - MATE TCP Session (tcp.mate)
64 image::images/ws-mate-tcp-output.png[]
72 MATE creates a filterable tree based on information contained in frames that
73 share some relationship with information obtained from other frames. The way
74 these relationships are made is described in a configuration file. The
75 configuration file tells MATE what makes a PDU and how to relate it to other
78 MATE analyzes each frame to extract relevant information from the "protocol"
79 tree of that frame. The extracted information is contained in MATE PDUs;
80 these contain a list of relevant attributes taken from the tree. From now on, I
81 will use the term "PDU" to refer to the objects created by MATE containing the
82 relevant information extracted from the frame; I'll use "frame" to refer to the
83 "raw" information extracted by the various dissectors that pre-analyzed the frame.
85 For every PDU, MATE checks if it belongs to an existing "Group of PDUs" (GOP).
86 If it does, it assigns the PDU to that GOP and moves any new relevant attributes
87 to the GOP's attribute list. How and when do PDUs belong to GOPs is described
88 in the configuration file as well.
90 Every time a GOP is assigned a new PDU, MATE will check if it matches the
91 conditions to make it belong to a "Group of Groups" (GOG). Naturally the
92 conditions that make a GOP belong to a GOG are taken from the configuration
95 Once MATE is done analyzing the frame it will be able to create a "protocol"
96 tree for each frame based on the PDUs, the GOPs they belong to and naturally any
97 GOGs the former belongs to.
99 How to tell MATE what to extract, how to group it and then how to relate those
100 groups is made using AVPs and AVPLs.
102 Information in MATE is contained in Attribute Value Pairs (AVPs). AVPs are made
103 of two strings: the name and the value. AVPs are used in the configuration and
104 there they have an operator as well. There are various ways AVPs can be matched
105 against each other using those operators.
107 AVPs are grouped into AVP Lists (AVPLs). PDUs, GOPs and GOGs have an AVPL each.
108 Their AVPLs will be matched in various ways against others coming from the
111 MATE will be instructed how to extract AVPs from frames in order to create a PDU
112 with an AVPL. It will be instructed as well, how to match that AVPL against the
113 AVPLs of other similar PDUs in order to relate them. In MATE the relationship
114 between PDUs is a GOP, it has an AVPL as well. MATE will be configured with other
115 AVPLs to operate against the GOP's AVPL to relate GOPs together into GOGs.
117 A good understanding on how AVPs and AVPLs work is fundamental to understand how
122 MATE was originally written by Luis Ontanon, a Telecommunications systems
123 troubleshooter, as a way to save time filtering out the packets of a single call
124 from huge capture files using just the calling number. Later he used the time he
125 had saved to make it flexible enough to work with protocols other than the ones
126 he was directly involved with.
129 ==== Attribute Value Pairs (AVP)
131 Information used by MATE to relate different frames is contained in Attribute
132 Value Pairs (AVPs). AVPs are made of two strings - the name and the value. When
133 AVPs are used in the configuration, an operator is defined as well. There are
134 various ways AVPs can be matched against each other using those operators.
137 avp_name="avp's value"
138 another_name= "1234 is the value"
141 The name is a string used to refer to a "type" of an AVP. Two AVPs won't match
142 unless their names are identical.
145 The name must start with a lowercase letter (a-z) and can contain only alphanumeric characters
146 (a-zA-Z0-9) and the special characters "_", "-", and ".". The name ends with an operator.
148 You should not use uppercase characters in names, or names that start with “.” or
149 “_”. Capitalized names are reserved for configuration parameters (we'll call them
150 keywords); nothing forbids you from using capitalized strings for other things as
151 well but it probably would be confusing. I'll avoid using capitalized words for
152 anything but the keywords in this document, the reference manual, the examples
153 and the base library. Names that start with a “.” would be very confusing as well
154 because in the old grammar, AVPL transforms use names starting with a “.” to
155 indicate they belong to the replacement AVPL.
157 The value is a string that is either set in the configuration (for configuration
158 AVPs) or by Wireshark while extracting interesting fields from a frame's tree.
159 The values extracted from fields use the same representation as they do in filter
160 strings except that no quotes are used.
162 *The value will be dealt with as a string even if it is a number.* If there are
163 any spaces in the value, the value must be between quotes "".
164 Values that are also keywords such as True and False should also be wrapped
165 in quotes ("True", "False").
170 binary_data=01:23:45:67:89:ab:cd:ef
172 parameter_with_spaces="this value has spaces"
175 The way two AVPs with the same name might match is described by the operator.
176 Remember two AVPs won't match unless their names are identical. In MATE, match
177 operations are always made between the AVPs extracted from frames (called data
178 AVPs) and the configuration's AVPs.
180 Currently defined MATE AVP match operators are:
182 * <<Equal,Equal>> _=_ will match if the string given completely matches the data
184 * <<NotEqual,Not Equal>> _!_ will match only if the given value string is not equal to
185 the data AVP's value string
186 * <<OneOf,One Of>> _{}_ will match if one of the possible strings listed is equal to
187 the data AVP's value string
188 * <<StartsWith,Starts With>> _^_ will match if the string given matches the first
189 characters of the data AVP's value string
190 * <<EndsWith,Ends With>> _$_ will match if the string given matches the last characters
191 of the data AVP's value string
192 * <<Contains,Contains>> _~_ will match if the string given matches any substring of the
193 data AVP's value string
194 * <<LowerThan,Lower Than>> _<_ will match if the data AVP's value string is semantically
195 lower than the string given
196 * <<HigherThan,Higher Than>> _>_ will match if the data AVP's value string is semantically
197 higher than the string given
198 * <<Exists,Exists>> _?_ (the ? can be omitted) will match as far as a data AVP of the
201 ==== AVP lists (AVPL)
203 An AVPL is a set of diverse AVPs that can be matched against other AVPLs. Every
204 PDU, GOP and GOG has an AVPL that contains the information regarding it. The
205 rules that MATE uses to group PDUs and GOPs are AVPL operations.
207 *There will never be two identical AVPs in a given AVPL.* However, we can have
208 more than one AVP with the same name in an AVPL as long as their values are
213 ( addr=10.20.30.40, addr=192.168.0.1, tcp_port=21, tcp_port=32534, user_cmd=PORT,
214 data_port=12344, data_addr=192.168.0.1 )
215 ( addr=10.20.30.40, addr=192.168.0.1, channel_id=22:23, message_type=Setup,
216 calling_number=1244556673 )
217 ( addr=10.20.30.40, addr=192.168.0.1, ses_id=01:23:45:67:89:ab:cd:ef )
218 ( user_id=pippo, calling_number=1244556673, assigned_ip=10.23.22.123 )
221 In MATE there are two types of AVPLs:
223 * data AVPLs that contain information extracted from frames.
224 * configuration AVPLs that come from the configuration and are used to tell MATE how
225 to relate items based on their data AVPLs.
227 Data AVPLs can be operated against configuration AVPLs in various ways:
229 * <<Loose,Loose Match>>: Will match if at least one of the AVPs of each AVPL
230 match. If it matches it will return an AVPL containing all AVPs from the data
231 AVPL that did match the configuration AVPs.
232 * <<Every,"Every" Match>>: Will match if none of the AVPs of the configuration AVPL
233 fails to match a present AVP in the data AVPL, even if not all of the
234 configuration AVPs have a match. If it matches it will return an AVPL containing
235 all AVPs from the data AVPL that did match one AVP in the configuration AVPL.
236 * <<Strict,Strict Match>>: Will match if and only if every one of the configuration
237 AVPs have at least one match in the data AVPL. If it matches it will return
238 an AVPL containing the AVPs from the data AVPL that matched.
239 * There's also a <<Merge,Merge>> operation that is to be performed between AVPLs
240 where all the AVPs that don't exist in the data AVPL but exist in the configuration
241 will be added to the data AVPL.
242 * Other than that, there are <<Transform,Transforms>> - a combination
243 of a match AVPL and an AVPL to merge.
245 === MATE Frame Analysis
247 MATE's analysis of a frame is performed in three phases:
249 * In the first phase, MATE attempts to extract a MATE PDU from the frame's
250 protocol tree. MATE will create a PDU if MATE's config has a _Pdu_ declaration
251 whose _Proto_ is contained in the frame.
253 * In the second phase, if a PDU has been extracted from the frame, MATE will try
254 to group it to other PDUs into a GOP (Group of PDUs) by matching the key
255 criteria given by a _Gop_ declaration. If there is no GOP yet with the key
256 criteria for the PDU, MATE will try to create a new GOP for it if it matches the
257 _Start_ criteria given in the _Gop_ declaration.
259 * In the third phase, if there's a GOP for the PDU, MATE will try to group this
260 GOP with other GOPs into a GOG (Group of Groups) using the criteria given by the
261 _Member_ criteria of a _Gog_ declaration.
263 .MATE Analysis (PDU->GOP->GOG) flowchart
264 image::images/ws-mate-analysis.png[]
266 The extraction and matching logic comes from MATE's configuration; MATE's
267 configuration file is specified by the _mate.config_ preference. By default it is
268 an empty string which means: do not configure MATE.
270 The config file tells MATE what to look for in frames; How to make PDUs out of
271 it; How will PDUs be related to other similar PDUs into GOPs; And how GOPs
274 The MATE configuration file is a list of declarations. There are 4 types of
275 declarations: _Transform_, _Pdu_, _Gop_, and _Gog_. A _Transform_ block must be
276 before any of the other block declarations that may use it.
278 ==== Create PDUs (Phase 1)
280 MATE will look in the tree of every frame to see if there is useful data to
281 extract, and if there is, it will create one or more PDU objects containing the
284 The first part of MATE's analysis is the "PDU extraction".
286 ===== PDU data extraction
288 MATE will make a PDU for each different proto field of _Proto_ type present in the
289 frame. MATE will fetch from the field's tree those fields that are defined in
290 the <<Pdu>> declaration whose initial offset in the frame is within the
291 boundaries of the current _Proto_ and those of the given _Transport_ and _Payload_
295 Pdu dns_pdu Proto dns Transport ip {
296 Extract addr From ip.addr;
297 Extract dns_id From dns.id;
298 Extract dns_resp From dns.flags.response;
302 .Wireshark window - fields for PDU extraction
303 image::images/ws-mate-dns_pane.png[]
305 Once MATE has found a _Proto_ field for which to create a PDU from the frame it
306 will move backwards in the frame looking for the respective _Transport_ fields.
307 After that it will create AVPs named as each of those given in the rest of the
308 AVPL for every instance of the fields declared as its values.
310 .Frame fields mapped to PDU attributes
311 image::images/ws-mate-dns_pdu.png[]
313 Sometimes we need information from more than one _Transport_ protocol. In that
314 case MATE will check the frame looking backwards to look for the various
315 _Transport_ protocols in the given stack. MATE will choose only the closest
316 transport boundary per "protocol" in the frame.
318 This way we'll have all PDUs for every _Proto_ that appears in a frame match its
322 Pdu isup_pdu Proto isup Transport mtp3/ip {
323 Extract addr From ip.addr;
325 Extract m3pc From mtp3.dpc;
326 Extract m3pc From mtp3.opc;
328 Extract cic From isup.cic;
329 Extract isup_msg From isup.message_type;
333 .Frame containing multiple PDUs
334 image::images/ws-mate-isup_over_mtp3_over_ip.png[]
336 This allows to assign the right _Transport_ to the PDU avoiding duplicate
337 transport protocol entries (in case of tunneled ip over ip for example).
340 Pdu ftp_pdu Proto ftp Transport tcp/ip {
341 Extract addr From ip.addr;
342 Extract port From tcp.port;
343 Extract ftp_cmd From ftp.command;
347 .Frame with encapsulated (tunneled) fields
348 image::images/ws-mate-ftp_over_gre.png[]
350 Other than the mandatory _Transport_ there is also an optional _Payload_
351 statement, which works pretty much as _Transport_ but refers to elements after
352 the _Proto_'s range. It is useful in those cases where the payload protocol
353 might not appear in a PDU but nevertheless the PDU belongs to the same category.
356 Pdu mmse_over_http_pdu Proto http Transport tcp/ip {
360 Extract addr From ip.addr;
361 Extract port From tcp.port;
363 Extract content From http.content_type;
364 Extract host From http.host;
365 Extract http_rq From http.request;
366 Extract method From http.request.method;
367 Extract resp From http.response.code;
369 Extract msg_type From mmse.message_type;
370 Extract notify_status From mmse.status;
371 Extract send_status From mmse.response_status;
372 Extract trx From mmse.transaction_id;
376 .Extract from Payload fields
377 image::images/ws-mate-mmse_over_http.png[]
379 ===== Conditions on which to create PDUs
381 There might be cases in which we won't want MATE to create a PDU unless some of
382 its extracted attributes meet or do not meet some criteria. For that we use the
383 _Criteria_ statements of the _Pdu_ declarations.
386 Pdu isup_pdu Proto isup Transport mtp3/ip {
389 // MATE will create isup_pdu PDUs only when there is not a point code '1234'
390 Criteria Reject Strict (m3pc=1234);
393 Pdu ftp_pdu Proto ftp Transport tcp/ip {
396 // MATE will create ftp_pdu PDUs only when they go to port 21 of our ftp_server
397 Criteria Accept Strict (addr=10.10.10.10, port=21);
401 The _Criteria_ statement is given an action (_Accept_ or _Reject_), a match type
402 (_Strict_, _Loose_ or _Every_) and an AVPL against which to match the currently
405 ===== Transforming the attributes of a PDU
407 Once the fields have been extracted into the PDU's AVPL, MATE will apply any
408 declared _Transform_ to it. The way transforms are applied and how they work
409 is described later on. However, it's useful to know that once the AVPL for the
410 PDU is created, it may be transformed before being analyzed. That way we can
411 massage the data to simplify the analysis.
413 ===== MATE's PDU tree
415 Every successfully created PDU will add a MATE tree to the frame dissection. If
416 the PDU is not related to any GOP, the tree for the PDU will contain just the
417 PDU's info. If it is assigned to a GOP, the tree will also contain the GOP items,
418 and the same applies for the GOG level.
423 dns_pdu time: 3.750000
431 The PDU's tree contains some filterable fields
433 * _mate.dns_pdu_ will contain the number of the "dns_pdu" PDU
434 * _mate.dns_pdu.RelativeTime_ will contain the time passed since the beginning
435 of the capture in seconds
436 * the tree will contain the various attributes of the PDU as well, these will
437 all be strings (to be used in filters as "10.0.0.1", not as 10.0.0.1)
438 ** mate.dns_pdu.dns_resp
439 ** mate.dns_pdu.dns_id
442 ==== Grouping PDUs together (GOP) (Phase 2)
444 Once MATE has created the PDUs it passes to the PDU analysis phase. During the
445 PDU analysis phase MATE will try to group PDUs of the same type into 'Groups of
446 PDUs' (aka *GOP*++s++) and copy some AVPs from the PDU's AVPL to the GOP's AVPL.
448 .Grouping PDUs (GOP) flowchart
449 image::images/ws-mate-pdu_analysis.png[]
451 ===== What can belong to a GOP
453 Given a PDU, the first thing MATE will do is to check if there is any GOP
454 declaration in the configuration for the given PDU type. If so, it will use its
455 _Match_ AVPL to match it against the PDU's AVPL; if they don't match, the
456 analysis phase is done. If there is a match, the AVPL is the GOP's candidate key
457 which will be used to search the index of GOPs for the GOP to which to assign
458 the current PDU. If there is no such GOP and this PDU does not match the
459 _Start_ criteria of a _Gop_ declaration for the PDU type, the PDU will remain
460 unassigned and only the analysis phase will be done.
463 Gop ftp_ses On ftp_pdu Match (addr, addr, port, port) {...};
464 Gop dns_req On dns_pdu Match (addr, addr, dns_id) {...};
465 Gop isup_leg On isup_pdu Match (m3pc, m3pc, cic) {...};
470 If there was a match, the candidate key will be used to search the index of GOPs
471 to see if there is already a GOP matching the GOP's key the same way. If there
472 is such a match in the GOPs collection, and the PDU doesn't match the _Start_
473 AVPL for its type, the PDU will be assigned to the matching GOP. If it is a
474 _Start_ match, MATE will check whether or not that GOP has been already
475 stopped. If the GOP has been stopped, a new GOP will be created and will replace
476 the old one in the index of GOPs.
479 Gop ftp_ses On ftp_pdu Match (addr, addr, port, port) {
480 Start (ftp_cmd=USER);
483 Gop dns_req On dns_pdu Match (addr, addr, dns_id) {
484 Start (dns_resp="True");
487 Gop isup_leg On isup_pdu Match (m3pc, m3pc, cic) {
492 If no _Start_ is given for a GOP, a PDU whose AVPL matches an existing GOP's
493 key will act as the start of a GOP.
495 ===== What goes into the GOP's AVPL
497 Once we know a GOP exists and the PDU has been assigned to it, MATE will copy
498 into the GOP's AVPL all the attributes matching the key plus any AVPs of the
499 PDU's AVPL matching the _Extra_ AVPL.
502 Gop ftp_ses On ftp_pdu Match (addr, addr, port, port) {
503 Start (ftp_cmd=USER);
504 Extra (pasv_prt, pasv_addr);
507 Gop isup_leg On isup_pdu Match (m3pc, m3pc, cic) {
509 Extra (calling, called);
515 Once the PDU has been assigned to the GOP, MATE will check whether or not the
516 PDU matches the _Stop_, if it happens, MATE will mark the GOP as stopped. Even
517 after stopped, a GOP may get assigned new PDUs matching its key, unless such
518 PDU matches _Start_. If it does, MATE will instead create a new GOP starting
522 Gop ftp_ses On ftp_pdu Match (addr, addr, port, port) {
523 Start (ftp_cmd=USER);
524 Stop (ftp_cmd=QUIT); // The response to the QUIT command will be assigned to the same GOP
525 Extra (pasv_prt, pasv_addr);
528 Gop dns_req On dns_pdu Match (addr, addr, dns_id) {
529 Start (dns_resp="False");
530 Stop (dns_resp="True");
533 Gop isup_leg On isup_pdu Match (m3pc, m3pc, cic) {
534 Start (isup_msg=1); // IAM
535 Stop (isup_msg=16); // RLC
536 Extra (calling, called);
540 If no _Stop_ criterium is stated for a given GOP, the GOP will be stopped as
541 soon as it is created. However, as with any other GOP, PDUs matching the GOP's
542 key will still be assigned to the GOP unless they match a _Start_ condition,
543 in which case a new GOP using the same key will be created. To group multiple
544 PDUs that match the _Start_, add a bogus _Stop_ such as
546 Gop frame_ses On frame_pdu Match (frame_time) {
548 Stop (frame_time="FOO");
554 For every frame containing a PDU that belongs to a GOP, MATE will create a tree
557 The example below represents the tree created by the _dns_pdu_ and _dns_req_
562 MATE dns_pdu:6->dns_req:1
564 dns_pdu time: 2.103063
565 dns_pdu time since beginning of Gop: 2.103063
572 GOP Key: addr=10.194.4.11; addr=10.194.24.35; dns_id=0x8cac;
578 dns_req start time: 0.000000
579 dns_req hold time: 2.103063
580 dns_req duration: 2.103063
581 dns_req number of PDUs: 2
582 Start PDU: in frame 1
583 Stop PDU: in frame 6 (2.103063 : 2.103063)
587 Other than the PDU's tree, this one contains information regarding the
588 relationship between the PDUs that belong to the GOP. That way we have:
590 * mate.dns_req which contains the id of this dns_req GOP. This will be present
591 in frames that belong to dns_req GOPs.
592 * mate.dns_req.dns_id and mate.dns_req.addr which represent the values of the
593 attributes copied into the GOP.
594 * the timers of the GOP
595 ** mate.dns_req.StartTime time (in seconds) passed since beginning of capture
597 ** mate.dns_req.Time time passed between the start PDU and the stop PDU assigned
598 to this GOP (only created if a Stop criterion has been declared for the GOP and
599 a matching PDU has arrived).
600 ** mate.dns_req.Duration time passed between the start PDU and the last PDU
601 assigned to this GOP.
602 * mate.dns_req.NumOfPdus the number of PDUs that belong to this GOP
603 ** mate.dns_req.Pdu a filterable list of frame numbers of the PDUs of this GOP
607 Note that there are two "timers" for a GOP:
609 * *Time*, which is defined only for GOPs that have been Stopped, and gives the
610 time passed between the _Start_ and the _Stop_ PDUs.
611 * *Duration*, which is defined for every GOP regardless of its state, and give
612 the time passed between its _Start_ PDU and the last PDU that was assigned to
617 * we can filter for PDUs that belong to GOPs that have been Stopped with
619 * we can filter for PDUs that belong to unstopped GOPs with *mate.xxx &&
621 * we can filter for PDUs that belong to stopped GOPs using *mate.xxx.Duration*
622 * we can filter for PDUs that belong to GOPs that have taken more (or less) time
623 that 0.5s to complete with *mate.xxx.Time > 0.5* (you can try these also as
624 color filters to find out when response times start to grow)
626 ==== Grouping GOPs together (GOG) (Phase 3)
628 When GOPs are created, or whenever their AVPL changes, GOPs are (re)analyzed to
629 check if they match an existent group of groups (GOG) or can create a new one.
630 The GOP analysis is divided into two phases. In the first phase, the still
631 unassigned GOP is checked to verify whether it belongs to an already existing
632 GOG or may create a new one. The second phase eventually checks the GOG and
633 registers its keys in the index of GOGs.
635 .Grouping GOPs (GOG) flowchart
636 image::images/ws-mate-gop_analysis.png[]
638 There are several reasons for the author to believe that this feature needs to
639 be reimplemented, so probably there will be deep changes in the way this is done
640 in the near future. This section of the documentation reflects the version of
641 MATE as of Wireshark 0.10.9; in future releases this will change.
643 ===== Declaring a Group Of Groups (GOG)
645 The first thing we have to do configuring a GOG is to tell MATE that it exists.
653 ===== Telling MATE what could be a GOG member
655 Then we have to tell MATE what to look for a match in the candidate GOPs.
659 Member http_ses (host);
660 Member dns_req (host);
664 ===== Getting interesting data into the GOG
666 Most often, also other attributes than those used for matching would be
667 interesting. In order to copy from GOP to GOG other interesting attributes, we
668 might use _Extra_ like we do for GOPs.
680 mate http_pdu:4->http_req:2->http_use:1
682 http_pdu time: 1.309847
683 http_pdu time since beginning of Gop: 0.218930
685 ... (the gop's tree for http_req: 2) ..
688 host: www.example.com
690 http_use start time: 0.000000
691 http_use duration: 1.309847
694 ... (the gop's tree for dns_req: 1) ..
696 ... (the gop's tree for http_req: 1) ..
697 http_req of current frame: 2
702 * the timers of the GOG
703 ** *mate.http_use.StartTime* time (in seconds) passed since beginning of capture until GOG's start.
704 ** *mate.http_use.Duration* time elapsed between the first frame of a GOG and the last one assigned to it.
705 * the attributes passed to the GOG
706 ** *mate.http_use.host*
707 * *mate.http_use.NumOfGops* the number of GOPs that belong to this GOG
708 * *mate.http_use.GopStart* the start frame of a GOP
709 * *mate.http_use.GopStop* the stop frame of a GOP
711 ==== Adjust data (AVPL Transforms)
713 A Transform is a sequence of Match rules optionally completed with modification
714 of the match result by an additional AVPL. Such modification may be an Insert
715 (merge) or a Replace. Transforms can be used as helpers to manipulate an item's
716 AVPL before it is processed further. They come to be very helpful in several
721 AVPL Transforms are declared in the following way:
725 Match [Strict|Every|Loose] match_avpl [Insert|Replace] modify_avpl;
730 The *name* is the handle to the AVPL transform. It is used to refer to the
731 transform when invoking it later.
733 The _Match_ declarations instruct MATE what and how to match against the data
734 AVPL and how to modify the data AVPL if the match succeeds. They will be
735 executed in the order they appear in the config file whenever they are invoked.
737 The optional match type qualifier (_Strict_, _Every_, or _Loose_) is used
738 to choose the <<Match,Match type>>; _Strict_ is the default value which
741 The optional modification mode qualifier instructs MATE how the modify AVPL
744 * the default value _Insert_ (which may be omitted) causes the _modify_avpl_
745 to be *merged* to the existing data AVPL,
746 * _Replace_ causes all the matching AVPs from the data AVPL to be
747 *replaced* by the _modify_avpl_.
749 The _modify_avpl_ may be an empty one; this comes useful in some cases for
750 both _Insert_ and _Replace_ modification modes.
753 Transform rm_client_from_http_resp1 {
754 Match (http_rq); //first match wins so the request won't get the not_rq attribute inserted
755 Match Every (addr) Insert (not_rq); //this line won't be evaluated if the first one matched so not_rq won't be inserted to requests
758 Transform rm_client_from_http_resp2 {
759 Match (not_rq, client) Replace (); //replace "client and not_rq" with nothing
766 Transform insert_name_and {
767 Match Strict (host=10.10.10.10, port=2345) Insert (name=JohnDoe);
771 adds name=JohnDoe to the data AVPL if it contains host=10.10.10.10 *and*
775 Transform insert_name_or {
776 Match Loose (host=10.10.10.10, port=2345) Insert (name=JohnDoe);
780 adds name=JohnDoe to the data AVPL if it contains host=10.10.10.10 *or*
784 Transform replace_ip_address {
785 Match (host=10.10.10.10) Replace (host=192.168.10.10);
789 replaces the original host=10.10.10.10 by host=192.168.10.10
792 Transform add_ip_address {
793 Match (host=10.10.10.10) (host=192.168.10.10);
797 adds (inserts) host=192.168.10.10 to the AVPL, keeping the original
798 host=10.10.10.10 in it too
801 Transform replace_may_be_surprising {
802 Match Loose (a=aaaa, b=bbbb) Replace (c=cccc, d=dddd);
806 gives the following results:
808 * (a=aaaa, b=eeee) gets transformed to (b=eeee, c=cccc, d=dddd) because a=aaaa
809 did match so it got replaced while b=eeee did not match so it has been left
811 * (a=aaaa, b=bbbb) gets transformed to (c=cccc, d=dddd) because both a=aaaa and
816 Once declared, Transforms can be added to the declarations of PDUs, GOPs or
817 GOGs. This is done by adding the _Transform name_list_ statement to the
821 Pdu my_proto_pdu Proto my_proto Transport ip {
822 Extract addr From ip.addr;
824 Transform my_pdu_transform[, other_pdu_transform[, yet_another_pdu_transform]];
828 * In case of PDU, the list of transforms is applied against the PDU's AVPL
830 * In case of GOP and GOG, the list of transforms is applied against their
831 respective AVPLs when they are created and every time they change.
835 .Applying Transform flowchart
836 image::images/ws-mate-transform.png[]
838 * A list of previously declared Transforms may be given to every Item (_Pdu_, _Gop_,
839 or _Gog_), using the _Transform_ statement.
840 * Every time the AVPL of an item changes, it will be operated against *all* the
841 Transforms on the list given to that item. The Transforms on the list are
842 applied left to right.
843 * Inside each of the Transforms, the item's AVPL will be operated against the
844 Transform's Match clauses starting from the topmost one, until all have been
845 tried or until one of them succeeds.
847 MATE's Transforms can be used for many different things, like:
849 ===== Multiple Start/Stop conditions for a GOP
851 Using _Transforms_ we can add more than one start or stop condition to a GOP.
854 Transform start_cond {
855 Match (attr1=aaa,attr2=bbb) (msg_type=start);
856 Match (attr3=www,attr2=bbb) (msg_type=start);
857 Match (attr5^a) (msg_type=stop);
858 Match (attr6$z) (msg_type=stop);
863 Transform start_cond;
867 Start (msg_type=start);
868 Stop (msg_type=stop);
873 ===== Marking GOPs and GOGs to filter them easily
877 Match (addr=10.10.10.10, user=john) (john_at_host);
878 Match (addr=10.10.10.10, user=tom) (tom_at_host);
889 After that we can use a display filter *mate.my_gop.john_at_host* or
890 *mate.my_gop.tom_at_host*
892 ===== Adding (Insert) direction knowledge to MATE
895 Transform direction_as_text {
896 Match (src=192.168.0.2, dst=192.168.0.3) Insert (direction=from_2_to_3);
897 Match (src=192.168.0.3, dst=192.168.0.2) Insert (direction=from_3_to_2);
900 Pdu my_pdu Proto my_proto Transport tcp/ip {
901 Extract src From ip.src;
902 Extract dst From ip.dst;
903 Extract addr From ip.addr;
904 Extract port From tcp.port;
905 Extract start From tcp.flags.syn;
906 Extract stop From tcp.flags.fin;
907 Extract stop From tcp.flags.rst;
908 Transform direction_as_text;
911 Gop my_gop On my_pdu Match (addr,addr,port,port) {
917 The original example (below) would delete _src_ and _dst_ then add _direction_.
919 Transform direction_as_text {
920 Match (src=192.168.0.2, dst=192.168.0.3) Replace (direction=from_2_to_3);
921 Match (src=192.168.0.3, dst=192.168.0.2) Replace (direction=from_3_to_2);
927 NAT can create problems when tracing, but we can easily work around it by
928 Transforming the NATed IP address and the Ethernet address of the router into
933 Match (addr=192.168.0.5, ether=01:02:03:04:05:06) Replace (addr=123.45.67.89);
934 Match (addr=192.168.0.6, ether=01:02:03:04:05:06) Replace (addr=123.45.67.90);
935 Match (addr=192.168.0.7, ether=01:02:03:04:05:06) Replace (addr=123.45.67.91);
938 Pdu my_pdu Proto my_proto transport tcp/ip/eth {
939 Extract ether From eth.addr;
940 Extract addr From ip.addr;
941 Extract port From tcp.port;
946 [#ChMateConfigurationTutorial]
948 === MATE's configuration tutorial
950 We'll show a MATE configuration that first creates GOPs for every DNS and HTTP
951 request, then it ties the GOPs together in a GOG based on the host. Finally,
952 we'll separate into different GOGs request coming from different users.
954 With this MATE configuration loaded we can:
956 * use *mate.http_use.Duration > 5.5* to filter frames based on the time it takes
957 to load a complete page from the DNS request to resolve its name until the last
959 * use *mate.http_use.client == "10.10.10.20" && mate.http_use.host == "www.example.com"*
960 to isolate DNS and HTTP packets related to a visit of a certain user.
961 * use *mate.http_req.Duration > 1.5* to filter all the packets of HTTP requests
962 that take more than 1.5 seconds to complete.
964 The complete config file is available on the Wireshark Wiki:
965 {wireshark-wiki-url}Mate/Tutorial
967 Note: This example uses _dns.qry.name_ which is defined since Wireshark
968 version 0.10.9. Supposing you have a MATE plugin already installed you can test
969 it with the current Wireshark version.
971 ==== A GOP for DNS requests
973 First we'll tell MATE how to create a GOP for each DNS request/response.
975 MATE needs to know what makes a DNS PDU. We describe it using a _Pdu_
979 Pdu dns_pdu Proto dns Transport ip {
980 Extract addr From ip.addr;
981 Extract dns_id From dns.id;
982 Extract dns_resp From dns.flags.response;
986 Using _Proto dns_ we tell MATE to create PDUs every time it finds _dns_. Using
987 _Transport ip_ we inform MATE that some of the fields we are interested are
988 in the _ip_ part of the frame. Finally, we tell MATE to import _ip.addr_ as
989 _addr_, _dns.id_ as _dns_id_ and _dns.flags.response_ as _dns_resp_.
991 Once we've told MATE how to extract _dns_pdus_ we'll tell it how to match
992 requests and responses and group them into a GOP. For this we'll use a _Gop_
993 declaration to define the GOP, and then, _Start_ and _Stop_ statements to
994 tell it when the GOP starts and ends.
997 Gop dns_req On dns_pdu Match (addr,addr,dns_id) {
998 Start (dns_resp="False");
999 Stop (dns_resp="True");
1003 Using the *Gop* declaration we tell MATE that the *Name* of the GOP is _dns_req_,
1004 that _dns_pdus_s can become members of the GOP, and what is the key used to match
1005 the PDUs to the GOP.
1007 The key for this GOP is _"addr, addr, dns_id"_. That means that in order to
1008 belong to the same GOP, _dns_pdus_ have to have both addresses and the
1009 _request id_ identical. We then instruct MATE that a _dns_req_ starts whenever
1010 a _dns_pdu_ matches _"dns_resp=++"++False++"++"_ and that it stops when another _dns_pdu_
1011 matches _"dns_resp=++"++True++"++"_.
1013 At this point, if we open a capture file using this configuration, we are able
1014 to use a display filter *mate.dns_req.Time > 1* to see only the packets of
1015 DNS requests that take more than one second to complete.
1017 We can use a display filter *mate.dns_req && ! mate.dns_req.Time* to find
1018 requests for which no response was given. *mate.xxx.Time* is set only for GOPs
1019 that have being stopped.
1021 ==== A GOP for HTTP requests
1023 This other example creates a GOP for every HTTP request.
1026 Pdu http_pdu Proto http Transport tcp/ip {
1027 Extract addr From ip.addr;
1028 Extract port From tcp.port;
1029 Extract http_rq From http.request.method;
1030 Extract http_rs From http.response;
1031 DiscardPduData true;
1034 Gop http_req On http_pdu Match (addr, addr, port, port) {
1040 So, if we open a capture using this configuration
1042 * filtering with *mate.http_req.Time > 1* will give all the requests where the
1043 response header takes more than one second to come
1044 * filtering with *mate.http_req.Duration > 1.5* will show those request that
1045 take more than 1.5 seconds to complete.
1047 You have to know that *mate.xxx.Time* gives the time in seconds between the PDU
1048 matching the GOP *Start* clause and the PDU matching the GOP *Stop* clause (yes, you can create
1049 timers using this!). On the other hand, *mate.xxx.Duration* gives you the time
1050 passed between the GOP *Start* and the last PDU assigned to that GOP regardless
1051 whether it is a *Stop* or not. After the GOP *Stop*, PDUs matching the GOP's Key will
1052 still be assigned to the same GOP as far as they don't match the GOP *Start*, in
1053 which case a new GOP with the same key will be created.
1055 ==== Getting DNS and HTTP together into a GOG
1057 We'll tie together to a single GOG all the HTTP packets belonging to requests
1058 and responses to a certain host and the DNS request and response used to resolve
1059 its domain name using the _Pdu_ and _Gop_ definitions of the previous examples
1061 To be able to group DNS and HTTP requests together, we need to import into the
1062 PDUs and GOPs some part of information that both those protocols share. Once the
1063 PDUs and GOPs have been defined, we can use _Extract_ (for PDUs) and
1064 _Extract_ (for GOPs) statements to tell MATE what other protocol fields are to
1065 be added to PDU's and GOP's AVPLs. We add the following statements to the
1066 appropriate declarations:
1069 Extract host From http.host; // to Pdu http_pdu as the last Extract in the list
1070 Extra (host); // to Gop http_req after the Stop
1072 Extract host From dns.qry.name; // to Pdu dns_pdu as the last Extract in the list
1073 Extra (host); // to Gop dns_req after the Stop
1076 Here we've told MATE to import _http.host_ into _http_pdu_ and _dns.qry.name_
1077 into _dns_pdu_ as _host_. We also have to tell MATE to copy the _host_
1078 attribute from the PDUs to the GOPs - we do this using _Extra_.
1080 Once we have all the data we need in PDUs and GOPs, we tell MATE what makes
1081 different GOPs belong to a certain GOG.
1085 Member http_req (host);
1086 Member dns_req (host);
1091 Using the _Gog_ declaration, we tell MATE to define a GOG type named
1092 _http_use_ whose expiration is 0.75 seconds after all the GOPs that belong to it
1093 had been stopped. After that time, an eventual new GOP with the same key match
1094 will create a new GOG instead of been added to the previous GOG.
1096 Using the _Member_ statements, we tell MATE that *http_req*s with the same
1097 *host* belong to the same GOG, same thing for *dns_req*s.
1099 So far we have instructed MATE to group every packet related to sessions towards
1100 a certain host. At this point if we open a capture file and:
1102 * a display filter *mate.http_use.Duration > 5* will show only those requests
1103 that have taken more than 5 seconds to complete starting from the DNS request
1104 and ending with the last packet of the HTTP responses.
1106 * a display filter *mate.http_use.host == "www.w3c.org"* will show all the
1107 packets (both DNS and HTTP) related to the requests directed to www.w3c.org
1109 ==== Separating requests from multiple users
1111 "Houston: we've had a problem here."
1113 This configuration works fine if used for captures taken at the client's side
1114 but deeper in the network we'd got a real mess. Requests from many users get
1115 mixed together into _http_uses_. GOGs are created and stopped almost randomly
1116 (depending on the timing in which GOPs start and stop). How do we get requests
1117 from individual users separated from each other?
1119 MATE has a tool that can be used to resolve this kind of grouping issues. This
1120 tool are the _Transforms_. Once defined, they can be applied against PDUs,
1121 GOPs and GOGs and they might replace or insert more attributes based on what's
1122 there. We'll use them to create an attribute named *client*, using which we'll
1123 separate different requests.
1125 For DNS we need the ip.src of the request moved into the GOP only from the DNS
1128 So we first tell MATE to import ip.src as client:
1131 Extract client From ip.src;
1134 Next, we tell MATE to replace ( *dns_resp="True", client* ) with just *dns_resp="True"* in
1135 the PDU. That way, we'll keep the attribute *client* only in the DNS request
1136 PDUs (i.e., packets coming from the client).To do so, we have to add a
1137 _Transform_ declaration (in this case, with just one clause) before the _Pdu_
1138 declaration which uses it:
1141 Transform rm_client_from_dns_resp {
1142 Match (dns_resp="True", client) Replace (dns_resp="True");
1146 Next, we invoke the transform by adding the following line after the _Extract_
1147 list of the dns_pdu PDU:
1150 Transform rm_client_from_dns_resp;
1153 HTTP is a little trickier. We have to remove the attribute carrying ip.src from
1154 both the response and the "continuations" of the response, but as there is
1155 nothing to filter on for the continuations, we have to add a fake attribute
1156 first. And then we have to remove *client* when the fake attribute appears.
1157 This is possible due to the fact that the _Match_ clauses in the _Transform_
1158 are executed one by one until one of them succeeds. First, we declare another
1162 Transform rm_client_from_http_resp1 {
1163 Match (http_rq); //first match wins so the request won't get the not_rq attribute inserted
1164 Match Every (addr) Insert (not_rq); //this line won't be evaluated if the first one matched so not_rq won't be inserted to requests
1167 Transform rm_client_from_http_resp2 {
1168 Match (not_rq, client) Replace (); //replace "client and not_rq" with nothing (will happen only in the response and eventual parts of it)
1172 Next, we add another _Extract_ statement to the _http_pdu_ declaration, and
1173 apply both _Transforms_ declared above in a proper order:
1176 Extract client From ip.src;
1177 Transform rm_client_from_http_resp1, rm_client_from_http_resp2;
1180 In MATE, all the _Transform_s listed for an item will be evaluated, while
1181 inside a single _Transform_, the evaluation will stop at the first successful
1182 _Match_ clause. That's why we first just match _http_rq_ to get out of the
1183 first sequence before adding the _not_rq_ attribute. Then we apply the second
1184 _Transform_ which removes both _not_rq_ and _client_ if both are there. Yes,
1185 _Transform_s are cumbersome, but they are very useful.
1187 Once we got all what we need in the PDUs, we have to tell MATE to copy the
1188 attribute _client_ from the PDUs to the respective GOPs, by adding client to
1189 _Extra_ lists of both _Gop_ declarations:
1192 Extra (host, client);
1195 On top of that, we need to modify the old declarations of GOP key to new ones
1196 that include both _client_ and _host_. So we change the _Gog_ *Member*
1197 declarations the following way:
1200 Member http_req (host, client);
1201 Member dns_req (host, client);
1204 Now we got it, every "usage" gets its own GOG.
1206 [#ChMateConfigurationExamples]
1208 === MATE configuration examples
1210 The following is a collection of various configuration examples for MATE. Many
1211 of them are useless because the "conversations" facility does a better job.
1212 Anyway they are meant to help users understanding how to configure MATE.
1215 ==== TCP session (tcp.mate)
1217 The following example creates a GOP out of every TCP session.
1220 Transform add_tcp_stop {
1221 Match (tcp_flags_reset="True") Insert (tcp_stop="True");
1222 Match (tcp_flags_fin="True") Insert (tcp_stop="True");
1225 Pdu tcp_pdu Proto tcp Transport ip {
1226 Extract addr From ip.addr;
1227 Extract port From tcp.port;
1228 Extract tcp_start From tcp.flags.syn;
1229 Extract tcp_flags_reset From tcp.flags.reset;
1230 Extract tcp_flags_fin From tcp.flags.fin;
1231 Transform add_tcp_stop;
1234 Gop tcp_ses On tcp_pdu Match (addr, addr, port, port) {
1235 Start (tcp_start="True");
1236 Stop (tcp_stop="True");
1242 This probably would do fine in 99.9% of the cases but 10.0.0.1:20->10.0.0.2:22 and 10.0.0.1:22->10.0.0.2:20 would both fall into the same gop if they happen to overlap in time.
1244 * filtering with *mate.tcp_ses.Time > 1* will give all the sessions that last more than one second
1245 * filtering with *mate.tcp_ses.NumOfPdus < 5* will show all tcp sessions that have less than 5 packets.
1246 * filtering with *mate.tcp_ses.Id == 3* will show all the packets for the third tcp session MATE has found
1248 ==== a GOG for a complete FTP session
1250 This configuration allows to tie a complete passive FTP session (including the
1251 data transfer) in a single GOG.
1254 Pdu ftp_pdu Proto ftp Transport tcp/ip {
1255 Extract ftp_addr From ip.addr;
1256 Extract ftp_port From tcp.port;
1257 Extract ftp_resp From ftp.response.code;
1258 Extract ftp_req From ftp.request.command;
1259 Extract server_addr From ftp.passive.ip;
1260 Extract server_port From ftp.passive.port;
1265 Pdu ftp_data_pdu Proto ftp-data Transport tcp/ip{
1266 Extract server_addr From ip.src;
1267 Extract server_port From tcp.srcport;
1271 Gop ftp_data On ftp_data_pdu Match (server_addr, server_port) {
1272 Start (server_addr);
1275 Gop ftp_ctl On ftp_pdu Match (ftp_addr, ftp_addr, ftp_port, ftp_port) {
1276 Start (ftp_resp=220);
1277 Stop (ftp_resp=221);
1278 Extra (server_addr, server_port);
1282 Member ftp_ctl (ftp_addr, ftp_addr, ftp_port, ftp_port);
1283 Member ftp_data (server_addr, server_port);
1289 Note: not having anything to distinguish between ftp-data packets makes this
1290 config to create one GOP for every ftp-data packet instead of each transfer.
1291 Pre-started GOPs would avoid this.
1293 ==== using RADIUS to filter SMTP traffic of a specific user
1295 Spying on people, in addition to being immoral, is illegal in many countries.
1296 This is an example meant to explain how to do it not an invitation to do so.
1297 It's up to the police to do this kind of job when there is a good reason to do
1301 Pdu radius_pdu On radius Transport udp/ip {
1302 Extract addr From ip.addr;
1303 Extract port From udp.port;
1304 Extract radius_id From radius.id;
1305 Extract radius_code From radius.code;
1306 Extract user_ip From radius.framed_addr;
1307 Extract username From radius.username;
1310 Gop radius_req On radius_pdu (radius_id, addr, addr, port, port) {
1311 Start (radius_code {1|4|7} );
1312 Stop (radius_code {2|3|5|8|9} );
1313 Extra (user_ip, username);
1316 // we define the smtp traffic we want to filter
1317 Pdu user_smtp Proto smtp Transport tcp/ip {
1318 Extract user_ip From ip.addr;
1319 Extract smtp_port From tcp.port;
1320 Extract tcp_start From tcp.flags.syn;
1321 Extract tcp_stop From tcp.flags.reset;
1324 Gop user_smtp_ses On user_smtp (user_ip, user_ip, smtp_port!25) {
1325 Start (tcp_start=1);
1329 // with the following group of groups we'll group together the radius and the smtp
1330 // we set a long expiration to avoid the session expire on long pauses.
1333 Member radius_req (user_ip);
1334 Member user_smtp_ses (user_ip);
1341 Filtering the capture file with *mate.user_mail.username == "theuser"* will
1342 filter the RADIUS packets and SMTP traffic for _"theuser"_.
1346 This configuration will create a GOG out of every call.
1349 Pdu q931 Proto q931 Transport ip {
1350 Extract addr From ip.addr;
1351 Extract call_ref From q931.call_ref;
1352 Extract q931_msg From q931.message_type;
1353 Extract calling From q931.calling_party_number.digits;
1354 Extract called From q931.called_party_number.digits;
1355 Extract guid From h225.guid;
1356 Extract q931_cause From q931.cause_value;
1359 Gop q931_leg On q931 Match (addr, addr, call_ref) {
1362 Extra (calling, called, guid, q931_cause);
1365 Pdu ras Proto h225.RasMessage Transport ip {
1366 Extract addr From ip.addr;
1367 Extract ras_sn From h225.requestSeqNum;
1368 Extract ras_msg From h225.RasMessage;
1369 Extract guid From h225.guid;
1372 Gop ras_req On ras Match (addr, addr, ras_sn) {
1373 Start (ras_msg {0|3|6|9|12|15|18|21|26|30} );
1374 Stop (ras_msg {1|2|4|5|7|8|10|11|13|14|16|17|19|20|22|24|27|28|29|31});
1379 Member ras_req (guid);
1380 Member q931_leg (guid);
1381 Extra (called,calling,q931_cause);
1389 * filter all signalling for a specific caller: *mate.call.caller == "123456789"*
1390 * filter all signalling for calls with a specific release cause: *mate.call.q931_cause == 31*
1391 * filter all signalling for very short calls: *mate.q931_leg.Time < 5*
1395 With this example, all the components of an MMS send or receive will be tied
1396 into a single GOG. Note that this example uses the _Payload_ clause because
1397 MMS delivery uses MMSE over either HTTP or WSP. As it is not possible to relate
1398 the retrieve request to a response by the means of MMSE only (the request is
1399 just an HTTP GET without any MMSE), a GOP is made of HTTP PDUs but MMSE data
1400 need to be extracted from the bodies.
1403 ## WARNING: this example has been blindly translated from the "old" MATE syntax
1404 ## and it has been verified that Wireshark accepts it. However, it has not been
1405 ## tested against any capture file due to lack of the latter.
1407 Transform rm_client_from_http_resp1 {
1409 Match Every (addr) Insert (not_rq);
1412 Transform rm_client_from_http_resp2 {
1413 Match (not_rq,ue) Replace ();
1416 Pdu mmse_over_http_pdu Proto http Transport tcp/ip {
1418 Extract addr From ip.addr;
1419 Extract port From tcp.port;
1420 Extract http_rq From http.request;
1421 Extract content From http.content_type;
1422 Extract resp From http.response.code;
1423 Extract method From http.request.method;
1424 Extract host From http.host;
1425 Extract content From http.content_type;
1426 Extract trx From mmse.transaction_id;
1427 Extract msg_type From mmse.message_type;
1428 Extract notify_status From mmse.status;
1429 Extract send_status From mmse.response_status;
1430 Transform rm_client_from_http_resp1, rm_client_from_http_resp2;
1433 Gop mmse_over_http On mmse_over_http_pdu Match (addr, addr, port, port) {
1436 Extra (host, ue, resp, notify_status, send_status, trx);
1439 Transform mms_start {
1440 Match Loose() Insert (mms_start);
1443 Pdu mmse_over_wsp_pdu Proto wsp Transport ip {
1445 Extract trx From mmse.transaction_id;
1446 Extract msg_type From mmse.message_type;
1447 Extract notify_status From mmse.status;
1448 Extract send_status From mmse.response_status;
1449 Transform mms_start;
1452 Gop mmse_over_wsp On mmse_over_wsp_pdu Match (trx) {
1455 Extra (ue, notify_status, send_status);
1459 Member mmse_over_http (trx);
1460 Member mmse_over_wsp (trx);
1461 Extra (ue, notify_status, send_status, resp, host, trx);
1466 [#ChMateConfigurationLibrary]
1468 === MATE's configuration library
1470 The MATE library (will) contains GOP definitions for several protocols. Library
1471 protocols are included in your MATE config using: +_Action=Include;
1474 For Every protocol with a library entry, we'll find defined what from the PDU is
1475 needed to create a GOP for that protocol, eventually any criteria and the very
1476 essential GOP definition (i.e., __Gop__, _Start_ and _Stop_).
1480 It seems that this code is written in the old syntax of MATE. So far it has not
1481 been transcribed into the new format. It may still form the basis to recreate
1482 these in the new format.
1485 ==== General use protocols
1489 It will create a GOP for every TCP session. If it is used it should be the last
1490 one in the list. And every other proto on top of TCP should be declared with
1491 _LastPdu=TRUE;_ so that a TCP PDU is not created where another pdu type exists.
1494 Transform add_tcp_stop {
1495 Match (tcp_flags_reset="True") Insert (tcp_stop="True");
1496 Match (tcp_flags_fin="True") Insert (tcp_stop="True");
1499 Pdu tcp_pdu Proto tcp Transport ip {
1500 Extract addr From ip.addr;
1501 Extract port From tcp.port;
1502 Extract tcp_start From tcp.flags.syn;
1503 Extract tcp_flags_reset From tcp.flags.reset;
1504 Extract tcp_flags_fin From tcp.flags.fin;
1505 Transform add_tcp_stop;
1508 Gop tcp_ses On tcp_pdu Match (addr, addr, port, port) {
1509 Start (tcp_start="True");
1510 Stop (tcp_stop="True");
1518 will create a GOP containing every request and its response (eventually
1519 retransmissions too).
1522 Action=PduDef; Name=dns_pdu; Proto=dns; Transport=udp/ip; addr=ip.addr; port=udp.port; dns_id=dns.id; dns_rsp=dns.flags.response;
1524 Action=GopDef; Name=dns_req; On=dns_pdu; addr; addr; port!53; dns_id;
1525 Action=GopStart; For=dns_req; dns_rsp=0;
1526 Action=GopStop; For=dns_req; dns_rsp=1;
1531 A GOP for every transaction.
1534 Action=PduDef; Name=radius_pdu; Proto=radius; Transport=udp/ip; addr=ip.addr; port=udp.port; radius_id=radius.id; radius_code=radius.code;
1536 Action=GopDef; Name=radius_req; On=radius_pdu; radius_id; addr; addr; port; port;
1537 Action=GopStart; For=radius_req; radius_code|1|4|7;
1538 Action=GopStop; For=radius_req; radius_code|2|3|5|8|9;
1544 Action=PduDef; Name=rtsp_pdu; Proto=rtsp; Transport=tcp/ip; addr=ip.addr; port=tcp.port; rtsp_method=rtsp.method;
1545 Action=PduExtra; For=rtsp_pdu; rtsp_ses=rtsp.session; rtsp_url=rtsp.url;
1547 Action=GopDef; Name=rtsp_ses; On=rtsp_pdu; addr; addr; port; port;
1548 Action=GopStart; For=rtsp_ses; rtsp_method=DESCRIBE;
1549 Action=GopStop; For=rtsp_ses; rtsp_method=TEARDOWN;
1550 Action=GopExtra; For=rtsp_ses; rtsp_ses; rtsp_url;
1555 Most protocol definitions here will create one GOP for every Call Leg unless
1561 Action=PduDef; Name=isup_pdu; Proto=isup; Transport=mtp3; mtp3pc=mtp3.dpc; mtp3pc=mtp3.opc; cic=isup.cic; isup_msg=isup.message_type;
1563 Action=GopDef; Name=isup_leg; On=isup_pdu; ShowPduTree=TRUE; mtp3pc; mtp3pc; cic;
1564 Action=GopStart; For=isup_leg; isup_msg=1;
1565 Action=GopStop; For=isup_leg; isup_msg=16;
1571 Action=PduDef; Name=q931_pdu; Proto=q931; Stop=TRUE; Transport=tcp/ip; addr=ip.addr; call_ref=q931.call_ref; q931_msg=q931.message_type;
1573 Action=GopDef; Name=q931_leg; On=q931_pdu; addr; addr; call_ref;
1574 Action=GopStart; For=q931_leg; q931_msg=5;
1575 Action=GopStop; For=q931_leg; q931_msg=90;
1581 Action=PduDef; Name=ras_pdu; Proto=h225.RasMessage; Transport=udp/ip; addr=ip.addr; ras_sn=h225.RequestSeqNum; ras_msg=h225.RasMessage;
1582 Action=PduExtra; For=ras_pdu; guid=h225.guid;
1584 Action=GopDef; Name=ras_leg; On=ras_pdu; addr; addr; ras_sn;
1585 Action=GopStart; For=ras_leg; ras_msg|0|3|6|9|12|15|18|21|26|30;
1586 Action=GopStop; For=ras_leg; ras_msg|1|2|4|5|7|8|10|11|13|14|16|17|19|20|22|24|27|28|29|31;
1587 Action=GopExtra; For=ras_leg; guid;
1593 Action=PduDef; Proto=sip_pdu; Transport=tcp/ip; addr=ip.addr; port=tcp.port; sip_method=sip.Method; sip_callid=sip.Call-ID; calling=sdp.owner.username;
1595 Action=GopDef; Name=sip_leg; On=sip_pdu; addr; addr; port; port;
1596 Action=GopStart; For=sip; sip_method=INVITE;
1597 Action=GopStop; For=sip; sip_method=BYE;
1602 Will create a GOP out of every transaction.
1604 To "tie" them to your call's GoG use: _Action=GogKey; Name=your_call; On=mgc_tr;
1605 addr!mgc_addr; megaco_ctx;_
1608 Action=PduDef; Name=mgc_pdu; Proto=megaco; Transport=ip; addr=ip.addr; megaco_ctx=megaco.context; megaco_trx=megaco.transid; megaco_msg=megaco.transaction; term=megaco.termid;
1610 Action=GopDef; Name=mgc_tr; On=mgc_pdu; addr; addr; megaco_trx;
1611 Action=GopStart; For=mgc_tr; megaco_msg|Request|Notify;
1612 Action=GopStop; For=mgc_tr; megaco_msg=Reply;
1613 Action=GopExtra; For=mgc_tr; term^DS1; megaco_ctx!Choose one;
1616 [#ChMateReferenceManual]
1618 === MATE's reference manual
1620 ==== Attribute Value Pairs (AVP)
1622 MATE uses AVPs for almost everything: to keep the data it has extracted from the
1623 frames' trees as well as to keep the elements of the configuration.
1625 These "pairs" (actually tuples) are made of a name, a value and, in case of
1626 configuration AVPs, an operator. Names and values are strings. AVPs with
1627 operators other than '=' are used only in the configuration and are used for
1628 matching AVPs of PDUs, GOPs and GOGs in the analysis phase.
1632 The name is a string used to refer to a type of AVP. Two attributes won't
1633 match unless their names are identical. Capitalized names are reserved for
1634 keywords (you can use them for your elements if you want but I think it's not
1635 the case). MATE attribute names can be used in Wireshark's display filters the
1636 same way like names of protocol fields provided by dissectors, but they are not
1637 just references to (or aliases of) protocol fields.
1641 The value is a string. It is either set in the configuration (for configuration
1642 AVPs) or by MATE while extracting interesting fields from a dissection tree
1643 and/or manipulating them later. The values extracted from fields use the same
1644 representation as they do in filter strings.
1646 ==== AVP Operators (=,!,{},^,$,~,<,>,?)
1648 Currently only match operators are defined (there are plans to (re)add transform
1649 attributes but some internal issues have to be solved before that). The match
1650 operations are always performed between two operands: the value of an AVP stated
1651 in the configuration and the value of an AVP (or several AVPs with the same name)
1652 extracted from packet data (called "data AVPs"). It is not possible to match
1653 data AVPs to each other.
1655 The defined match operators are:
1657 * <<Equal,Equal>> _=_ test for equality, that is: either the value strings are identical
1658 or the match will fail.
1659 * <<NotEqual,Not Equal>> _!_ will match only if the value strings aren't equal.
1660 * <<OneOf,One Of>> _{}_ will match if one of the value strings listed is equal to the
1661 data AVP's string. Items inside the list's curly braces are
1662 separated with the | character.
1663 * <<StartsWith,Starts With>> _^_ will match if the configuration value string matches the
1664 first characters of the data AVP's value string.
1665 * <<EndsWith,Ends With>> _$_ will match if the configuration value string matches the
1666 last characters of the data AVP's value string.
1667 * <<Contains,Contains>> _~_ will match if the configuration value string matches a
1668 substring of the characters of the data AVP's value string.
1669 * <<LowerThan,Lower Than>> _<_ will match if the data AVP's value string is semantically
1670 lower than the configuration value string.
1671 * <<HigherThan,Higher Than>> _>_ will match if the data AVP's value string is semantically
1672 higher than the configuration value string.
1673 * <<Exists,Exists>> _?_ (can be omitted) will match if the AVP name matches, regardless
1674 what the value string is.
1677 ===== Equal AVP Operator (=)
1679 This operator tests whether the values of the operator and the operand AVP are
1683 attrib=aaa *matches* attrib=aaa +
1684 attrib=aaa *does not match* attrib=bbb
1687 ===== Not equal AVP operator (!)
1689 This operator matches if the value strings of two AVPs are not equal.
1692 attrib=aaa matches attrib!bbb +
1693 attrib=aaa does not match attrib!aaa
1696 ===== "One of" AVP operator ({})
1698 The "one of" operator matches if the data AVP value is equal to one of the
1699 values listed in the "one of" AVP.
1702 attrib=1 matches attrib{1|2|3} +
1703 attrib=2 matches attrib{1|2|3} +
1704 attrib=4 does not match attrib{1|2|3}
1707 ===== "Starts with" AVP operator (^)
1709 The "starts with" operator matches if the first characters of the data AVP
1710 value are identical to the configuration AVP value.
1713 attrib=abcd matches attrib^abc +
1714 attrib=abc matches attrib^abc +
1715 attrib=ab does not match attrib^abc +
1716 attrib=abcd does not match attrib^bcd +
1717 attrib=abc does not match attrib^abcd +
1720 ===== "Ends with" operator ($)
1722 The ends with operator will match if the last bytes of the data AVP value are
1723 equal to the configuration AVP value.
1726 attrib=wxyz matches attrib$xyz +
1727 attrib=yz does not match attrib$xyz +
1728 attrib=abc...wxyz does not match attrib$abc
1731 ===== Contains operator (~)
1733 The "contains" operator will match if the data AVP value contains a string
1734 identical to the configuration AVP value.
1737 attrib=abcde matches attrib~bcd +
1738 attrib=abcde matches attrib~abc +
1739 attrib=abcde matches attrib~cde +
1740 attrib=abcde does not match attrib~xyz
1743 ===== "Lower than" operator (<)
1745 The "lower than" operator will match if the data AVP value is semantically lower
1746 than the configuration AVP value.
1749 attrib=abc matches attrib<bcd +
1750 attrib=1 matches attrib<2 +
1751 but beware: attrib=10 does not match attrib<9 +
1752 attrib=bcd does not match attrib<abc +
1753 attrib=bcd does not match attrib<bcd +
1757 It should check whether the values are numbers and compare them numerically
1760 ===== "Higher than" operator (>)
1762 The "higher than" operator will match if the data AVP value is semantically
1763 higher than the configuration AVP value.
1767 attrib=bcd matches attrib>abc +
1768 attrib=3 matches attrib>2 +
1769 but beware: attrib=9 does not match attrib>10 +
1770 attrib=abc does not match attrib>bcd +
1771 attrib=abc does not match attrib>abc +
1775 It should check whether the values are numbers and compare them numerically
1778 ===== Exists operator (?)
1780 The exists operator will always match as far as the two operands have the same
1785 attrib=abc matches attrib? +
1786 attrib=abc matches attrib (this is just an alternative notation of the previous example) +
1787 obviously attrib=abc does not match other_attrib? +
1789 ==== Attribute Value Pair List (AVPL)
1790 PDUs, GOPs and GOGs use an AVPL to contain the tracing information. An AVPL is
1791 an unsorted set of <<AVP,AVPs>> that can be matched against other AVPLs.
1794 ==== Operations between AVPLs (Match)
1796 There are three types of match operations that can be performed between AVPLs.
1797 The PDU's/GOP's/GOG's AVPL will be always one of the operands; the AVPL operator
1798 (match type) and the second operand AVPL will always come from the
1799 <<Config,configuration>>.
1800 Note that a diverse AVP match operator may be specified for each AVP in the
1803 An AVPL match operation returns a result AVPL. In <<Transform,Transform>>s, the
1804 result AVPL may be replaced by another AVPL. The replacement means that the
1805 existing data AVPs are dropped and the replacement AVPL from the
1806 <<Config,configuration>> is <<Merge,Merged>> to the data AVPL of the
1809 * <<Loose,Loose Match>>: Will match if at least one of the AVPs of the two
1810 operand AVPLs match. If it matches, it returns a result AVPL containing all AVPs
1811 from the data AVPL that did match the configuration's AVPs.
1812 * <<Every,"Every" Match>>: Will match if none of the AVPs of the configuration
1813 AVPL fails to match an AVP in the data AVPL, even if not all of the
1814 configuration AVPs have a match. If it matches, it returns a result AVPL
1815 containing all AVPs from the data AVPL that did match an AVP in the
1817 * <<Strict,Strict Match>>: Will match if and only if each of the AVPs in the
1818 configuration AVPL has at least one match in the data AVPL. If it matches, it
1819 returns a result AVPL containing those AVPs from the data AVPL that matched.
1824 A loose match between AVPLs succeeds if at least one of the data AVPs matches at
1825 least one of the configuration AVPs. Its result AVPL contains all the data AVPs
1828 Loose matches are used in Extra operations against the <<Pdu,PDU>>'s AVPL to
1829 merge the result into <<Gop,GOP>>'s AVPL, and against <<Gop,GOP>>'s AVPL to
1830 merge the result into <<Gog,GOG>>'s AVPL. They may also be used in
1831 <<Criteria,Criteria>> and <<Transform,Transform>>s.
1835 As of current (2.0.1), Loose Match does not work as described here, see
1836 https://gitlab.com/wireshark/wireshark/issues/12184[issue 12184]. Only use
1837 in Transforms and Criteria is effectively affected by the bug.
1840 Loose Match Examples
1842 (attr_a=aaa, attr_b=bbb, attr_c=xxx) Match Loose (attr_a?, attr_c?) ==> (attr_a=aaa, attr_c=xxx)
1844 (attr_a=aaa, attr_b=bbb, attr_c=xxx) Match Loose (attr_a?, attr_c=ccc) ==> (attr_a=aaa)
1846 (attr_a=aaa, attr_b=bbb, attr_c=xxx) Match Loose (attr_a=xxx; attr_c=ccc) ==> No Match!
1851 An "every" match between AVPLs succeeds if none of the configuration's AVPs that
1852 have a counterpart in the data AVPL fails to match. Its result AVPL contains all
1853 the data AVPs that matched.
1855 These may only be used in <<Criteria,Criteria>> and <<Transform,Transform>>s.
1859 As of current (2.0.1), Loose Match does not work as described here, see
1860 https://gitlab.com/wireshark/wireshark/-/issues/12184[issue 12184].
1863 "Every" Match Examples
1865 (attr_a=aaa, attr_b=bbb, attr_c=xxx) Match Every (attr_a?, attr_c?) ==> (attr_a=aaa, attr_c=xxx)
1867 (attr_a=aaa, attr_b=bbb, attr_c=xxx) Match Every (attr_a?, attr_c?, attr_d=ddd) ==> (attr_a=aaa, attr_c=xxx)
1869 (attr_a=aaa, attr_b=bbb, attr_c=xxx) Match Every (attr_a?, attr_c=ccc) ==> No Match!
1871 (attr_a=aaa; attr_b=bbb; attr_c=xxx) Match Every (attr_a=xxx, attr_c=ccc) ==> No Match!
1876 A Strict match between AVPLs succeeds if and only if every AVP in the
1877 configuration AVPL has at least one counterpart in the data AVPL and none of the
1878 AVP matches fails. The result AVPL contains all the data AVPs that matched.
1880 These are used between GOP keys (key AVPLs) and PDU AVPLs. They may also be used
1881 in <<Criteria,Criteria>> and <<Transform,Transform>>s.
1885 (attr_a=aaa, attr_b=bbb, attr_c=xxx) Match Strict (attr_a?, attr_c=xxx) ==> (attr_a=aaa, attr_c=xxx)
1887 (attr_a=aaa, attr_b=bbb, attr_c=xxx, attr_c=yyy) Match Strict (attr_a?, attr_c?) ==> (attr_a=aaa, attr_c=xxx, attr_c=yyy)
1889 (attr_a=aaa, attr_b=bbb, attr_c=xxx) Match Strict (attr_a?, attr_c=ccc) ==> No Match!
1891 (attr_a=aaa, attr_b=bbb, attr_c=xxx) Match Strict (attr_a?, attr_c?, attr_d?) ==> No Match!
1896 An AVPL may be merged into another one. That would add to the latter every AVP
1897 from the former that does not already exist there.
1899 This operation is done
1901 * between the result of a key match and the GOP's or GOG's AVPL,
1902 * between the result of an Extra match and the GOP's or GOG's AVPL,
1903 * between the result of a <<Transform,Transform>> match and PDU's/GOP's AVPL. If
1904 the operation specified by the Match clause is Replace, the result AVPL of the
1905 match is removed from the item's AVPL before the modify_avpl is merged into it.
1909 (attr_a=aaa, attr_b=bbb) "merge" (attr_a=aaa, attr_c=xxx) former becomes (attr_a=aaa, attr_b=bbb, attr_c=xxx)
1911 Can't have multiple "attr_a" with same value "aaa"
1913 (attr_a=aaa, attr_b=bbb) "merge" (attr_a=aaa, attr_a=xxx) former becomes (attr_a=aaa, attr_a=xxx, attr_b=bbb)
1915 Multiple "attr_a" with different values "aaa" and "xxx"
1917 (attr_a=aaa, attr_b=bbb) "merge" (attr_c=xxx, attr_d=ddd) former becomes (attr_a=aaa, attr_b=bbb, attr_c=xxx, attr_d=ddd)
1919 All AVP names are unique so resulting AVPL contains all AVPs from both AVPLs
1922 === Configuration Reference (mate.config)
1924 ==== PDU declaration block
1926 The following configuration AVPLs deal with PDU creation and data extraction.
1928 ===== _Pdu_ declaration block header
1930 In each frame of the capture, MATE will look for source _proto_name_'s PDUs in
1931 the order in which the declarations appear in its configuration and will create
1932 PDUs of every type it can from that frame, unless specifically instructed that
1933 some PDU type is the last one to be looked for in the frame. If told so for a
1934 given type, MATE will extract all PDUs of that type and the previously declared
1935 types it finds in the frame but not those declared later.
1937 The complete declaration of a _Pdu_ looks as below; the mandatory order of the
1938 diverse clauses is as shown.
1941 Pdu name Proto proto_name Transport {proto1[/proto2/proto3[/...]|mate}; {
1942 Payload proto; //optional, no default value
1943 Extract attribute From proto.field ; //may occur multiple times, at least once
1944 Transform transform1[, transform2[, ...]]; //optional
1945 Criteria {Accept|Reject} {Strict|Every|Loose} match_avpl; //optional
1946 DropUnassigned {TRUE|FALSE}; //optional, default=FALSE
1947 DiscardPduData {TRUE|FALSE}; //optional, default=FALSE
1948 LastPdu {TRUE|FALSE}; //optional, default=FALSE
1954 The _name_ is a mandatory attribute of a _Pdu_ declaration. It is chosen
1955 arbitrarily, except that each _name_ may only be used once in MATE's
1956 configuration, regardless the class of an item it is used for. The _name_ is
1957 used to distinguish between different types of PDUs, GOPs, and GOGs. The _name_
1958 is also used as part of the filterable fields' names related to this type of PDU
1961 However, several _Pdu_ declarations may share the same _name_. In such case, all
1962 of them are created from each source PDU matching their _Proto_, _Transport_,
1963 and _Payload_ clauses, while the bodies of their declarations may be totally
1964 different from each other. Together with the _Accept_ (or _Reject_) clauses,
1965 this feature is useful when it is necessary to build the PDU's AVPL from
1966 different sets of source fields depending on contents (or mere presence) of
1967 other source fields.
1969 ====== Proto and Transport clauses
1971 Every instance of the protocol _proto_name_ PDU in a frame will generate one
1972 PDU with the AVPs extracted from fields that are in the _proto_name_'s range
1973 and/or the ranges of underlying protocols specified by the _Transport_ list.
1974 It is a mandatory attribute of a _Pdu_ declaration. The _proto_name_ is the name
1975 of the protocol as used in Wireshark display filter.
1977 The PDU's _Proto_, and its _Transport_ list of protocols separated by / tell
1978 MATE which fields of a frame can get into the PDU's AVPL. In order that MATE
1979 would extract an attribute from a frame's protocol tree, the area representing
1980 the field in the hex display of the frame must be within the area of either the
1981 _Proto_ or its relative _Transport_++s++. _Transport_++s++ are chosen moving backwards
1982 from the protocol area, in the order they are given.
1984 _Proto http Transport tcp/ip_ does what you'd expect it to - it selects the
1985 nearest tcp range that precedes the current http range, and the nearest ip range
1986 that precedes that tcp range. If there is another ip range before the nearest
1987 one (e.g., in case of IP tunneling), that one is not going to be selected.
1988 _Transport_ tcp/ip/ip that "logically" should select the encapsulating IP header
1989 too doesn't work so far.
1991 Once we've selected the _Proto_ and _Transport_ ranges, MATE will fetch those
1992 protocol fields belonging to them whose extraction is declared using the
1993 _Extract_ clauses for the PDU type. The _Transport_ list is also mandatory,
1994 if you actually don't want to use any transport protocol, use _Transport mate_.
1995 (This didn't work until 0.10.9).
1997 ===== Payload clause
1999 Other than the PDU's _Proto_ and its _Transport_ protocols, there is also a
2000 _Payload_ attribute to tell MATE from which ranges of _Proto_'s payload to
2001 extract fields of a frame into the PDU. In order to extract an attribute from a
2002 frame's tree the highlighted area of the field in the hex display must be within
2003 the area of the _Proto_'s relative payload(s). _Payload_++s++ are chosen moving
2004 forward from the protocol area, in the order they are given.
2005 _Proto http Transport tcp/ip Payload mmse_ will select the first mmse range
2006 after the current http range. Once we've selected the _Payload_ ranges, MATE
2007 will fetch those protocol fields belonging to them whose extraction is declared
2008 using the _Extract_ clauses for the PDU type.
2010 ===== Extract clause
2012 Each _Extract_ clause tells MATE which protocol field value to extract as an AVP
2013 value and what string to use as the AVP name. The protocol fields are referred
2014 to using the names used in Wireshark display filters. If there is more than one
2015 such protocol field in the frame, each instance that fulfills the criteria
2016 stated above is extracted into its own AVP. The AVP names may be chosen
2017 arbitrarily, but to be able to match values originally coming from different
2018 PDUs (e.g., hostname from DNS query and a hostname from HTTP GET request) later
2019 in the analysis, identical AVP names must be assigned to them and the dissectors
2020 must provide the field values in identical format (which is not always the case).
2022 ===== Transform clause
2024 The _Transform_ clause specifies a list of previously declared _Transform_++s++ to
2025 be performed on the PDU's AVPL after all protocol fields have been extracted to
2026 it. The list is always executed completely, left to right. On the contrary, the
2027 list of Match clauses inside each individual _Transform_ is executed only until
2028 the first match succeeds.
2031 ===== Criteria clause
2033 This clause tells MATE whether to use the PDU for analysis. It specifies a match
2034 AVPL, an AVPL <<Match,Match type>> (_Strict_, _Every_, or _Loose_) and the action to be
2035 performed (_Accept_ or _Reject_) if the match succeeds. Once every attribute has
2036 been extracted and eventual transform list has been executed, and if the
2037 _Criteria_ clause is present, the PDU's AVPL is matched against the match AVPL;
2038 if the match succeeds, the action specified is executed, i.e., the PDU is
2039 accepted or rejected. The default behaviors used if the respective keywords are
2040 omitted are _Strict_ and _Accept_. Accordingly, if the clause is omitted, all
2043 ===== DropUnassigned clause
2045 If set to _TRUE_, MATE will destroy the PDU if it cannot assign it to a GOP.
2046 If set to _FALSE_ (the default if not given), MATE will keep them.
2048 ===== DiscardPduData clause
2050 If set to _TRUE_, MATE will delete the PDU's AVPL once it has analyzed it and
2051 eventually extracted some AVPs from it into the GOP's AVPL. This is useful to
2052 save memory (of which MATE uses a lot). If set to _FALSE_ (the default if not
2053 given), MATE will keep the PDU attributes.
2055 ===== LastPdu clause
2057 If set to _FALSE_ (the default if not given), MATE will continue to look for
2058 PDUs of other types in the frame. If set to _TRUE_, it will not try to create
2059 PDUs of other types from the current frame, yet it will continue to try for the
2063 ==== GOP declaration block
2065 ===== _Gop_ declaration block header
2067 Declares a Gop type and its candidate key.
2070 Gop name On pduname Match key {
2071 Start match_avpl; // optional
2072 Stop match_avpl; // optional
2073 Extra match_avpl; // optional
2074 Transform transform_list; // optional
2075 Expiration time; // optional
2076 IdleTimeout time; // optional
2077 Lifetime time; // optional
2078 DropUnassigned [TRUE|FALSE]; //optional
2079 ShowTree [NoTree|PduTree|FrameTree|BasicTree]; //optional
2080 ShowTimes [TRUE|FALSE]; //optional, default TRUE
2086 The _name_ is a mandatory attribute of a _Gop_ declaration. It is chosen
2087 arbitrarily, except that each _name_ may only be used once in MATE's
2088 configuration, regardless the class of an item it is used for. The _name_ is
2089 used to distinguish between different types of PDUs, GOPs, and GOGs. The _name_
2090 is also used as part of the filterable fields' names related to this type of
2091 GOP which MATE creates.
2095 The _name_ of PDUs which this type of GOP is supposed to be grouping. It is
2100 Defines what AVPs form up the _key_ part of the GOP's AVPL (the GOP's _key_ AVPL
2101 or simply the GOP's _key_). All PDUs matching the _key_ AVPL of an active GOP
2102 are assigned to that GOP; a PDU which contains the AVPs whose attribute names
2103 are listed in the GOP's _key_ AVPL, but they do not strictly match any active
2104 GOP's _key_ AVPL, will create a new GOP (unless a _Start_ clause is given).
2105 When a GOP is created, the elements of its key AVPL are copied from the creating
2110 If given, it tells MATE what match_avpl must a PDU's AVPL match, in addition to
2111 matching the GOP's _key_, in order to start a GOP. If not given, any PDU whose
2112 AVPL matches the GOP's _key_ AVPL will act as a start for a GOP. The PDU's AVPs
2113 matching the match_avpl are not automatically copied into the GOP's AVPL.
2117 If given, it tells MATE what match_avpl must a PDU's AVPL match, in addition to
2118 matching the GOP's _key_, in order to stop a GOP. If omitted, the GOP is
2119 "auto-stopped" - that is, the GOP is marked as stopped as soon as it is created.
2120 The PDU's AVPs matching the match_avpl are not automatically copied into the
2125 If given, tells MATE which AVPs from the PDU's AVPL are to be copied into the
2126 GOP's AVPL in addition to the GOP's key.
2128 ===== Transform clause
2130 The _Transform_ clause specifies a list of previously declared _Transform_++s++ to
2131 be performed on the GOP's AVPL after the AVPs from each new PDU, specified by
2132 the _key_ AVPL and the _Extra_ clause's match_avpl, have been merged into it.
2133 The list is always executed completely, left to right. On the contrary, the list
2134 of _Match_ clauses inside each individual _Transform_ is executed only until
2135 the first match succeeds.
2137 ===== Expiration clause
2139 A (floating) number of seconds after a GOP is _Stop_ ped during which further
2140 PDUs matching the _Stop_ ped GOP's key but not the _Start_ condition will still
2141 be assigned to that GOP. The default value of zero has an actual meaning of
2142 infinity, as it disables this timer, so all PDUs matching the _Stop_ ped GOP's
2143 key will be assigned to that GOP unless they match the _Start_ condition.
2145 ===== IdleTimeout clause
2147 A (floating) number of seconds elapsed from the last PDU assigned to the GOP
2148 after which the GOP will be considered released. The default value of zero has
2149 an actual meaning of infinity, as it disables this timer, so the GOP won't be
2150 released even if no PDUs arrive - unless the _Lifetime_ timer expires.
2152 ===== Lifetime clause
2154 A (floating) of seconds after the GOP _Start_ after which the GOP will be
2155 considered released regardless anything else. The default value of zero has an
2156 actual meaning of infinity.
2158 ===== DropUnassigned clause
2160 Whether or not a GOP that has not being assigned to any GOG should be discarded.
2161 If _TRUE_, the GOP is discarded right after creation. If _FALSE_, the default,
2162 the unassigned GOP is kept. Setting it to _TRUE_ helps save memory and speed up
2165 ===== TreeMode clause
2167 Controls the display of PDUs subtree of the GOP:
2169 * _NoTree_: completely suppresses showing the tree
2170 * _PduTree_: the tree is shown and shows the PDUs by PDU Id
2171 * _FrameTree_: the tree is shown and shows the PDUs by the frame number in which
2173 * _BasicTree_: needs investigation
2175 ===== ShowTimes clause
2177 Whether or not to show the times subtree of the GOP. If _TRUE_, the default,
2178 the subtree with the timers is added to the GOP's tree. If _FALSE_, the subtree
2182 ==== GOG declaration block
2184 ===== _Gog_ declaration block header
2186 Declares a Gog type and its candidate key.
2190 Member gopname (key); // mandatory, at least one
2191 Extra match_avpl; // optional
2192 Transform transform_list; // optional
2193 Expiration time; // optional, default 2.0
2194 GopTree [NoTree|PduTree|FrameTree|BasicTree]; // optional
2195 ShowTimes [TRUE|FALSE]; // optional, default TRUE
2201 The _name_ is a mandatory attribute of a _Gog_ declaration. It is chosen
2202 arbitrarily, except that each _name_ may only be used once in MATE's
2203 configuration, regardless the class of an item it is used for. The _name_ is
2204 used to distinguish between different types of PDUs, GOPs, and GOGs. The _name_
2205 is also used as part of the filterable fields' names related to this type of
2206 GOG which MATE creates.
2210 Defines the _key_ AVPL for the GOG individually for each GOP type _gopname_.
2211 All _gopname_ type GOPs whose _key_ AVPL matches the corresponding _key_ AVPL
2212 of an active GOG are assigned to that GOG; a GOP which contains the AVPs whose
2213 attribute names are listed in the GOG's corresponding _key_ AVPL, but they do
2214 not strictly match any active GOG's _key_ AVPL, will create a new GOG. When a
2215 GOG is created, the elements of its _key_ AVPL are copied from the creating GOP.
2217 Although the _key_ AVPLs are specified separately for each of the Member
2218 _gopname_++s++, in most cases they are identical, as the very purpose of a GOG is
2219 to group together GOPs made of PDUs of different types.
2223 If given, tells MATE which AVPs from any of the GOP's AVPL are to be copied
2224 into the GOG's AVPL in addition to the GOG's key.
2226 ===== Expiration clause
2228 A (floating) number of seconds after all the GOPs assigned to a GOG have been
2229 released during which new GOPs matching any of the session keys should still be
2230 assigned to the existing GOG instead of creating a new one. Its value can range
2231 from 0.0 to infinite. Defaults to 2.0 seconds.
2233 ===== Transform clause
2235 The _Transform_ clause specifies a list of previously declared _Transform_++s++ to
2236 be performed on the GOG's AVPL after the AVPs from each new GOP, specified by
2237 the _key_ AVPL and the _Extra_ clause's match_avpl, have been merged into it.
2238 The list is always executed completely, left to right. On the contrary, the list
2239 of _Match_ clauses inside each individual _Transform_ is executed only until
2240 the first match succeeds.
2242 ===== TreeMode clause
2244 Controls the display of GOPs subtree of the GOG:
2246 * _NoTree_: completely suppresses showing the tree
2247 * _BasicTree_: needs investigation
2248 * _FullTree_: needs investigation
2250 ===== ShowTimes clause
2252 Whether or not to show the times subtree of the GOG. If _TRUE_, the default,
2253 the subtree with the timers is added to the GOG's tree. If _FALSE_, the subtree
2257 ==== Transform declaration block
2259 A Transform is a sequence of Match rules optionally followed by an instruction
2260 how to modify the match result using an additional AVPL. Such modification may
2261 be an Insert (merge) or a Replace. The syntax is as follows:
2265 Match [Strict|Every|Loose] match_avpl [[Insert|Replace] modify_avpl] ; // may occur multiple times, at least once
2269 For examples of Transforms, check the <<ChMateManual,Manual>> page.
2271 TODO: migrate the examples here?
2273 The list of Match rules inside a Transform is processed top to bottom;
2274 the processing ends as soon as either a Match rule succeeds or all have been
2277 Transforms can be used as helpers to manipulate an item's AVPL before the item
2278 is processed further. An item declaration may contain a Transform clause
2279 indicating a list of previously declared Transforms. Regardless whether the
2280 individual transforms succeed or fail, the list is always executed completely
2281 and in the order given, i.e., left to right.
2283 In MATE configuration file, a Transform must be declared before declaring any
2286 ==== Settings configuration AVPL
2290 The *Settings* parameters have been moved to other configuration parameters
2291 or deprecated. Leave for now until rest of document is updated for current syntax.
2294 The *Settings* config element is used to pass to MATE various operational
2295 parameters. the possible parameters are
2299 How long in seconds after all the GOPs assigned to a GOG have been released new
2300 GOPs matching any of the session keys should create a new GOG instead of being
2301 assigned to the previous one. Its value can range from 0.0 to infinite.
2302 Defaults to 2.0 seconds.
2304 ===== DiscardPduData
2306 Whether or not the AVPL of every PDU should be deleted after it was being
2307 processed (saves memory). It can be either _TRUE_ or _FALSE_. Defaults to _TRUE_.
2308 Setting it to _FALSE_ can save you from a headache if your config does not work.
2310 ===== DiscardUnassignedPdu
2312 Whether PDUs should be deleted if they are not assigned to any GOP. It can be
2313 either _TRUE_ or _FALSE_. Defaults to _FALSE_. Set it to _TRUE_ to save memory
2314 if unassigned PDUs are useless.
2316 ===== DiscardUnassignedGop
2318 Whether GOPs should be deleted if they are not assigned to any session. It can
2319 be either _TRUE_ or _FALSE_. Defaults to _FALSE_. Setting it to _TRUE_ saves
2326 ==== Debugging Stuff
2328 The following settings are used to debug MATE and its configuration. All levels
2329 are integers ranging from 0 (print only errors) to 9 (flood me with junk),
2332 ===== Debug declaration block header
2336 Filename "path/name"; //optional, no default value
2337 Level [0-9]; //optional, generic debug level
2338 Pdu Level [0-9]; //optional, specific debug level for Pdu handling
2339 Gop Level [0-9]; //optional, specific debug level for Gop handling
2340 Gog Level [0-9]; //optional, specific debug level for Gog handling
2344 ====== Filename clause
2346 The {{{path/name}}} is a full path to the file to which debug output is to be
2347 written. Non-existent file will be created, existing file will be overwritten
2348 at each opening of a capture file. If the statement is missing, debug messages
2349 are written to console, which means they are invisible on Windows.
2353 Sets the level of debugging for generic debug messages. It is an integer
2354 ranging from 0 (print only errors) to 9 (flood me with junk).
2356 ====== Pdu Level clause
2358 Sets the level of debugging for messages regarding PDU creation. It is an
2359 integer ranging from 0 (print only errors) to 9 (flood me with junk).
2361 ====== Gop Level clause
2363 Sets the level of debugging for messages regarding PDU analysis (that is how do
2364 they fit into ?GOPs). It is an integer ranging from 0 (print only errors) to 9
2365 (flood me with junk).
2367 ====== Gog Level clause
2369 Sets the level of debugging for messages regarding GOP analysis (that is how do
2370 they fit into ?GOGs). It is an integer ranging from 0 (print only errors) to 9
2371 (flood me with junk).
2373 ===== Settings Example
2375 Action=Settings; SessionExpiration=3.5; DiscardPduData=FALSE;
2380 Will include a file to the configuration.
2383 Action=Include; {Filename=filename;|Lib=libname;}
2388 The filename of the file to include. If it does not begin with '/' it will look
2389 for the file in the current path.
2393 The name of the lib config to include. will look for libname.mate in
2394 wiresharks_dir/matelib.
2396 ===== Include Example
2398 Action=Include; Filename=rtsp.mate;
2401 This will include the file called "rtsp.mate" into the current config.