2 * Routines for ppp packet disassembly
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
10 * This file created and by Mike Hall <mlh@io.com>
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
34 #include <epan/prefs.h>
35 #include <epan/packet.h>
36 #include <epan/emem.h>
37 #include "packet-ppp.h"
38 #include <epan/ppptypes.h>
39 #include <epan/etypes.h>
40 #include <epan/ip_opts.h>
41 #include <epan/atalk-utils.h>
42 #include "packet-chdlc.h"
43 #include "packet-ip.h"
44 #include "packet-ipx.h"
45 #include "packet-vines.h"
46 #include <epan/nlpid.h>
47 #include <epan/crc16.h>
48 #include <epan/crc32.h>
49 #include <epan/ipproto.h>
51 #define ppp_min(a, b) ((a<b) ? a : b)
53 static int proto_ppp = -1;
54 static int hf_ppp_address = -1;
55 static int hf_ppp_control = -1;
56 static int hf_ppp_protocol = -1;
58 static gint ett_ppp = -1;
60 static int proto_ppp_hdlc = -1;
62 static gint ett_ppp_hdlc_data = -1;
64 static int proto_lcp = -1;
66 static gint ett_lcp = -1;
67 static gint ett_lcp_options = -1;
68 static gint ett_lcp_authprot_opt = -1;
69 static gint ett_lcp_qualprot_opt = -1;
70 static gint ett_lcp_fcs_alternatives_opt = -1;
71 static gint ett_lcp_numbered_mode_opt = -1;
72 static gint ett_lcp_callback_opt = -1;
73 static gint ett_lcp_multilink_ep_disc_opt = -1;
74 static gint ett_lcp_internationalization_opt = -1;
76 static int proto_ipcp = -1;
78 static gint ett_ipcp = -1;
79 static gint ett_ipcp_options = -1;
80 static gint ett_ipcp_ipaddrs_opt = -1;
81 static gint ett_ipcp_compress_opt = -1;
82 static gint ett_ipcp_iphc_disableprot_opt = -1;
84 static int proto_osicp = -1;
86 static gint ett_osicp = -1;
87 static gint ett_osicp_options = -1;
88 static gint ett_osicp_align_npdu_opt = -1;
90 static int proto_bcp = -1;
92 static int proto_ccp = -1;
94 static gint ett_ccp = -1;
95 static gint ett_ccp_options = -1;
96 static gint ett_ccp_stac_opt = -1;
97 static gint ett_ccp_mppc_opt = -1;
98 static gint ett_ccp_bsdcomp_opt = -1;
99 static gint ett_ccp_lzsdcp_opt = -1;
100 static gint ett_ccp_mvrca_opt = -1;
101 static gint ett_ccp_deflate_opt = -1;
103 static int proto_cbcp = -1;
105 static gint ett_cbcp = -1;
106 static gint ett_cbcp_options = -1;
107 static gint ett_cbcp_callback_opt = -1;
108 static gint ett_cbcp_callback_opt_addr = -1;
110 static int proto_bacp = -1;
112 static gint ett_bacp = -1;
113 static gint ett_bacp_options = -1;
114 static gint ett_bacp_favored_peer_opt = -1;
116 static int proto_bap = -1;
118 static gint ett_bap = -1;
119 static gint ett_bap_options = -1;
120 static gint ett_bap_link_type_opt = -1;
121 static gint ett_bap_phone_delta_opt = -1;
122 static gint ett_bap_phone_delta_subopt = -1;
123 static gint ett_bap_call_status_opt = -1;
125 static int proto_comp_data = -1;
127 static gint ett_comp_data = -1;
129 static int proto_pppmuxcp = -1;
131 static gint ett_pppmuxcp = -1;
132 static gint ett_pppmuxcp_options = -1;
134 static int proto_pppmux = -1;
135 static int hf_pppmux_protocol = -1;
137 static gint ett_pppmux = -1;
138 static gint ett_pppmux_subframe = -1;
139 static gint ett_pppmux_subframe_hdr = -1;
140 static gint ett_pppmux_subframe_flags = -1;
141 static gint ett_pppmux_subframe_info = -1;
143 static int proto_mp = -1;
144 static int hf_mp_frag_first = -1;
145 static int hf_mp_frag_last = -1;
146 static int hf_mp_sequence_num = -1;
148 static int ett_mp = -1;
149 static int ett_mp_flags = -1;
151 static int proto_mplscp = -1;
152 static gint ett_mplscp = -1;
153 static gint ett_mplscp_options = -1;
155 static int proto_cdpcp = -1;
156 static gint ett_cdpcp = -1;
157 static gint ett_cdpcp_options = -1;
159 static int proto_pap = -1; /* PAP vars */
160 static gint ett_pap = -1;
161 static gint ett_pap_data = -1;
162 static gint ett_pap_peer_id = -1;
163 static gint ett_pap_password = -1;
164 static gint ett_pap_message = -1;
166 static int proto_chap = -1; /* CHAP vars */
167 static gint ett_chap = -1;
168 static gint ett_chap_data = -1;
169 static gint ett_chap_value = -1;
170 static gint ett_chap_name = -1;
171 static gint ett_chap_message = -1;
174 static gint hf_chap_code = -1;
175 static gint hf_chap_identifier = -1;
176 static gint hf_chap_length = -1;
177 static gint hf_chap_value_size = -1;
178 static gint hf_chap_value = -1;
179 static gint hf_chap_name = -1;
180 static gint hf_chap_message = -1;
183 static int proto_ipv6cp = -1; /* IPv6CP vars */
185 static gint ett_ipv6cp = -1;
186 static gint ett_ipv6cp_options = -1;
187 static gint ett_ipv6cp_if_id_opt = -1;
188 static gint ett_ipv6cp_compress_opt = -1;
190 static int proto_iphc_crtp = -1; /* CRTP vars */
191 static int hf_iphc_crtp_cid8 = -1;
192 static int hf_iphc_crtp_cid16 = -1;
193 static int hf_iphc_crtp_gen = -1;
194 static int hf_iphc_crtp_seq = -1;
195 static int hf_iphc_crtp_fh_flags = -1;
196 static int hf_iphc_crtp_cs_flags = -1;
197 static int hf_iphc_crtp_cs_cnt = -1;
198 static int hf_iphc_crtp_cs_invalid = -1;
200 static gint ett_iphc_crtp = -1;
201 static gint ett_iphc_crtp_hdr = -1;
202 static gint ett_iphc_crtp_info = -1;
204 static dissector_table_t ppp_subdissector_table;
205 static dissector_handle_t chdlc_handle;
206 static dissector_handle_t data_handle;
207 static dissector_handle_t eth_withfcs_handle;
211 static gint ppp_fcs_decode = 0; /* 0 = No FCS, 1 = 16 bit FCS, 2 = 32 bit FCS */
216 const enum_val_t fcs_options[] = {
217 {"none", "None", NO_FCS},
218 {"16-bit", "16-Bit", FCS_16},
219 {"32-bit", "32-Bit", FCS_32},
223 gboolean ppp_vj_decomp = TRUE; /* Default to VJ header decompression */
226 * For Default Protocol ID negotiated with PPPMuxCP. We need to
227 * this ID so that if the first subframe doesn't have protocol
231 static guint pppmux_def_prot_id = 0;
233 /* PPP definitions */
236 * Used by the GTP dissector as well.
238 const value_string ppp_vals[] = {
239 {PPP_PADDING, "Padding Protocol" },
240 {PPP_ROHC_SCID, "ROHC small-CID" },
241 {PPP_ROHC_LCID, "ROHC large-CID" },
244 {PPP_DEC4, "DECnet Phase IV" },
245 {PPP_AT, "Appletalk" },
246 {PPP_IPX, "Netware IPX/SPX"},
247 {PPP_VJC_COMP, "VJ compressed TCP"},
248 {PPP_VJC_UNCOMP,"VJ uncompressed TCP"},
249 {PPP_BPDU, "Bridging PDU"},
250 {PPP_ST, "Stream Protocol (ST-II)" },
251 {PPP_VINES, "Vines" },
252 {PPP_AT_EDDP, "AppleTalk EDDP" },
253 {PPP_AT_SB, "AppleTalk SmartBuffered" },
254 {PPP_MP, "Multilink"},
255 {PPP_NB, "NETBIOS Framing" },
256 {PPP_CISCO, "Cisco Systems" },
257 {PPP_ASCOM, "Ascom Timeplex" },
258 {PPP_LBLB, "Fujitsu Link Backup and Load Balancing" },
259 {PPP_RL, "DCA Remote Lan" },
260 {PPP_SDTP, "Serial Data Transport Protocol" },
261 {PPP_LLC, "SNA over LLC" },
263 {PPP_IPV6HC, "IPv6 Header Compression " },
264 {PPP_KNX, "KNX Bridging Data" },
265 {PPP_ENCRYPT, "Encryption" },
266 {PPP_ILE, "Individual Link Encryption" },
268 {PPP_MUX, "PPP Multiplexing"},
269 {PPP_RTP_FH, "RTP IPHC Full Header" },
270 {PPP_RTP_CTCP, "RTP IPHC Compressed TCP" },
271 {PPP_RTP_CNTCP, "RTP IPHC Compressed Non TCP" },
272 {PPP_RTP_CUDP8, "RTP IPHC Compressed UDP 8" },
273 {PPP_RTP_CRTP8, "RTP IPHC Compressed RTP 8" },
274 {PPP_STAMPEDE, "Stampede Bridging" },
275 {PPP_MPPLUS, "MP+ Protocol" },
276 {PPP_NTCITS_IPI,"NTCITS IPI" },
277 {PPP_ML_SLCOMP, "single link compression in multilink" },
278 {PPP_COMP, "compressed packet" },
279 {PPP_STP_HELLO, "802.1D Hello Packet" },
280 {PPP_IBM_SR, "IBM Source Routing BPDU" },
281 {PPP_DEC_LB, "DEC LANBridge100 Spanning Tree"},
282 {PPP_CDP, "Cisco Discovery Protocol" },
283 {PPP_NETCS, "Netcs Twin Routing" },
284 {PPP_STP, "Scheduled Transfer Protocol" },
285 {PPP_EDP, "Extreme Discovery Protocol" },
286 {PPP_OSCP, "Optical Supervisory Channel Protocol" },
287 {PPP_OSCP2, "Optical Supervisory Channel Protocol" },
288 {PPP_LUXCOM, "Luxcom" },
289 {PPP_SIGMA, "Sigma Network Systems" },
290 {PPP_ACSP, "Apple Client Server Protocol" },
291 {PPP_MPLS_UNI, "MPLS Unicast"},
292 {PPP_MPLS_MULTI, "MPLS Multicast"},
293 {PPP_P12844, "IEEE p1284.4 standard - data packets" },
294 {PPP_ETSI, "ETSI TETRA Networks Procotol Type 1" },
295 {PPP_MFTP, "Multichannel Flow Treatment Protocol" },
296 {PPP_RTP_CTCPND,"RTP IPHC Compressed TCP No Delta" },
297 {PPP_RTP_CS, "RTP IPHC Context State" },
298 {PPP_RTP_CUDP16,"RTP IPHC Compressed UDP 16" },
299 {PPP_RTP_CRDP16,"RTP IPHC Compressed RTP 16" },
300 {PPP_CCCP, "Cray Communications Control Protocol" },
301 {PPP_CDPD_MNRP, "CDPD Mobile Network Registration Protocol" },
302 {PPP_EXPANDAP, "Expand accelerator protocol" },
303 {PPP_ODSICP, "ODSICP NCP" },
304 {PPP_DOCSIS, "DOCSIS DLL" },
305 {PPP_LZS, "Stacker LZS" },
306 {PPP_REFTEK, "RefTek Protocol" },
307 {PPP_FC, "Fibre Channel" },
308 {PPP_EMIT, "EMIT Protocols" },
309 {PPP_IPCP, "IP Control Protocol" },
310 {PPP_OSICP, "OSI Control Protocol" },
311 {PPP_XNSIDPCP, "Xerox NS IDP Control Protocol" },
312 {PPP_DECNETCP, "DECnet Phase IV Control Protocol" },
313 {PPP_ATCP, "AppleTalk Control Protocol" },
314 {PPP_IPXCP, "IPX Control Protocol" },
315 {PPP_BRIDGENCP, "Bridging NCP" },
316 {PPP_SPCP, "Stream Protocol Control Protocol" },
317 {PPP_BVCP, "Banyan Vines Control Protocol" },
318 {PPP_MLCP, "Multi-Link Control Protocol" },
319 {PPP_NBCP, "NETBIOS Framing Control Protocol" },
320 {PPP_CISCOCP, "Cisco Systems Control Protocol" },
321 {PPP_ASCOMCP, "Ascom Timeplex" },
322 {PPP_LBLBCP, "Fujitsu LBLB Control Protocol" },
323 {PPP_RLNCP, "DCA Remote Lan Network Control Protocol" },
324 {PPP_SDCP, "Serial Data Control Protocol" },
325 {PPP_LLCCP, "SNA over LLC Control Protocol" },
326 {PPP_SNACP, "SNA Control Protocol" },
327 {PPP_KNXCP, "KNX Bridging Control Protocol" },
328 {PPP_ECP, "Encryption Control Protocol" },
329 {PPP_ILECP, "Individual Encryption Control Protocol" },
330 {PPP_IPV6CP, "IPv6 Control Protocol" },
331 {PPP_MUXCP, "PPPMux Control Protocol"},
332 {PPP_STAMPEDECP,"Stampede Bridging Control Protocol" },
333 {PPP_MPPCP, "MP+ Contorol Protocol" },
334 {PPP_IPICP, "NTCITS IPI Control Protocol" },
335 {PPP_SLCC, "single link compression in multilink control" },
336 {PPP_CCP, "Compression Control Protocol" },
337 {PPP_CDPCP, "CDP Control Protocol" },
338 {PPP_NETCSCP, "Netcs Twin Routing" },
339 {PPP_STPCP, "STP - Control Protocol" },
340 {PPP_EDPCP, "EDP Control Protocol" },
341 {PPP_ACSPC, "Apple Client Server Protocol Control" },
342 {PPP_MPLSCP, "MPLS Control Protocol" },
343 {PPP_P12844CP, "IEEE p1284.4 standard - Protocol Control" },
344 {PPP_ETSICP, "ETSI TETRA TNP1 Control Protocol" },
345 {PPP_MFTPCP, "Multichannel Flow Treatment Protocol" },
346 {PPP_LCP, "Link Control Protocol" },
347 {PPP_PAP, "Password Authentication Protocol" },
348 {PPP_LQR, "Link Quality Report protocol" },
349 {PPP_SPAP, "Shiva Password Authentication Protocol" },
350 {PPP_CBCP, "Callback Control Protocol" },
351 {PPP_BACP, "Bandwidth Allocation Control Protocol" },
352 {PPP_BAP, "Bandwidth Allocation Protocol" },
353 {PPP_CONTCP, "Container Control Protocol" },
354 {PPP_CHAP, "Challenge Handshake Authentication Protocol" },
355 {PPP_RSAAP, "RSA Authentication Protocol" },
356 {PPP_EAP, "Extensible Authentication Protocol" },
357 {PPP_SIEP, "Mitsubishi Security Information Exchange Protocol"},
358 {PPP_SBAP, "Stampede Bridging Authorization Protocol" },
359 {PPP_PRPAP, "Proprietary Authentication Protocol" },
360 {PPP_PRPAP2, "Proprietary Authentication Protocol" },
361 {PPP_PRPNIAP, "Proprietary Node ID Authentication Protocol" },
365 /* CP (LCP, IPCP, etc.) codes.
368 #define CONFREQ 1 /* Configuration Request */
369 #define CONFACK 2 /* Configuration Ack */
370 #define CONFNAK 3 /* Configuration Nak */
371 #define CONFREJ 4 /* Configuration Reject */
372 #define TERMREQ 5 /* Termination Request */
373 #define TERMACK 6 /* Termination Ack */
374 #define CODEREJ 7 /* Code Reject */
376 static const value_string cp_vals[] = {
377 {CONFREQ, "Configuration Request" },
378 {CONFACK, "Configuration Ack" },
379 {CONFNAK, "Configuration Nak" },
380 {CONFREJ, "Configuration Reject" },
381 {TERMREQ, "Termination Request" },
382 {TERMACK, "Termination Ack" },
383 {CODEREJ, "Code Reject" },
387 * LCP-specific packet types.
389 #define PROTREJ 8 /* Protocol Reject */
390 #define ECHOREQ 9 /* Echo Request */
391 #define ECHOREP 10 /* Echo Reply */
392 #define DISCREQ 11 /* Discard Request */
393 #define IDENT 12 /* Identification */
394 #define TIMEREMAIN 13 /* Time remaining */
397 * CCP-specific packet types.
399 #define RESETREQ 14 /* Reset Request */
400 #define RESETACK 15 /* Reset Ack */
403 * CBCP-specific packet types.
405 #define CBREQ 1 /* Callback Request */
406 #define CBRES 2 /* Callback Response */
407 #define CBACK 3 /* Callback Ack */
409 #define CBCP_OPT 6 /* Use callback control protocol */
412 * BAP-specific packet types.
414 #define BAP_CREQ 1 /* Call Request */
415 #define BAP_CRES 2 /* Call Response */
416 #define BAP_CBREQ 3 /* Callback Request */
417 #define BAP_CBRES 4 /* Callback Response */
418 #define BAP_LDQREQ 5 /* Link Drop Query Request */
419 #define BAP_LDQRES 6 /* Link Drop Query Response */
420 #define BAP_CSI 7 /* Call Status Indication */
421 #define BAP_CSRES 8 /* Call Status Response */
423 static const value_string lcp_vals[] = {
424 {CONFREQ, "Configuration Request" },
425 {CONFACK, "Configuration Ack" },
426 {CONFNAK, "Configuration Nak" },
427 {CONFREJ, "Configuration Reject" },
428 {TERMREQ, "Termination Request" },
429 {TERMACK, "Termination Ack" },
430 {CODEREJ, "Code Reject" },
431 {PROTREJ, "Protocol Reject" },
432 {ECHOREQ, "Echo Request" },
433 {ECHOREP, "Echo Reply" },
434 {DISCREQ, "Discard Request" },
435 {IDENT, "Identification" },
436 {TIMEREMAIN, "Time Remaining" },
440 static const value_string ccp_vals[] = {
441 {CONFREQ, "Configuration Request" },
442 {CONFACK, "Configuration Ack" },
443 {CONFNAK, "Configuration Nak" },
444 {CONFREJ, "Configuration Reject" },
445 {TERMREQ, "Termination Request" },
446 {TERMACK, "Termination Ack" },
447 {CODEREJ, "Code Reject" },
448 {RESETREQ, "Reset Request" },
449 {RESETACK, "Reset Ack" },
453 static const value_string cbcp_vals[] = {
454 {CBREQ, "Callback Request" },
455 {CBRES, "Callback Response" },
456 {CBACK, "Callback Ack" },
460 static const value_string bap_vals[] = {
461 {BAP_CREQ, "Call Request" },
462 {BAP_CRES, "Call Response" },
463 {BAP_CBREQ, "Callback Request" },
464 {BAP_CBRES, "Callback Response" },
465 {BAP_LDQREQ, "Link Drop Query Request" },
466 {BAP_LDQRES, "Link Drop Query Response" },
467 {BAP_CSI, "Call Status Indication" },
468 {BAP_CSRES, "Call Status Response" },
472 #define BAP_RESP_CODE_REQACK 0x00
473 #define BAP_RESP_CODE_REQNAK 0x01
474 #define BAP_RESP_CODE_REQREJ 0x02
475 #define BAP_RESP_CODE_REQFULLNAK 0x03
476 static const value_string bap_resp_code_vals[] = {
477 {BAP_RESP_CODE_REQACK, "Request Ack" },
478 {BAP_RESP_CODE_REQNAK, "Request Nak" },
479 {BAP_RESP_CODE_REQREJ, "Request Rej" },
480 {BAP_RESP_CODE_REQFULLNAK, "Request Full Nak" },
484 #define BAP_LINK_TYPE_ISDN 0 /* ISDN */
485 #define BAP_LINK_TYPE_X25 1 /* X.25 */
486 #define BAP_LINK_TYPE_ANALOG 2 /* Analog */
487 #define BAP_LINK_TYPE_SD 3 /* Switched Digital (non-ISDN) */
488 #define BAP_LINK_TYPE_ISDNOV 4 /* ISDN data over voice */
489 #define BAP_LINK_TYPE_RESV5 5 /* Reserved */
490 #define BAP_LINK_TYPE_RESV6 6 /* Reserved */
491 #define BAP_LINK_TYPE_RESV7 7 /* Reserved */
492 static const value_string bap_link_type_vals[] = {
493 {BAP_LINK_TYPE_ISDN, "ISDN" },
494 {BAP_LINK_TYPE_X25, "X.25" },
495 {BAP_LINK_TYPE_ANALOG, "Analog" },
496 {BAP_LINK_TYPE_SD, "Switched Digital (non-ISDN)" },
497 {BAP_LINK_TYPE_ISDNOV, "ISDN data over voice" },
498 {BAP_LINK_TYPE_RESV5, "Reserved" },
499 {BAP_LINK_TYPE_RESV6, "Reserved" },
500 {BAP_LINK_TYPE_RESV7, "Reserved" },
504 #define BAP_PHONE_DELTA_SUBOPT_UNIQ_DIGIT 1 /* Unique Digit */
505 #define BAP_PHONE_DELTA_SUBOPT_SUBSC_NUM 2 /* Subscriber Number */
506 #define BAP_PHONE_DELTA_SUBOPT_PHONENUM_SUBADDR 3 /* Phone Number Sub Address */
507 static const value_string bap_phone_delta_subopt_vals[] = {
508 {BAP_PHONE_DELTA_SUBOPT_UNIQ_DIGIT, "Unique Digit" },
509 {BAP_PHONE_DELTA_SUBOPT_SUBSC_NUM, "Subscriber Number" },
510 {BAP_PHONE_DELTA_SUBOPT_PHONENUM_SUBADDR, "Phone Number Sub Address" },
515 * Cause codes for Cause.
517 * The following code table is taken from packet-q931.c but is slightly
518 * adapted to BAP protocol.
520 static const value_string q931_cause_code_vals[] = {
521 { 0x00, "Call successful" },
522 { 0x01, "Unallocated (unassigned) number" },
523 { 0x02, "No route to specified transit network" },
524 { 0x03, "No route to destination" },
525 { 0x04, "Send special information tone" },
526 { 0x05, "Misdialled trunk prefix" },
527 { 0x06, "Channel unacceptable" },
528 { 0x07, "Call awarded and being delivered in an established channel" },
529 { 0x08, "Prefix 0 dialed but not allowed" },
530 { 0x09, "Prefix 1 dialed but not allowed" },
531 { 0x0A, "Prefix 1 dialed but not required" },
532 { 0x0B, "More digits received than allowed, call is proceeding" },
533 { 0x10, "Normal call clearing" },
534 { 0x11, "User busy" },
535 { 0x12, "No user responding" },
536 { 0x13, "No answer from user (user alerted)" },
537 { 0x14, "Subscriber absent" },
538 { 0x15, "Call rejected" },
539 { 0x16, "Number changed" },
540 { 0x17, "Reverse charging rejected" },
541 { 0x18, "Call suspended" },
542 { 0x19, "Call resumed" },
543 { 0x1A, "Non-selected user clearing" },
544 { 0x1B, "Destination out of order" },
545 { 0x1C, "Invalid number format (incomplete number)" },
546 { 0x1D, "Facility rejected" },
547 { 0x1E, "Response to STATUS ENQUIRY" },
548 { 0x1F, "Normal unspecified" },
549 { 0x21, "Circuit out of order" },
550 { 0x22, "No circuit/channel available" },
551 { 0x23, "Destination unattainable" },
552 { 0x25, "Degraded service" },
553 { 0x26, "Network out of order" },
554 { 0x27, "Transit delay range cannot be achieved" },
555 { 0x28, "Throughput range cannot be achieved" },
556 { 0x29, "Temporary failure" },
557 { 0x2A, "Switching equipment congestion" },
558 { 0x2B, "Access information discarded" },
559 { 0x2C, "Requested circuit/channel not available" },
560 { 0x2D, "Pre-empted" },
561 { 0x2E, "Precedence call blocked" },
562 { 0x2F, "Resources unavailable, unspecified" },
563 { 0x31, "Quality of service unavailable" },
564 { 0x32, "Requested facility not subscribed" },
565 { 0x33, "Reverse charging not allowed" },
566 { 0x34, "Outgoing calls barred" },
567 { 0x35, "Outgoing calls barred within CUG" },
568 { 0x36, "Incoming calls barred" },
569 { 0x37, "Incoming calls barred within CUG" },
570 { 0x38, "Call waiting not subscribed" },
571 { 0x39, "Bearer capability not authorized" },
572 { 0x3A, "Bearer capability not presently available" },
573 { 0x3E, "Inconsistency in designated outgoing access information and subscriber class" },
574 { 0x3F, "Service or option not available, unspecified" },
575 { 0x41, "Bearer capability not implemented" },
576 { 0x42, "Channel type not implemented" },
577 { 0x43, "Transit network selection not implemented" },
578 { 0x44, "Message not implemented" },
579 { 0x45, "Requested facility not implemented" },
580 { 0x46, "Only restricted digital information bearer capability is available" },
581 { 0x4F, "Service or option not implemented, unspecified" },
582 { 0x51, "Invalid call reference value" },
583 { 0x52, "Identified channel does not exist" },
584 { 0x53, "Call identity does not exist for suspended call" },
585 { 0x54, "Call identity in use" },
586 { 0x55, "No call suspended" },
587 { 0x56, "Call having the requested call identity has been cleared" },
588 { 0x57, "Called user not member of CUG" },
589 { 0x58, "Incompatible destination" },
590 { 0x59, "Non-existent abbreviated address entry" },
591 { 0x5A, "Destination address missing, and direct call not subscribed" },
592 { 0x5B, "Invalid transit network selection (national use)" },
593 { 0x5C, "Invalid facility parameter" },
594 { 0x5D, "Mandatory information element is missing" },
595 { 0x5F, "Invalid message, unspecified" },
596 { 0x60, "Mandatory information element is missing" },
597 { 0x61, "Message type non-existent or not implemented" },
598 { 0x62, "Message not compatible with call state or message type non-existent or not implemented" },
599 { 0x63, "Information element nonexistant or not implemented" },
600 { 0x64, "Invalid information element contents" },
601 { 0x65, "Message not compatible with call state" },
602 { 0x66, "Recovery on timer expiry" },
603 { 0x67, "Parameter non-existent or not implemented - passed on" },
604 { 0x6E, "Message with unrecognized parameter discarded" },
605 { 0x6F, "Protocol error, unspecified" },
606 { 0x7F, "Internetworking, unspecified" },
607 { 0xFF, "Non-specific failure" },
611 static const value_string bap_call_status_opt_action_vals[] = {
617 #define STAC_CM_NONE 0
618 #define STAC_CM_LCB 1
619 #define STAC_CM_CRC 2
621 #define STAC_CM_EXTMODE 4
622 static const value_string stac_checkmode_vals[] = {
623 {STAC_CM_NONE, "None" },
624 {STAC_CM_LCB, "LCB" },
625 {STAC_CM_CRC, "CRC" },
626 {STAC_CM_SN, "Sequence Number" },
627 {STAC_CM_EXTMODE, "Extended Mode" },
631 #define LZSDCP_CM_NONE 0
632 #define LZSDCP_CM_LCB 1
633 #define LZSDCP_CM_SN 2
634 #define LZSDCP_CM_SN_LCB 3
635 static const value_string lzsdcp_checkmode_vals[] = {
636 {LZSDCP_CM_NONE, "None" },
637 {LZSDCP_CM_LCB, "LCB" },
638 {LZSDCP_CM_SN, "Sequence Number" },
639 {LZSDCP_CM_SN_LCB, "Sequence Number + LCB" },
643 #define LZSDCP_PM_NONE 0
644 #define LZSDCP_PM_PROC_UNCOMP 1
645 static const value_string lzsdcp_processmode_vals[] = {
646 {LZSDCP_PM_NONE, "None" },
647 {LZSDCP_PM_PROC_UNCOMP, "Process-Uncompressed" },
654 #define CI_MRU 1 /* Maximum Receive Unit */
655 #define CI_ASYNCMAP 2 /* Async Control Character Map */
656 #define CI_AUTHTYPE 3 /* Authentication Type */
657 #define CI_QUALITY 4 /* Quality Protocol */
658 #define CI_MAGICNUMBER 5 /* Magic Number */
659 #define CI_PCOMPRESSION 7 /* Protocol Field Compression */
660 #define CI_ACCOMPRESSION 8 /* Address/Control Field Compression */
661 #define CI_FCS_ALTERNATIVES 9 /* FCS Alternatives (RFC 1570) */
662 #define CI_SELF_DESCRIBING_PAD 10 /* Self-Describing Pad (RFC 1570) */
663 #define CI_NUMBERED_MODE 11 /* Numbered Mode (RFC 1663) */
664 #define CI_CALLBACK 13 /* Callback (RFC 1570) */
665 #define CI_COMPOUND_FRAMES 15 /* Compound frames (RFC 1570) */
666 #define CI_MULTILINK_MRRU 17 /* Multilink MRRU (RFC 1717) */
667 #define CI_MULTILINK_SSNH 18 /* Multilink Short Sequence Number
669 #define CI_MULTILINK_EP_DISC 19 /* Multilink Endpoint Discriminator
671 #define CI_DCE_IDENTIFIER 21 /* DCE Identifier */
672 #define CI_MULTILINK_PLUS_PROC 22 /* Multilink Plus Procedure */
673 #define CI_LINK_DISC_FOR_BACP 23 /* Link Discriminator for BACP
675 #define CI_LCP_AUTHENTICATION 24 /* LCP Authentication Option */
676 #define CI_COBS 25 /* Consistent Overhead Byte
678 #define CI_PREFIX_ELISION 26 /* Prefix elision */
679 #define CI_MULTILINK_HDR_FMT 27 /* Multilink header format */
680 #define CI_INTERNATIONALIZATION 28 /* Internationalization (RFC 2484) */
681 #define CI_SDL_ON_SONET_SDH 29 /* Simple Data Link on SONET/SDH */
683 static void dissect_lcp_mru_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
684 int offset, guint length, packet_info *pinfo,
686 static void dissect_lcp_async_map_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
687 int offset, guint length, packet_info *pinfo,
689 static void dissect_lcp_protocol_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
690 int offset, guint length, packet_info *pinfo,
692 static void dissect_lcp_authprot_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
693 int offset, guint length, packet_info *pinfo,
695 static void dissect_lcp_magicnumber_opt(const ip_tcp_opt *optp,
696 tvbuff_t *tvb, int offset, guint length,
697 packet_info *pinfo, proto_tree *tree);
698 static void dissect_lcp_fcs_alternatives_opt(const ip_tcp_opt *optp,
699 tvbuff_t *tvb, int offset, guint length,
700 packet_info *pinfo, proto_tree *tree);
701 static void dissect_lcp_numbered_mode_opt(const ip_tcp_opt *optp,
702 tvbuff_t *tvb, int offset, guint length,
703 packet_info *pinfo, proto_tree *tree);
704 static void dissect_lcp_self_describing_pad_opt(const ip_tcp_opt *optp,
705 tvbuff_t *tvb, int offset, guint length,
706 packet_info *pinfo, proto_tree *tree);
707 static void dissect_lcp_callback_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
708 int offset, guint length, packet_info *pinfo,
710 static void dissect_lcp_multilink_mrru_opt(const ip_tcp_opt *optp,
711 tvbuff_t *tvb, int offset, guint length,
712 packet_info *pinfo, proto_tree *tree);
713 static void dissect_lcp_multilink_ep_disc_opt(const ip_tcp_opt *optp,
714 tvbuff_t *tvb, int offset, guint length,
715 packet_info *pinfo, proto_tree *tree);
716 static void dissect_lcp_bap_link_discriminator_opt(const ip_tcp_opt *optp,
717 tvbuff_t *tvb, int offset, guint length,
718 packet_info *pinfo, proto_tree *tree);
719 static void dissect_lcp_internationalization_opt(const ip_tcp_opt *optp,
720 tvbuff_t *tvb, int offset, guint length,
721 packet_info *pinfo, proto_tree *tree);
722 static void dissect_mp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
724 static const ip_tcp_opt lcp_opts[] = {
727 "Maximum Receive Unit",
735 "Async Control Character Map",
739 dissect_lcp_async_map_opt
743 "Authentication protocol",
744 &ett_lcp_authprot_opt,
747 dissect_lcp_authprot_opt
752 &ett_lcp_qualprot_opt,
755 dissect_lcp_protocol_opt
763 dissect_lcp_magicnumber_opt
767 "Protocol field compression",
775 "Address/control field compression",
784 &ett_lcp_fcs_alternatives_opt,
787 dissect_lcp_fcs_alternatives_opt
790 CI_SELF_DESCRIBING_PAD,
791 "Maximum octets of self-describing padding",
795 dissect_lcp_self_describing_pad_opt
800 &ett_lcp_numbered_mode_opt,
803 dissect_lcp_numbered_mode_opt
808 &ett_lcp_callback_opt,
811 dissect_lcp_callback_opt,
827 dissect_lcp_multilink_mrru_opt
831 "Use short sequence number headers",
838 CI_MULTILINK_EP_DISC,
839 "Multilink endpoint discriminator",
840 &ett_lcp_multilink_ep_disc_opt,
843 dissect_lcp_multilink_ep_disc_opt,
854 CI_MULTILINK_PLUS_PROC,
855 "Multilink Plus Procedure",
862 CI_LINK_DISC_FOR_BACP,
863 "Link discriminator for BAP",
867 dissect_lcp_bap_link_discriminator_opt
870 CI_LCP_AUTHENTICATION,
871 "LCP authentication",
879 "Consistent Overhead Byte Stuffing",
894 CI_MULTILINK_HDR_FMT,
895 "Multilink header format",
902 CI_INTERNATIONALIZATION,
903 "Internationalization",
904 &ett_lcp_internationalization_opt,
907 dissect_lcp_internationalization_opt
911 "Simple data link on SONET/SDH",
919 #define N_LCP_OPTS (sizeof lcp_opts / sizeof lcp_opts[0])
924 #define CHAP_ALG_MD5 0x05 /* CHAP with MD5 */
925 #define CHAP_ALG_MSV1 0x80 /* MS-CHAPv1 */
926 #define CHAP_ALG_MSV2 0x81 /* MS-CHAPv2 */
928 static const value_string chap_alg_vals[] = {
929 {CHAP_ALG_MD5, "CHAP with MD5" },
930 {CHAP_ALG_MSV1, "MS-CHAP" },
931 {CHAP_ALG_MSV2, "MS-CHAP-2" },
939 #define CI_ADDRS 1 /* IP Addresses (deprecated) (RFC 1172) */
940 #define CI_COMPRESSTYPE 2 /* Compression Type (RFC 1332) */
941 #define CI_ADDR 3 /* IP Address (RFC 1332) */
942 #define CI_MOBILE_IPv4 4 /* Mobile IPv4 (RFC 2290) */
943 #define CI_MS_DNS1 129 /* Primary DNS value (RFC 1877) */
944 #define CI_MS_WINS1 130 /* Primary WINS value (RFC 1877) */
945 #define CI_MS_DNS2 131 /* Secondary DNS value (RFC 1877) */
946 #define CI_MS_WINS2 132 /* Secondary WINS value (RFC 1877) */
948 static void dissect_ipcp_addrs_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
949 int offset, guint length, packet_info *pinfo,
951 static void dissect_ipcp_addr_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
952 int offset, guint length, packet_info *pinfo,
954 static void dissect_ipcp_compress_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
955 int offset, guint length, packet_info *pinfo,
957 static void dissect_ipcp_iphc_disableprot_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
958 int offset, guint length, packet_info *pinfo,
961 static const ip_tcp_opt ipcp_opts[] = {
964 "IP addresses (deprecated)",
965 &ett_ipcp_ipaddrs_opt,
968 dissect_ipcp_addrs_opt
973 &ett_ipcp_compress_opt,
976 dissect_ipcp_compress_opt
984 dissect_ipcp_addr_opt
988 "Mobile node's home IP address",
992 dissect_ipcp_addr_opt
996 "Primary DNS server IP address",
1000 dissect_ipcp_addr_opt
1004 "Primary WINS server IP address",
1008 dissect_ipcp_addr_opt
1012 "Secondary DNS server IP address",
1016 dissect_ipcp_addr_opt
1020 "Secondary WINS server IP address",
1024 dissect_ipcp_addr_opt
1028 #define N_IPCP_OPTS (sizeof ipcp_opts / sizeof ipcp_opts[0])
1032 * IP Compression options
1034 #define IPCP_COMPRESS_VJ_1172 0x37 /* value defined in RFC1172 (typo) */
1035 #define IPCP_COMPRESS_VJ 0x2d /* value defined in RFC1332 (correct) */
1036 #define IPCP_COMPRESS_IPHC 0x61
1038 const value_string ipcp_compress_proto_vals[] = {
1039 { IPCP_COMPRESS_VJ_1172, "VJ compression (RFC1172-typo)" },
1040 { IPCP_COMPRESS_VJ, "VJ compression" },
1041 { IPCP_COMPRESS_IPHC, "IPHC compression" },
1045 /* IPHC suboptions (RFC2508, 3544) */
1046 #define IPCP_IPHC_CRTP 1
1047 #define IPCP_IPHC_ECRTP 2
1048 #define IPCP_IPHC_DISABLE_PROTO 3 /* Disable compression for protocol */
1050 const value_string ipcp_iphc_disable_proto_vals[] = {
1056 static const ip_tcp_opt ipcp_iphc_subopts[] = {
1059 "RTP compression (RFC2508)",
1067 "Enhanced RTP compression (RFC3545)",
1074 IPCP_IPHC_DISABLE_PROTO,
1075 "Enhanced RTP compression (RFC3545)",
1076 &ett_ipcp_iphc_disableprot_opt,
1079 dissect_ipcp_iphc_disableprot_opt
1083 #define N_IPCP_IPHC_SUBOPTS (sizeof ipcp_iphc_subopts / sizeof ipcp_iphc_subopts[0])
1089 #define CI_OSICP_ALIGN_NPDU 1 /* Alignment of the OSI NPDU (RFC 1377) */
1091 static void dissect_osicp_align_npdu_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1092 int offset, guint length, packet_info *pinfo,
1095 static const ip_tcp_opt osicp_opts[] = {
1097 CI_OSICP_ALIGN_NPDU,
1099 &ett_osicp_align_npdu_opt,
1102 dissect_osicp_align_npdu_opt
1106 #define N_OSICP_OPTS (sizeof osicp_opts / sizeof osicp_opts[0])
1111 #define CI_CCP_OUI 0 /* OUI (RFC1962) */
1112 #define CI_CCP_PREDICT1 1 /* Predictor type 1 (RFC1962) */
1113 #define CI_CCP_PREDICT2 2 /* Predictor type 2 (RFC1962) */
1114 #define CI_CCP_PUDDLE 3 /* Puddle Jumper (RFC1962) */
1115 #define CI_CCP_HPPPC 16 /* Hewlett-Packard PPC (RFC1962) */
1116 #define CI_CCP_STAC 17 /* stac Electronics LZS (RFC1974) */
1117 #define CI_CCP_MPPC 18 /* Microsoft PPC (RFC2218/3078) */
1118 #define CI_CCP_GFZA 19 /* Gandalf FZA (RFC1962) */
1119 #define CI_CCP_V42BIS 20 /* V.42bis compression */
1120 #define CI_CCP_BSDLZW 21 /* BSD LZW Compress (RFC1977) */
1121 #define CI_CCP_LZSDCP 23 /* LZS-DCP (RFC1967) */
1122 #define CI_CCP_MVRCA 24 /* MVRCA (Magnalink) (RFC1975) */
1123 #define CI_CCP_DEFLATE 26 /* Deflate (RFC1979) */
1124 #define CI_CCP_RESERVED 255 /* Reserved (RFC1962) */
1127 * Microsoft Point-To-Point Compression (MPPC) and Encryption (MPPE)
1130 #define MPPC_SUPPORTED_BITS_C 0x00000001 /* MPPC negotiation */
1131 #define MPPE_SUPPORTED_BITS_D 0x00000010 /* Obsolete */
1132 #define MPPE_SUPPORTED_BITS_L 0x00000020 /* 40-bit encryption */
1133 #define MPPE_SUPPORTED_BITS_S 0x00000040 /* 128-bit encryption */
1134 #define MPPE_SUPPORTED_BITS_M 0x00000080 /* 56-bit encryption */
1135 #define MPPE_SUPPORTED_BITS_H 0x01000000 /* stateless mode */
1137 static void dissect_ccp_stac_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1138 int offset, guint length, packet_info *pinfo,
1141 static void dissect_ccp_mppc_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1142 int offset, guint length, packet_info *pinfo,
1145 static void dissect_ccp_bsdcomp_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1146 int offset, guint length, packet_info *pinfo,
1149 static void dissect_ccp_lzsdcp_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1150 int offset, guint length, packet_info *pinfo,
1153 static void dissect_ccp_mvrca_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1154 int offset, guint length, packet_info *pinfo,
1157 static void dissect_ccp_deflate_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1158 int offset, guint length, packet_info *pinfo,
1161 static const ip_tcp_opt ccp_opts[] = {
1164 "Stac Electronics LZS",
1168 /* In RFC 1974, this is a fixed-length field of size 5,
1169 but in Ascend Proprietary STAC compression this field
1170 is 6 octets. Sigh... */
1171 dissect_ccp_stac_opt
1179 dissect_ccp_mppc_opt
1184 &ett_ccp_bsdcomp_opt,
1187 dissect_ccp_bsdcomp_opt
1192 &ett_ccp_lzsdcp_opt,
1195 dissect_ccp_lzsdcp_opt
1199 "MVRCA (Magnalink)",
1203 dissect_ccp_mvrca_opt
1208 &ett_ccp_deflate_opt,
1210 4, /* RFC1979 says the length is 3 but it's actually 4. */
1211 dissect_ccp_deflate_opt
1215 #define N_CCP_OPTS (sizeof ccp_opts / sizeof ccp_opts[0])
1220 #define CI_CBCP_NO_CALLBACK 1 /* No callback */
1221 #define CI_CBCP_CB_USER 2 /* Callback to a user-specified number */
1222 #define CI_CBCP_CB_PRE 3 /* Callback to a pre-specified or
1223 administrator specified number */
1224 #define CI_CBCP_CB_ANY 4 /* Callback to any of a list of numbers */
1226 static void dissect_cbcp_no_callback_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1227 int offset, guint length, packet_info *pinfo,
1230 static void dissect_cbcp_callback_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1231 int offset, guint length, packet_info *pinfo,
1234 static const ip_tcp_opt cbcp_opts[] = {
1236 CI_CBCP_NO_CALLBACK,
1241 dissect_cbcp_no_callback_opt
1245 "Callback to a user-specified number",
1246 &ett_cbcp_callback_opt,
1249 dissect_cbcp_callback_opt
1253 "Callback to a pre-specified or admin-specified number",
1254 &ett_cbcp_callback_opt,
1257 dissect_cbcp_callback_opt
1261 "Callback to any of a list of numbers",
1262 &ett_cbcp_callback_opt,
1265 dissect_cbcp_callback_opt
1270 #define N_CBCP_OPTS (sizeof cbcp_opts / sizeof cbcp_opts[0])
1275 #define CI_BACP_FAVORED_PEER 1 /* Favored-Peer */
1277 static void dissect_bacp_favored_peer_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1278 int offset, guint length, packet_info *pinfo,
1281 static const ip_tcp_opt bacp_opts[] = {
1283 CI_BACP_FAVORED_PEER,
1285 &ett_bacp_favored_peer_opt,
1288 dissect_bacp_favored_peer_opt
1292 #define N_BACP_OPTS (sizeof bacp_opts / sizeof bacp_opts[0])
1297 #define CI_BAP_LINK_TYPE 1 /* Link Type */
1298 #define CI_BAP_PHONE_DELTA 2 /* Phone-Delta */
1299 #define CI_BAP_NO_PHONE_NUM_NEEDED 3 /* No Phone Number Needed */
1300 #define CI_BAP_REASON 4 /* Reason */
1301 #define CI_BAP_LINK_DISC 5 /* Link Discriminator */
1302 #define CI_BAP_CALL_STATUS 6 /* Call Status */
1304 static void dissect_bap_link_type_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1305 int offset, guint length, packet_info *pinfo,
1308 static void dissect_bap_phone_delta_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1309 int offset, guint length, packet_info *pinfo,
1312 static void dissect_bap_link_disc_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1313 int offset, guint length, packet_info *pinfo,
1316 static void dissect_bap_reason_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1317 int offset, guint length, packet_info *pinfo,
1320 static void dissect_bap_call_status_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1321 int offset, guint length, packet_info *pinfo,
1324 static const ip_tcp_opt bap_opts[] = {
1328 &ett_bap_link_type_opt,
1331 dissect_bap_link_type_opt
1336 &ett_bap_phone_delta_opt,
1339 dissect_bap_phone_delta_opt
1342 CI_BAP_NO_PHONE_NUM_NEEDED,
1343 "No Phone Number Needed",
1355 dissect_bap_reason_opt
1359 "Link Discriminator",
1363 dissect_bap_link_disc_opt
1368 &ett_bap_call_status_opt,
1371 dissect_bap_call_status_opt
1375 #define N_BAP_OPTS (sizeof bap_opts / sizeof bap_opts[0])
1377 static void dissect_ppp(tvbuff_t *tvb, packet_info *pinfo,
1380 static const value_string pap_vals[] = {
1381 {CONFREQ, "Authenticate-Request" },
1382 {CONFACK, "Authenticate-Ack" },
1383 {CONFNAK, "Authenticate-Nak" },
1386 static void dissect_pap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
1388 #define CHAP_CHAL 1 /* CHAP Challenge */
1389 #define CHAP_RESP 2 /* CHAP Response */
1390 #define CHAP_SUCC 3 /* CHAP Success */
1391 #define CHAP_FAIL 4 /* CHAP Failure */
1393 static const value_string chap_vals[] = {
1394 {CHAP_CHAL, "Challenge" },
1395 {CHAP_RESP, "Response" },
1396 {CHAP_SUCC, "Success" },
1397 {CHAP_FAIL, "Failure" },
1400 static void dissect_chap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
1402 static const value_string pppmuxcp_vals[] = {
1403 {CONFREQ, "Configuration Request" },
1404 {CONFACK, "Configuration Ack" },
1412 #define CI_DEFAULT_PID 1
1414 static void dissect_pppmuxcp_def_pid_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1415 int offset, guint length, packet_info *pinfo, proto_tree *tree);
1418 static const ip_tcp_opt pppmuxcp_opts[] = {
1421 "Default Protocol ID",
1425 dissect_pppmuxcp_def_pid_opt
1429 #define N_PPPMUXCP_OPTS (sizeof pppmuxcp_opts / sizeof pppmuxcp_opts[0])
1434 #define CI_IPV6CP_IF_ID 1 /* Interface Identifier (RFC 2472) */
1435 #define CI_IPV6CP_COMPRESSTYPE 2 /* Compression Type (RFC 2472) */
1437 static void dissect_ipv6cp_if_id_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1438 int offset, guint length, packet_info *pinfo,
1441 static const ip_tcp_opt ipv6cp_opts[] = {
1444 "Interface Identifier",
1445 &ett_ipv6cp_if_id_opt,
1448 dissect_ipv6cp_if_id_opt
1453 &ett_ipv6cp_compress_opt,
1456 dissect_ipcp_compress_opt
1460 #define N_IPV6CP_OPTS (sizeof ipv6cp_opts / sizeof ipv6cp_opts[0])
1463 *******************************************************************************
1464 * DETAILS : Calculate a new FCS-16 given the current FCS-16 and the new data.
1465 *******************************************************************************
1468 fcs16(tvbuff_t * tvbuff)
1470 guint len = tvb_length(tvbuff)-2;
1472 /* Check for Invalid Length */
1475 return crc16_ccitt_tvb(tvbuff, len);
1479 *******************************************************************************
1480 * DETAILS : Calculate a new FCS-32 given the current FCS-32 and the new data.
1481 *******************************************************************************
1484 fcs32(tvbuff_t * tvbuff)
1486 guint len = tvb_length(tvbuff)-4;
1488 /* Check for invalid Length */
1490 return (0x00000000);
1491 return crc32_ccitt_tvb(tvbuff, len);
1495 decode_fcs(tvbuff_t *tvb, proto_tree *fh_tree, int fcs_decode, int proto_offset)
1498 gint len, reported_len;
1504 * Remove the FCS, if any, from the packet data.
1506 switch (fcs_decode) {
1509 next_tvb = tvb_new_subset(tvb, proto_offset, -1, -1);
1514 * Do we have the entire packet, and does it include a 2-byte FCS?
1516 len = tvb_length_remaining(tvb, proto_offset);
1517 reported_len = tvb_reported_length_remaining(tvb, proto_offset);
1518 if (reported_len < 2 || len < 0) {
1520 * The packet is claimed not to even have enough data for a 2-byte FCS,
1521 * or we're already past the end of the captured data.
1522 * Don't slice anything off.
1524 next_tvb = tvb_new_subset(tvb, proto_offset, -1, -1);
1525 } else if (len < reported_len) {
1527 * The packet is claimed to have enough data for a 2-byte FCS, but
1528 * we didn't capture all of the packet.
1529 * Slice off the 2-byte FCS from the reported length, and trim the
1530 * captured length so it's no more than the reported length; that
1531 * will slice off what of the FCS, if any, is in the captured
1535 if (len > reported_len)
1537 next_tvb = tvb_new_subset(tvb, proto_offset, len, reported_len);
1540 * We have the entire packet, and it includes a 2-byte FCS.
1545 next_tvb = tvb_new_subset(tvb, proto_offset, len, reported_len);
1548 * Compute the FCS and put it into the tree.
1550 rx_fcs_offset = proto_offset + len;
1551 rx_fcs_exp = fcs16(tvb);
1552 rx_fcs_got = tvb_get_letohs(tvb, rx_fcs_offset);
1553 if (rx_fcs_got != rx_fcs_exp) {
1554 proto_tree_add_text(fh_tree, tvb, rx_fcs_offset, 2,
1555 "FCS 16: 0x%04x [incorrect, should be 0x%04x]",
1556 rx_fcs_got, rx_fcs_exp);
1558 proto_tree_add_text(fh_tree, tvb, rx_fcs_offset, 2,
1559 "FCS 16: 0x%04x [correct]",
1567 * Do we have the entire packet, and does it include a 4-byte FCS?
1569 len = tvb_length_remaining(tvb, proto_offset);
1570 reported_len = tvb_reported_length_remaining(tvb, proto_offset);
1571 if (reported_len < 4) {
1573 * The packet is claimed not to even have enough data for a 4-byte FCS.
1574 * Just pass on the tvbuff as is.
1576 next_tvb = tvb_new_subset(tvb, proto_offset, -1, -1);
1577 } else if (len < reported_len) {
1579 * The packet is claimed to have enough data for a 4-byte FCS, but
1580 * we didn't capture all of the packet.
1581 * Slice off the 4-byte FCS from the reported length, and trim the
1582 * captured length so it's no more than the reported length; that
1583 * will slice off what of the FCS, if any, is in the captured
1587 if (len > reported_len)
1589 next_tvb = tvb_new_subset(tvb, proto_offset, len, reported_len);
1592 * We have the entire packet, and it includes a 4-byte FCS.
1597 next_tvb = tvb_new_subset(tvb, proto_offset, len, reported_len);
1600 * Compute the FCS and put it into the tree.
1602 rx_fcs_offset = proto_offset + len;
1603 rx_fcs_exp = fcs32(tvb);
1604 rx_fcs_got = tvb_get_letohl(tvb, rx_fcs_offset);
1605 if (rx_fcs_got != rx_fcs_exp) {
1606 proto_tree_add_text(fh_tree, tvb, rx_fcs_offset, 4,
1607 "FCS 32: 0x%08x [incorrect, should be 0x%08x]",
1608 rx_fcs_got, rx_fcs_exp);
1610 proto_tree_add_text(fh_tree, tvb, rx_fcs_offset, 4,
1611 "FCS 32: 0x%08x [correct]",
1618 DISSECTOR_ASSERT_NOT_REACHED();
1626 capture_ppp_hdlc( const guchar *pd, int offset, int len, packet_counts *ld ) {
1627 if (!BYTES_ARE_IN_FRAME(offset, len, 2)) {
1631 if (pd[0] == CHDLC_ADDR_UNICAST || pd[0] == CHDLC_ADDR_MULTICAST) {
1632 capture_chdlc(pd, offset, len, ld);
1635 if (!BYTES_ARE_IN_FRAME(offset, len, 4)) {
1639 switch (pntohs(&pd[offset + 2])) {
1641 capture_ip(pd, offset + 4, len, ld);
1656 dissect_lcp_mru_opt(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
1657 guint length, packet_info *pinfo _U_,
1660 proto_tree_add_text(tree, tvb, offset, length, "%s: %u", optp->name,
1661 tvb_get_ntohs(tvb, offset + 2));
1665 dissect_lcp_async_map_opt(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
1666 guint length, packet_info *pinfo _U_,
1671 static const char *ctrlchars[32] = {
1672 "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL",
1673 "BS", "HT", "NL", "VT", "NP (FF)", "CR", "SO", "SI",
1674 "DLE", "DC1 (XON)", "DC2", "DC3 (XOFF)", "DC4", "NAK", "SYN", "ETB",
1675 "CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US"
1677 size_t returned_length, str_index;
1681 * XXX - walk through the map and show the characters to map?
1682 * Put them in a subtree of this item, and have the top-level item
1683 * either say "None", "All", or give a list of the characters?)
1685 map = tvb_get_ntohl(tvb, offset + 2);
1686 if (map == 0x00000000)
1687 mapstr = "None"; /* don't map any control characters */
1688 else if (map == 0xffffffff)
1689 mapstr = "All"; /* map all control characters */
1691 #define MAX_MAPSTR_LEN (32*(10+2)+1)
1692 mapstr=ep_alloc(MAX_MAPSTR_LEN);
1694 * Show the names of the control characters being mapped.
1697 for (i = 0; i < 32; i++) {
1698 if (map & (1 << i)) {
1699 returned_length = g_snprintf(&mapstr[str_index], MAX_MAPSTR_LEN-str_index,
1700 "%s%s", str_index?"":", ", ctrlchars[i]);
1701 str_index += MIN(returned_length, MAX_MAPSTR_LEN-str_index);
1705 proto_tree_add_text(tree, tvb, offset, length, "%s: 0x%08x (%s)", optp->name,
1710 dissect_lcp_protocol_opt(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
1711 guint length, packet_info *pinfo _U_,
1716 proto_tree *field_tree = NULL;
1718 tf = proto_tree_add_text(tree, tvb, offset, length, "%s: %u byte%s",
1719 optp->name, length, plurality(length, "", "s"));
1720 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
1723 protocol = tvb_get_ntohs(tvb, offset);
1724 proto_tree_add_text(field_tree, tvb, offset, 2, "%s: %s (0x%02x)", optp->name,
1725 val_to_str(protocol, ppp_vals, "Unknown"), protocol);
1729 proto_tree_add_text(field_tree, tvb, offset, length, "Data (%d byte%s)", length,
1730 plurality(length, "", "s"));
1734 dissect_lcp_authprot_opt(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
1735 guint length, packet_info *pinfo _U_,
1741 proto_tree *field_tree = NULL;
1743 tf = proto_tree_add_text(tree, tvb, offset, length, "%s: %u byte%s",
1744 optp->name, length, plurality(length, "", "s"));
1745 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
1748 protocol = tvb_get_ntohs(tvb, offset);
1749 proto_tree_add_text(field_tree, tvb, offset, 2, "%s: %s (0x%02x)", optp->name,
1750 val_to_str(protocol, ppp_vals, "Unknown"), protocol);
1754 if (protocol == PPP_CHAP) {
1755 algorithm = tvb_get_guint8(tvb, offset);
1756 proto_tree_add_text(field_tree, tvb, offset, length,
1757 "Algorithm: %s (0x%02x)",
1758 val_to_str(algorithm, chap_alg_vals, "Unknown"),
1762 proto_tree_add_text(field_tree, tvb, offset, length, "Data (%d byte%s)", length,
1763 plurality(length, "", "s"));
1769 dissect_lcp_magicnumber_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1770 int offset, guint length, packet_info *pinfo _U_,
1773 proto_tree_add_text(tree, tvb, offset, length, "%s: 0x%08x", optp->name,
1774 tvb_get_ntohl(tvb, offset + 2));
1778 dissect_lcp_fcs_alternatives_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1779 int offset, guint length, packet_info *pinfo _U_,
1783 proto_tree *field_tree = NULL;
1784 guint8 alternatives;
1786 alternatives = tvb_get_guint8(tvb, offset + 2);
1787 tf = proto_tree_add_text(tree, tvb, offset, length, "%s: 0x%02x",
1788 optp->name, alternatives);
1789 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
1791 if (alternatives & 0x1)
1792 proto_tree_add_text(field_tree, tvb, offset + 2, 1, "%s",
1793 decode_boolean_bitfield(alternatives, 0x1, 8, "Null FCS", NULL));
1794 if (alternatives & 0x2)
1795 proto_tree_add_text(field_tree, tvb, offset + 2, 1, "%s",
1796 decode_boolean_bitfield(alternatives, 0x2, 8, "CCITT 16-bit FCS", NULL));
1797 if (alternatives & 0x4)
1798 proto_tree_add_text(field_tree, tvb, offset + 2, 1, "%s",
1799 decode_boolean_bitfield(alternatives, 0x4, 8, "CCITT 32-bit FCS", NULL));
1803 dissect_lcp_self_describing_pad_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1804 int offset, guint length, packet_info *pinfo _U_,
1807 proto_tree_add_text(tree, tvb, offset, length, "%s: %u", optp->name,
1808 tvb_get_guint8(tvb, offset + 2));
1812 dissect_lcp_numbered_mode_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1813 int offset, guint length, packet_info *pinfo _U_,
1817 proto_tree *field_tree = NULL;
1819 tf = proto_tree_add_text(tree, tvb, offset, length, "%s: %u byte%s",
1820 optp->name, length, plurality(length, "", "s"));
1821 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
1824 proto_tree_add_text(field_tree, tvb, offset, 1, "Window: %u",
1825 tvb_get_guint8(tvb, offset));
1829 proto_tree_add_text(field_tree, tvb, offset, length, "Address (%d byte%s)",
1830 length, plurality(length, "", "s"));
1833 static const value_string callback_op_vals[] = {
1834 {0, "Location is determined by user authentication" },
1835 {1, "Message is dialing string" },
1836 {2, "Message is location identifier" },
1837 {3, "Message is E.164" },
1838 {4, "Message is distinguished name" },
1840 {6, "Location is determined during CBCP negotiation" },
1845 dissect_lcp_callback_opt(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
1846 guint length, packet_info *pinfo _U_,
1850 proto_tree *field_tree = NULL;
1853 tf = proto_tree_add_text(tree, tvb, offset, length, "%s: %u byte%s",
1854 optp->name, length, plurality(length, "", "s"));
1855 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
1858 operation = tvb_get_guint8(tvb, offset);
1859 proto_tree_add_text(field_tree, tvb, offset, 1, "Operation: %s (0x%02x)",
1860 val_to_str(operation, callback_op_vals, "Unknown"),
1865 proto_tree_add_text(field_tree, tvb, offset, length, "Message (%d byte%s)",
1866 length, plurality(length, "", "s"));
1870 dissect_lcp_multilink_mrru_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1871 int offset, guint length, packet_info *pinfo _U_,
1874 proto_tree_add_text(tree, tvb, offset, length, "%s: %u", optp->name,
1875 tvb_get_ntohs(tvb, offset + 2));
1878 #define CLASS_NULL 0
1879 #define CLASS_LOCAL 1
1881 #define CLASS_IEEE_802_1 3
1882 #define CLASS_PPP_MAGIC_NUMBER 4
1883 #define CLASS_PSDN_DIRECTORY_NUMBER 5
1885 static const value_string multilink_ep_disc_class_vals[] = {
1886 {CLASS_NULL, "Null" },
1887 {CLASS_LOCAL, "Locally assigned address" },
1888 {CLASS_IP, "IP address" },
1889 {CLASS_IEEE_802_1, "IEEE 802.1 globally assigned MAC address" },
1890 {CLASS_PPP_MAGIC_NUMBER, "PPP magic-number block" },
1891 {CLASS_PSDN_DIRECTORY_NUMBER, "Public switched network directory number" },
1896 dissect_lcp_multilink_ep_disc_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1897 int offset, guint length, packet_info *pinfo _U_,
1901 proto_tree *field_tree = NULL;
1902 guint8 ep_disc_class;
1904 tf = proto_tree_add_text(tree, tvb, offset, length, "%s: %u byte%s",
1905 optp->name, length, plurality(length, "", "s"));
1906 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
1909 ep_disc_class = tvb_get_guint8(tvb, offset);
1910 proto_tree_add_text(field_tree, tvb, offset, 1, "Class: %s (%u)",
1911 val_to_str(ep_disc_class, multilink_ep_disc_class_vals, "Unknown"),
1916 switch (ep_disc_class) {
1919 proto_tree_add_text(field_tree, tvb, offset, length,
1920 "Address (%d byte%s), should have been empty",
1921 length, plurality(length, "", "s"));
1926 proto_tree_add_text(field_tree, tvb, offset, length,
1927 "Address (%d byte%s), should have been <20",
1928 length, plurality(length, "", "s"));
1930 proto_tree_add_text(field_tree, tvb, offset, length,
1931 "Address (%d byte%s)",
1932 length, plurality(length, "", "s"));
1938 proto_tree_add_text(field_tree, tvb, offset, length,
1939 "Address (%d byte%s), should have been 4",
1940 length, plurality(length, "", "s"));
1942 proto_tree_add_text(field_tree, tvb, offset, length,
1943 "Address: %s", ip_to_str(tvb_get_ptr(tvb, offset, 4)));
1947 case CLASS_IEEE_802_1:
1949 proto_tree_add_text(field_tree, tvb, offset, length,
1950 "Address (%d byte%s), should have been 6",
1951 length, plurality(length, "", "s"));
1953 proto_tree_add_text(field_tree, tvb, offset, length,
1954 "Address: %s", ether_to_str(tvb_get_ptr(tvb, offset, 6)));
1958 case CLASS_PPP_MAGIC_NUMBER:
1959 /* XXX - dissect as 32-bit magic numbers */
1961 proto_tree_add_text(field_tree, tvb, offset, length,
1962 "Address (%d byte%s), should have been <20",
1963 length, plurality(length, "", "s"));
1965 proto_tree_add_text(field_tree, tvb, offset, length,
1966 "Address (%d byte%s)",
1967 length, plurality(length, "", "s"));
1971 case CLASS_PSDN_DIRECTORY_NUMBER:
1973 proto_tree_add_text(field_tree, tvb, offset, length,
1974 "Address (%d byte%s), should have been <20",
1975 length, plurality(length, "", "s"));
1977 proto_tree_add_text(field_tree, tvb, offset, length,
1978 "Address (%d byte%s)",
1979 length, plurality(length, "", "s"));
1984 proto_tree_add_text(field_tree, tvb, offset, length,
1985 "Address (%d byte%s)",
1986 length, plurality(length, "", "s"));
1993 dissect_lcp_bap_link_discriminator_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1994 int offset, guint length, packet_info *pinfo _U_,
1997 proto_tree_add_text(tree, tvb, offset, length,
1998 "%s: 0x%04x", optp->name,
1999 tvb_get_ntohs(tvb, offset + 2));
2002 /* Character set numbers from the IANA charset registry. */
2003 static const value_string charset_num_vals[] = {
2009 dissect_lcp_internationalization_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2010 int offset, guint length, packet_info *pinfo _U_,
2014 proto_tree *field_tree = NULL;
2017 tf = proto_tree_add_text(tree, tvb, offset, length, "%s: %u byte%s",
2018 optp->name, length, plurality(length, "", "s"));
2019 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
2022 charset = tvb_get_ntohl(tvb, offset);
2023 proto_tree_add_text(field_tree, tvb, offset, 4, "Character set: %s (0x%04x)",
2024 val_to_str(charset, charset_num_vals, "Unknown"),
2029 /* XXX - should be displayed as an ASCII string */
2030 proto_tree_add_text(field_tree, tvb, offset, length, "Language tag (%d byte%s)",
2031 length, plurality(length, "", "s"));
2036 dissect_ipcp_addrs_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2037 int offset, guint length, packet_info *pinfo _U_,
2041 proto_tree *field_tree = NULL;
2043 tf = proto_tree_add_text(tree, tvb, offset, length, "%s: %u byte%s",
2044 optp->name, length, plurality(length, "", "s"));
2045 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
2048 proto_tree_add_text(field_tree, tvb, offset, 4,
2049 "Source IP address: %s",
2050 ip_to_str(tvb_get_ptr(tvb, offset, 4)));
2053 proto_tree_add_text(field_tree, tvb, offset, 4,
2054 "Destination IP address: %s",
2055 ip_to_str(tvb_get_ptr(tvb, offset, 4)));
2058 static void dissect_ipcp_addr_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2059 int offset, guint length, packet_info *pinfo _U_,
2062 proto_tree_add_text(tree, tvb, offset, length, "%s: %s", optp->name,
2063 ip_to_str(tvb_get_ptr(tvb, offset + 2, 4)));
2066 static void dissect_ipcp_compress_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2067 int offset, guint length, packet_info *pinfo _U_,
2073 proto_tree *field_tree = NULL;
2075 tf = proto_tree_add_text(tree, tvb, offset, length, "%s: %u byte%s",
2076 optp->name, length, plurality(length, "", "s"));
2078 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
2079 offset += 2; /* Skip option type + length */
2082 us = tvb_get_ntohs(tvb, offset);
2083 proto_tree_add_text( field_tree, tvb, offset, 2, "IP compression protocol: %s (0x%04x)",
2084 val_to_str( us, ipcp_compress_proto_vals, "Unknown protocol" ),
2086 offset += 2; /* skip protocol */
2091 case IPCP_COMPRESS_VJ_1172:
2092 case IPCP_COMPRESS_VJ:
2093 /* First byte is max slot id */
2094 ub = tvb_get_guint8( tvb, offset );
2095 proto_tree_add_text( field_tree, tvb, offset, 1,
2096 "Max slot id: %u (0x%02x)",
2102 /* second byte is "compress slot id" */
2103 ub = tvb_get_guint8( tvb, offset );
2104 proto_tree_add_text( field_tree, tvb, offset, 1,
2105 "Compress slot id: %s (0x%02x)",
2106 ub ? "yes" : "no", ub );
2113 case IPCP_COMPRESS_IPHC:
2117 us = tvb_get_ntohs(tvb, offset);
2118 proto_tree_add_text( field_tree, tvb, offset, 2,
2119 "TCP space: %u (0x%04x)",
2128 us = tvb_get_ntohs(tvb, offset);
2129 proto_tree_add_text( field_tree, tvb, offset, 2,
2130 "Non-TCP space: %u (0x%04x)",
2139 us = tvb_get_ntohs(tvb, offset);
2140 proto_tree_add_text( field_tree, tvb, offset, 2,
2141 "Max period: %u (0x%04x) compressed packets",
2150 us = tvb_get_ntohs(tvb, offset);
2151 proto_tree_add_text( field_tree, tvb, offset, 2,
2152 "Max time: %u (0x%04x) seconds",
2161 us = tvb_get_ntohs(tvb, offset);
2162 proto_tree_add_text( field_tree, tvb, offset, 2,
2163 "Max header: %u (0x%04x) bytes",
2170 tf = proto_tree_add_text(field_tree, tvb, offset, length,
2171 "Suboptions: (%u byte%s)",
2172 length, plurality(length, "", "s"));
2173 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
2174 dissect_ip_tcp_options(tvb, offset, length,
2175 ipcp_iphc_subopts, N_IPCP_IPHC_SUBOPTS, -1,
2182 proto_tree_add_text(field_tree, tvb, offset, length,
2183 "Data (%d byte%s)", length,
2184 plurality(length, "", "s"));
2189 static void dissect_ipcp_iphc_disableprot_opt(const ip_tcp_opt *optp,
2191 int offset, guint length,
2192 packet_info *pinfo _U_,
2196 proto_tree *field_tree;
2199 tf = proto_tree_add_text(tree, tvb, offset, length, "%s", optp->name);
2200 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
2202 param = tvb_get_guint8(tvb, offset + 2);
2203 proto_tree_add_text(field_tree, tvb, offset + 2, 1,
2204 "Protocol: %s (0x%02x)",
2205 val_to_str( param, ipcp_iphc_disable_proto_vals, "Unknown" ),
2210 static void dissect_osicp_align_npdu_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2211 int offset, guint length, packet_info *pinfo _U_,
2215 proto_tree *field_tree;
2218 tf = proto_tree_add_text(tree, tvb, offset, length, "%s", optp->name);
2219 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
2221 alignment = tvb_get_guint8(tvb, offset + 2);
2222 proto_tree_add_text(field_tree, tvb, offset + 2, 1,
2223 "Alignment: %u", alignment);
2226 static void dissect_pppmuxcp_def_pid_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2227 int offset, guint length, packet_info *pinfo _U_,
2230 pppmux_def_prot_id = tvb_get_ntohs(tvb, offset + 2);
2231 proto_tree_add_text(tree, tvb, offset + 2, length - 2, "%s: %s (0x%02x)",optp->name,
2232 val_to_str(pppmux_def_prot_id, ppp_vals, "Unknown"), pppmux_def_prot_id);
2237 dissect_ccp_stac_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2238 int offset, guint length, packet_info *pinfo _U_,
2242 proto_tree *field_tree;
2246 proto_tree_add_text(tree, tvb, offset, length,
2247 "%s (Ascend Proprietary version)", optp->name);
2248 /* We don't know how to decode the following 4 octets, since
2249 there's no public document that describe their usage. */
2251 tf = proto_tree_add_text(tree, tvb, offset, length, "%s", optp->name);
2252 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
2254 proto_tree_add_text(field_tree, tvb, offset + 2, 2,
2255 "History Count: %u", tvb_get_ntohs(tvb, offset + 2));
2256 check_mode = tvb_get_guint8(tvb, offset + 4);
2257 proto_tree_add_text(field_tree, tvb, offset + 4, 1,
2258 "Check Mode: %s (0x%02X)",
2259 val_to_str(check_mode, stac_checkmode_vals, "Unknown"),
2265 dissect_ccp_mppc_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2266 int offset, guint length, packet_info *pinfo _U_,
2270 proto_tree *flags_tree;
2271 guint32 supported_bits;
2273 supported_bits = tvb_get_ntohl(tvb, offset + 2);
2274 tf = proto_tree_add_text(tree, tvb, offset, length,
2275 "%s: Supported Bits: 0x%08X", optp->name, supported_bits);
2276 flags_tree = proto_item_add_subtree(tf, *optp->subtree_index);
2277 proto_tree_add_text(flags_tree, tvb, offset + 2, 4, "%s",
2278 decode_boolean_bitfield(supported_bits, MPPC_SUPPORTED_BITS_C, 8*4,
2279 "Desire to negotiate MPPC", "NO Desire to negotiate MPPC"));
2280 proto_tree_add_text(flags_tree, tvb, offset + 2, 4, "%s",
2281 decode_boolean_bitfield(supported_bits, MPPE_SUPPORTED_BITS_D, 8*4,
2282 "Obsolete (should NOT be 1)", "Obsolete (should ALWAYS be 0)"));
2283 proto_tree_add_text(flags_tree, tvb, offset + 2, 4, "%s",
2284 decode_boolean_bitfield(supported_bits, MPPE_SUPPORTED_BITS_L, 8*4,
2285 "40-bit encryption ON", "40-bit encryption OFF"));
2286 proto_tree_add_text(flags_tree, tvb, offset + 2, 4, "%s",
2287 decode_boolean_bitfield(supported_bits, MPPE_SUPPORTED_BITS_S, 8*4,
2288 "128-bit encryption ON", "128-bit encryption OFF"));
2289 proto_tree_add_text(flags_tree, tvb, offset + 2, 4, "%s",
2290 decode_boolean_bitfield(supported_bits, MPPE_SUPPORTED_BITS_M, 8*4,
2291 "56-bit encryption ON", "56-bit encryption OFF"));
2292 proto_tree_add_text(flags_tree, tvb, offset + 2, 4, "%s",
2293 decode_boolean_bitfield(supported_bits, MPPE_SUPPORTED_BITS_H, 8*4,
2294 "Stateless mode ON", "Stateless mode OFF"));
2298 dissect_ccp_bsdcomp_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2299 int offset, guint length, packet_info *pinfo _U_,
2303 proto_tree *field_tree;
2305 tf = proto_tree_add_text(tree, tvb, offset, length, "%s", optp->name);
2306 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
2308 proto_tree_add_text(field_tree, tvb, offset + 2, 1,
2309 "Version: %u", tvb_get_guint8(tvb, offset + 2) >> 5);
2310 proto_tree_add_text(field_tree, tvb, offset + 2, 1,
2312 tvb_get_guint8(tvb, offset + 2) & 0x1f);
2316 dissect_ccp_lzsdcp_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2317 int offset, guint length, packet_info *pinfo _U_,
2321 proto_tree *field_tree;
2323 guint8 process_mode;
2325 tf = proto_tree_add_text(tree, tvb, offset, length, "%s", optp->name);
2326 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
2328 proto_tree_add_text(field_tree, tvb, offset + 2, 2,
2329 "History Count: %u", tvb_get_ntohs(tvb, offset + 2));
2330 check_mode = tvb_get_guint8(tvb, offset + 4);
2331 proto_tree_add_text(field_tree, tvb, offset + 4, 1,
2332 "Check Mode: %s (0x%02X)",
2333 val_to_str(check_mode, lzsdcp_checkmode_vals, "Unknown"),
2335 process_mode = tvb_get_guint8(tvb, offset + 5);
2336 proto_tree_add_text(field_tree, tvb, offset + 5, 1,
2337 "Process Mode: %s (0x%02X)",
2338 val_to_str(process_mode, lzsdcp_processmode_vals, "Unkown"),
2343 dissect_ccp_mvrca_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2344 int offset, guint length, packet_info *pinfo _U_,
2348 proto_tree *field_tree;
2350 tf = proto_tree_add_text(tree, tvb, offset, length, "%s", optp->name);
2351 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
2353 proto_tree_add_text(field_tree, tvb, offset + 2, 1,
2354 "Features: %u", tvb_get_guint8(tvb, offset + 2) >> 5);
2355 proto_tree_add_text(field_tree, tvb, offset + 2, 1,
2356 "Packet by Packet flag: %s",
2357 tvb_get_guint8(tvb, offset + 2) & 0x20 ? "true" : "false");
2358 proto_tree_add_text(field_tree, tvb, offset + 2, 1,
2359 "History: %u", tvb_get_guint8(tvb, offset + 2) & 0x20);
2360 proto_tree_add_text(field_tree, tvb, offset + 3, 1,
2361 "Number of contexts: %u", tvb_get_guint8(tvb, offset + 3));
2365 dissect_ccp_deflate_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2366 int offset, guint length, packet_info *pinfo _U_,
2370 proto_tree *field_tree;
2373 tf = proto_tree_add_text(tree, tvb, offset, length, "%s", optp->name);
2374 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
2376 proto_tree_add_text(field_tree, tvb, offset + 2, 1,
2377 "Window: %u", hi_nibble(tvb_get_guint8(tvb, offset + 2)));
2378 method = lo_nibble(tvb_get_guint8(tvb, offset + 2));
2379 proto_tree_add_text(field_tree, tvb, offset + 2, 1,
2380 "Method: %s (0x%02x)",
2381 method == 0x08 ? "zlib compression" : "other", method);
2382 proto_tree_add_text(field_tree, tvb, offset + 3, 1,
2383 "Sequence number check method: %u",
2384 tvb_get_guint8(tvb, offset + 2) & 0x03);
2388 dissect_cbcp_no_callback_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2389 int offset, guint length, packet_info *pinfo _U_,
2392 proto_tree_add_text(tree, tvb, offset, length, "%s", optp->name);
2396 dissect_cbcp_callback_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2397 int offset, guint length, packet_info *pinfo _U_,
2401 proto_tree *field_tree;
2403 proto_tree *addr_tree;
2407 tf = proto_tree_add_text(tree, tvb, offset, length, "%s", optp->name);
2408 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
2410 proto_tree_add_text(field_tree, tvb, offset + 2, 1,
2411 "Callback delay: %u", tvb_get_guint8(tvb, offset + 2));
2415 while (length > 0) {
2416 ta = proto_tree_add_text(field_tree, tvb, offset, length,
2417 "Callback Address");
2418 addr_type = tvb_get_guint8(tvb, offset);
2419 addr_tree = proto_item_add_subtree(tf, ett_cbcp_callback_opt_addr);
2420 proto_tree_add_text(addr_tree, tvb, offset, 1,
2421 "Address Type: %s (%u)",
2422 ((addr_type == 1) ? "PSTN/ISDN" : "Other"), addr_type);
2425 addr_len = tvb_strsize(tvb, offset);
2426 if (addr_len > length) {
2427 proto_tree_add_text(addr_tree, tvb, offset, length,
2428 "Address: (runs past end of option)");
2431 proto_tree_add_text(addr_tree, tvb, offset, addr_len,
2433 tvb_format_text(tvb, offset, addr_len - 1));
2440 dissect_bacp_favored_peer_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2441 int offset, guint length, packet_info *pinfo _U_,
2445 proto_tree *field_tree;
2447 tf = proto_tree_add_text(tree, tvb, offset, length, "%s", optp->name);
2448 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
2450 proto_tree_add_text(field_tree, tvb, offset + 2, 4,
2451 "Magic number: 0x%08x", tvb_get_ntohl(tvb, offset + 2));
2455 dissect_bap_link_type_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2456 int offset, guint length, packet_info *pinfo _U_,
2460 proto_tree *field_tree;
2463 tf = proto_tree_add_text(tree, tvb, offset, length, "%s", optp->name);
2464 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
2466 proto_tree_add_text(field_tree, tvb, offset + 2, 2,
2467 "Link Speed: %u kbps", tvb_get_ntohs(tvb, offset + 2));
2468 link_type = tvb_get_guint8(tvb, offset + 4);
2469 proto_tree_add_text(field_tree, tvb, offset + 4, 1,
2470 "Link Type: %s (%u)", val_to_str(link_type, bap_link_type_vals,
2471 "Unknown"), link_type);
2475 dissect_bap_phone_delta_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2476 int offset, guint length, packet_info *pinfo _U_,
2480 proto_tree *field_tree;
2482 proto_tree *suboption_tree;
2486 tf = proto_tree_add_text(tree, tvb, offset, length, "%s", optp->name);
2487 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
2492 while (length > 0) {
2493 subopt_type = tvb_get_guint8(tvb, offset);
2494 subopt_len = tvb_get_guint8(tvb, offset + 1);
2495 ti = proto_tree_add_text(field_tree, tvb, offset, subopt_len,
2496 "Sub-Option (%u byte%s)",
2497 subopt_len, plurality(subopt_len, "", "s"));
2498 suboption_tree = proto_item_add_subtree(ti, ett_bap_phone_delta_subopt);
2500 proto_tree_add_text(suboption_tree, tvb, offset, 1,
2501 "Sub-Option Type: %s (%u)",
2502 val_to_str(subopt_type, bap_phone_delta_subopt_vals, "Unknown"),
2505 if (subopt_len < 2) {
2506 proto_tree_add_text(suboption_tree, tvb, offset + 1, 1,
2507 "Sub-Option Length: %u (invalid, must be >= 2)", subopt_len);
2510 if (subopt_len > length) {
2511 proto_tree_add_text(suboption_tree, tvb, offset + 1, 1,
2512 "Sub-Option Length: %u (invalid, must be <= length remaining in option %u)", subopt_len, length);
2516 proto_tree_add_text(suboption_tree, tvb, offset + 1, 1,
2517 "Sub-Option Length: %u", subopt_len);
2519 switch (subopt_type) {
2520 case BAP_PHONE_DELTA_SUBOPT_UNIQ_DIGIT:
2521 if (subopt_len == 3) {
2522 proto_tree_add_text(suboption_tree, tvb, offset + 2, 1, "Unique Digit: %u",
2523 tvb_get_guint8(tvb, offset + 2));
2525 proto_tree_add_text(suboption_tree, tvb, offset + 1, 1,
2526 "Invalid suboption length: %u (must be == 3)",
2530 case BAP_PHONE_DELTA_SUBOPT_SUBSC_NUM:
2531 if (subopt_len > 2) {
2532 proto_tree_add_text(suboption_tree, tvb, offset + 2, subopt_len - 2,
2533 "Subscriber Number: %s",
2534 tvb_format_text(tvb, offset + 2, subopt_len - 2));
2536 proto_tree_add_text(suboption_tree, tvb, offset + 1, 1,
2537 "Invalid suboption length: %u (must be > 2)",
2541 case BAP_PHONE_DELTA_SUBOPT_PHONENUM_SUBADDR:
2542 if (subopt_len > 2) {
2543 proto_tree_add_text(suboption_tree, tvb, offset + 2, subopt_len - 2,
2544 "Phone Number Sub Address: %s",
2545 tvb_format_text(tvb, offset + 2, subopt_len - 2));
2547 proto_tree_add_text(suboption_tree, tvb, offset + 1, 1,
2548 "Invalid suboption length: %u (must be > 2)",
2553 if (subopt_len > 2) {
2554 proto_tree_add_text(suboption_tree, tvb, offset + 2, subopt_len - 2,
2557 proto_tree_add_text(suboption_tree, tvb, offset + 1, 1,
2558 "Invalid suboption length: %u (must be > 2)",
2563 offset += subopt_len;
2564 length -= subopt_len;
2569 dissect_bap_reason_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2570 int offset, guint length, packet_info *pinfo _U_,
2574 proto_tree_add_text(tree, tvb, offset, length, "%s: %s",
2576 tvb_format_text(tvb, offset + 2, length - 2));
2581 dissect_bap_link_disc_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2582 int offset, guint length, packet_info *pinfo _U_,
2585 proto_tree_add_text(tree, tvb, offset, length, "%s: 0x%04x",
2586 optp->name, tvb_get_ntohs(tvb, offset + 2));
2590 dissect_bap_call_status_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2591 int offset, guint length, packet_info *pinfo _U_,
2595 proto_tree *field_tree;
2596 guint8 status, action;
2598 tf = proto_tree_add_text(tree, tvb, offset, length, "%s", optp->name);
2599 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
2601 status = tvb_get_guint8(tvb, offset + 2);
2602 proto_tree_add_text(field_tree, tvb, offset + 2, 1,
2603 "Status: %s (0x%02x)",
2604 val_to_str(status, q931_cause_code_vals, "Unknown"), status);
2606 action = tvb_get_guint8(tvb, offset + 3);
2607 proto_tree_add_text(field_tree, tvb, offset + 3, 1,
2608 "Action: %s (0x%02x)",
2609 val_to_str(action, bap_call_status_opt_action_vals, "Unknown"), action);
2613 dissect_cp( tvbuff_t *tvb, int proto_id, int proto_subtree_index,
2614 const value_string *proto_vals, int options_subtree_index,
2615 const ip_tcp_opt *opts, int nopts, packet_info *pinfo,
2619 proto_tree *fh_tree = NULL;
2621 proto_tree *field_tree;
2628 code = tvb_get_guint8(tvb, 0);
2629 id = tvb_get_guint8(tvb, 1);
2630 length = tvb_get_ntohs(tvb, 2);
2632 if(check_col(pinfo->cinfo, COL_PROTOCOL))
2633 col_set_str(pinfo->cinfo, COL_PROTOCOL,
2634 proto_get_protocol_short_name(find_protocol_by_id(proto_id)));
2636 if(check_col(pinfo->cinfo, COL_INFO))
2637 col_add_str(pinfo->cinfo, COL_INFO,
2638 val_to_str(code, proto_vals, "Unknown"));
2641 ti = proto_tree_add_item(tree, proto_id, tvb, 0, length, FALSE);
2642 fh_tree = proto_item_add_subtree(ti, proto_subtree_index);
2643 proto_tree_add_text(fh_tree, tvb, 0, 1, "Code: %s (0x%02x)",
2644 val_to_str(code, proto_vals, "Unknown"), code);
2645 proto_tree_add_text(fh_tree, tvb, 1, 1, "Identifier: 0x%02x",
2647 proto_tree_add_text(fh_tree, tvb, 2, 2, "Length: %u",
2660 tf = proto_tree_add_text(fh_tree, tvb, offset, length,
2661 "Options: (%d byte%s)", length, plurality(length, "", "s"));
2662 field_tree = proto_item_add_subtree(tf, options_subtree_index);
2663 dissect_ip_tcp_options(tvb, offset, length, opts, nopts, -1,
2673 proto_tree_add_text(fh_tree, tvb, offset, 4, "Magic number: 0x%08x",
2674 tvb_get_ntohl(tvb, offset));
2678 proto_tree_add_text(fh_tree, tvb, offset, length, "Message (%d byte%s)",
2679 length, plurality(length, "", "s"));
2685 proto_tree_add_text(fh_tree, tvb, offset, 4, "Magic number: 0x%08x",
2686 tvb_get_ntohl(tvb, offset));
2690 proto_tree_add_text(fh_tree, tvb, offset, length, "Message: %s",
2691 tvb_format_text(tvb, offset, length));
2697 proto_tree_add_text(fh_tree, tvb, offset, 4, "Magic number: 0x%08x",
2698 tvb_get_ntohl(tvb, offset));
2701 proto_tree_add_text(fh_tree, tvb, offset, 4, "Seconds remaining: %u",
2702 tvb_get_ntohl(tvb, offset));
2706 proto_tree_add_text(fh_tree, tvb, offset, length, "Message (%d byte%s)",
2707 length, plurality(length, "", "s"));
2713 gboolean save_in_error_pkt;
2716 protocol = tvb_get_ntohs(tvb, offset);
2717 proto_tree_add_text(fh_tree, tvb, offset, 2,
2718 "Rejected protocol: %s (0x%04x)",
2719 val_to_str(protocol, ppp_vals, "Unknown"),
2724 proto_tree_add_text(fh_tree, tvb, offset, length,
2725 "Rejected packet (%d byte%s)",
2726 length, plurality(length, "", "s"));
2728 /* Save the current value of the "we're inside an error packet"
2729 flag, and set that flag; subdissectors may treat packets
2730 that are the payload of error packets differently from
2732 save_in_error_pkt = pinfo->in_error_pkt;
2733 pinfo->in_error_pkt = TRUE;
2735 /* Decode the rejected packet. */
2736 next_tvb = tvb_new_subset(tvb, offset, length, length);
2737 if (!dissector_try_port(ppp_subdissector_table, protocol,
2738 next_tvb, pinfo, fh_tree)) {
2739 call_dissector(data_handle, next_tvb, pinfo, fh_tree);
2742 /* Restore the "we're inside an error packet" flag. */
2743 pinfo->in_error_pkt = save_in_error_pkt;
2749 /* decode the rejected LCP packet here. */
2751 proto_tree_add_text(fh_tree, tvb, offset, length, "Rejected packet (%d byte%s)",
2752 length, plurality(length, "", "s"));
2758 proto_tree_add_text(fh_tree, tvb, offset, length, "Data (%d byte%s)",
2759 length, plurality(length, "", "s"));
2764 proto_tree_add_text(fh_tree, tvb, offset, length, "Stuff (%d byte%s)",
2765 length, plurality(length, "", "s"));
2770 /* Protocol field compression */
2771 #define PFC_BIT 0x01
2774 dissect_ppp_common( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
2775 proto_tree *fh_tree, proto_item *ti, int proto_offset )
2781 ppp_prot = tvb_get_guint8(tvb, 0);
2782 if (ppp_prot & PFC_BIT) {
2783 /* Compressed protocol field - just the byte we fetched. */
2786 /* Uncompressed protocol field - fetch all of it. */
2787 ppp_prot = tvb_get_ntohs(tvb, 0);
2791 /* If "ti" is not null, it refers to the top-level "proto_ppp" item
2792 for PPP, and proto_offset is the length of any stuff in the header
2793 preceding the protocol type, e.g. an HDLC header; add the length
2794 of the protocol type field to it, and set the length of that item
2797 proto_item_set_len(ti, proto_offset + proto_len);
2800 proto_tree_add_uint(fh_tree, hf_ppp_protocol, tvb, 0, proto_len, ppp_prot);
2802 next_tvb = tvb_new_subset(tvb, proto_len, -1, -1);
2804 /* do lookup with the subdissector table */
2805 if (!dissector_try_port(ppp_subdissector_table, ppp_prot, next_tvb, pinfo, tree)) {
2806 if (check_col(pinfo->cinfo, COL_PROTOCOL))
2807 col_add_fstr(pinfo->cinfo, COL_PROTOCOL, "0x%04x", ppp_prot);
2808 if (check_col(pinfo->cinfo, COL_INFO))
2809 col_add_fstr(pinfo->cinfo, COL_INFO, "PPP %s (0x%04x)",
2810 val_to_str(ppp_prot, ppp_vals, "Unknown"), ppp_prot);
2811 call_dissector(data_handle,next_tvb, pinfo, tree);
2816 dissect_lcp_options(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2818 dissect_ip_tcp_options(tvb, 0, tvb_reported_length(tvb), lcp_opts, N_LCP_OPTS,
2826 dissect_lcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2828 dissect_cp(tvb, proto_lcp, ett_lcp, lcp_vals, ett_lcp_options,
2829 lcp_opts, N_LCP_OPTS, pinfo, tree);
2836 dissect_ipcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2838 dissect_cp(tvb, proto_ipcp, ett_ipcp, cp_vals, ett_ipcp_options,
2839 ipcp_opts, N_IPCP_OPTS, pinfo, tree);
2846 dissect_bcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2849 next_tvb = tvb_new_subset(tvb, 2, -1, -1);
2850 call_dissector(eth_withfcs_handle, next_tvb, pinfo, tree);
2857 dissect_osicp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2859 dissect_cp(tvb, proto_osicp, ett_osicp, cp_vals, ett_osicp_options,
2860 osicp_opts, N_OSICP_OPTS, pinfo, tree);
2867 dissect_ccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2869 dissect_cp(tvb, proto_ccp, ett_ccp, ccp_vals, ett_ccp_options,
2870 ccp_opts, N_CCP_OPTS, pinfo, tree);
2874 * Callback Control Protocol - see
2876 * http://www.linet.gr.jp/~manabe/PPxP/doc/Standards/draft-gidwani-ppp-callback-cp-00.txt
2879 dissect_cbcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2881 dissect_cp(tvb, proto_cbcp, ett_cbcp, cbcp_vals, ett_cbcp_options,
2882 cbcp_opts, N_CBCP_OPTS, pinfo, tree);
2886 * RFC 2125 (BACP and BAP).
2889 dissect_bacp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2891 dissect_cp(tvb, proto_bacp, ett_bacp, cp_vals, ett_bacp_options,
2892 bacp_opts, N_BACP_OPTS, pinfo, tree);
2896 dissect_bap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2899 proto_tree *fh_tree = NULL;
2901 proto_tree *field_tree;
2908 type = tvb_get_guint8(tvb, 0);
2909 id = tvb_get_guint8(tvb, 1);
2910 length = tvb_get_ntohs(tvb, 2);
2912 if(check_col(pinfo->cinfo, COL_PROTOCOL))
2913 col_set_str(pinfo->cinfo, COL_PROTOCOL, "PPP BAP");
2915 if(check_col(pinfo->cinfo, COL_INFO))
2916 col_add_str(pinfo->cinfo, COL_INFO,
2917 val_to_str(type, bap_vals, "Unknown"));
2920 ti = proto_tree_add_item(tree, proto_bap, tvb, 0, length, FALSE);
2921 fh_tree = proto_item_add_subtree(ti, ett_bap_options);
2922 proto_tree_add_text(fh_tree, tvb, 0, 1, "Type: %s (0x%02x)",
2923 val_to_str(type, bap_vals, "Unknown"), type);
2924 proto_tree_add_text(fh_tree, tvb, 1, 1, "Identifier: 0x%02x",
2926 proto_tree_add_text(fh_tree, tvb, 2, 2, "Length: %u",
2932 if (type == BAP_CRES || type == BAP_CBRES ||
2933 type == BAP_LDQRES || type == BAP_CSRES) {
2934 resp_code = tvb_get_guint8(tvb, offset);
2935 proto_tree_add_text(fh_tree, tvb, offset, 1, "Response Code: %s (0x%02x)",
2936 val_to_str(resp_code, bap_resp_code_vals, "Unknown"), resp_code);
2943 tf = proto_tree_add_text(fh_tree, tvb, offset, length,
2944 "Data (%d byte%s)", length, plurality(length, "", "s"));
2945 field_tree = proto_item_add_subtree(tf, ett_bap_options);
2946 dissect_ip_tcp_options(tvb, offset, length, bap_opts, N_BAP_OPTS, -1,
2953 dissect_comp_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2956 proto_tree *comp_data_tree;
2958 if (check_col(pinfo->cinfo, COL_PROTOCOL))
2959 col_set_str(pinfo->cinfo, COL_PROTOCOL, "PPP Comp");
2961 if(check_col(pinfo->cinfo, COL_INFO))
2962 col_set_str(pinfo->cinfo, COL_INFO, "Compressed data");
2965 ti = proto_tree_add_item(tree, proto_comp_data, tvb, 0, -1, FALSE);
2966 comp_data_tree = proto_item_add_subtree(ti, ett_comp_data);
2971 * RFC 3153 (both PPPMuxCP and PPPMux).
2974 dissect_pppmuxcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2976 dissect_cp(tvb,proto_pppmuxcp,ett_pppmuxcp,pppmuxcp_vals,
2977 ett_pppmuxcp_options,pppmuxcp_opts,N_PPPMUXCP_OPTS,pinfo,tree);
2980 #define PPPMUX_FLAGS_MASK 0xc0
2981 #define PPPMUX_PFF_BIT_SET 0x80
2982 #define PPPMUX_LXT_BIT_SET 0x40
2985 dissect_pppmux(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2987 proto_tree *mux_tree, *hdr_tree, *sub_tree, *flag_tree;
2988 proto_tree *info_tree;
2989 proto_item *ti = NULL,*sub_ti = NULL;
2994 int offset = 0, length_remaining;
2995 int length_field = 0, pid_field = 0,hdr_length = 0;
2997 if (check_col(pinfo->cinfo, COL_PROTOCOL))
2998 col_set_str(pinfo->cinfo,COL_PROTOCOL, "PPP PPPMux");
3000 if (check_col(pinfo->cinfo, COL_INFO))
3001 col_set_str(pinfo->cinfo, COL_INFO, "PPP Multiplexing");
3003 length_remaining = tvb_reported_length(tvb);
3006 ti = proto_tree_add_item(tree, proto_pppmux, tvb, 0, -1, FALSE);
3007 mux_tree = proto_item_add_subtree(ti,ett_pppmux);
3009 while (length_remaining > 0) {
3011 flags = tvb_get_guint8(tvb,offset) & PPPMUX_FLAGS_MASK;
3013 if (flags & PPPMUX_LXT_BIT_SET ) {
3014 length = tvb_get_ntohs(tvb,offset) & 0x3fff;
3017 length = tvb_get_guint8(tvb,offset) & 0x3f;
3021 if (flags & PPPMUX_PFF_BIT_SET) {
3022 byte = tvb_get_guint8(tvb,offset + length_field);
3023 if (byte & PFC_BIT) { /* Compressed PID field*/
3026 } else { /*PID field is 2 bytes*/
3027 pid = tvb_get_ntohs(tvb,offset + length_field);
3031 pid_field = 0; /*PID field is 0 bytes*/
3032 if (!pid){ /*No Last PID, hence use the default */
3033 if (pppmux_def_prot_id)
3034 pid = pppmux_def_prot_id;
3038 hdr_length = length_field + pid_field;
3040 ti = proto_tree_add_text(mux_tree, tvb, offset, length + length_field,
3041 "PPPMux Sub-frame");
3042 sub_tree = proto_item_add_subtree(ti,ett_pppmux_subframe);
3043 sub_ti = proto_tree_add_text(sub_tree, tvb, offset,
3044 hdr_length,"Header field");
3046 hdr_tree = proto_item_add_subtree(sub_ti,ett_pppmux_subframe_hdr);
3047 ti = proto_tree_add_text(hdr_tree, tvb, offset, length_field, "PFF/LXT: 0x%02X",
3050 flag_tree = proto_item_add_subtree(ti,ett_pppmux_subframe_flags);
3051 proto_tree_add_text(flag_tree,tvb,offset,length_field,"%s",
3052 decode_boolean_bitfield(flags,0x80,8,"PID Present","PID not present"));
3053 proto_tree_add_text(flag_tree,tvb,offset,length_field,"%s",
3054 decode_boolean_bitfield(flags,0x40,8,"2 bytes length field ","1 byte length field"));
3056 ti = proto_tree_add_text(hdr_tree,tvb,offset,length_field,"Sub-frame Length = %u",length);
3058 ti = proto_tree_add_uint(hdr_tree,hf_pppmux_protocol,tvb,offset + length_field,pid_field, pid);
3060 /* if protocol is not present in the sub-frame */
3061 if (!(flags & PPPMUX_PFF_BIT_SET))
3062 /* mark this item as generated */
3063 PROTO_ITEM_SET_GENERATED(ti);
3065 offset += hdr_length;
3066 length_remaining -= hdr_length;
3067 length -= pid_field;
3069 tvb_ensure_bytes_exist (tvb,offset,length);
3070 sub_ti = proto_tree_add_text(sub_tree,tvb,offset,length,"Information Field");
3071 info_tree = proto_item_add_subtree(sub_ti,ett_pppmux_subframe_info);
3073 next_tvb = tvb_new_subset(tvb,offset,length,length);
3075 if (!dissector_try_port(ppp_subdissector_table, pid, next_tvb, pinfo, info_tree)) {
3076 call_dissector(data_handle, next_tvb, pinfo, info_tree);
3079 length_remaining -= length;
3080 } /* While length_remaining */
3086 * RFC 2508 Internet Protocol Header Compression
3089 #define IPHC_CRTP_FH_FLAG_MASK 0xc0
3090 #define IPHC_CRTP_FH_FLAG_POS 6
3091 #define IPHC_CRTP_FH_CID8 1
3092 #define IPHC_CRTP_FH_CID16 3
3094 #define IPHC_CRTP_CS_CID8 1
3095 #define IPHC_CRTP_CS_CID16 2
3097 static const value_string iphc_crtp_fh_flags[] = {
3098 {IPHC_CRTP_FH_CID8, "8-bit Context Id" },
3099 {IPHC_CRTP_FH_CID16, "16-bit Context Id" },
3103 static const value_string iphc_crtp_cs_flags[] = {
3104 {IPHC_CRTP_CS_CID8, "8-bit Context Id" },
3105 {IPHC_CRTP_CS_CID16, "16-bit Context Id" },
3110 * 0x61 Packets: Full IP/UDP Header
3114 dissect_iphc_crtp_fh(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
3116 proto_tree *fh_tree, *info_tree;
3117 proto_item *ti = NULL;
3119 guint ip_hdr_len, flags;
3128 guint8 next_protocol;
3132 length = tvb_reported_length(tvb);
3134 if (check_col(pinfo->cinfo, COL_PROTOCOL))
3135 col_set_str(pinfo->cinfo,COL_PROTOCOL, "CRTP");
3137 if (check_col(pinfo->cinfo, COL_INFO))
3138 col_add_str(pinfo->cinfo, COL_INFO, "Full Header");
3140 /* only dissect IPv4 and UDP */
3141 ip_version = tvb_get_guint8(tvb, 0) >> 4;
3142 next_protocol = tvb_get_guint8(tvb, 9);
3144 DISSECTOR_ASSERT((ip_version == 4) && (next_protocol == IP_PROTO_UDP));
3148 ti = proto_tree_add_protocol_format(tree, proto_iphc_crtp, tvb, 0, -1,
3149 "%s", val_to_str(PPP_RTP_FH, ppp_vals, "Unknown"));
3150 fh_tree = proto_item_add_subtree(ti, ett_iphc_crtp);
3152 flags = (tvb_get_guint8(tvb, 2) & IPHC_CRTP_FH_FLAG_MASK) >> IPHC_CRTP_FH_FLAG_POS;
3154 /* calculate length of IP header, assume IPv4 */
3155 ip_hdr_len = (tvb_get_guint8(tvb, 0) & 0x0f) * 4;
3157 /* calculate total hdr length, assume UDP */
3158 hdr_len = ip_hdr_len + 8;
3161 ti = proto_tree_add_item(fh_tree, hf_iphc_crtp_fh_flags, tvb, 2, 1, FALSE);
3163 /* generation field */
3164 ti = proto_tree_add_item(fh_tree, hf_iphc_crtp_gen, tvb, 2, 1, FALSE);
3166 /* context id and sequence fields */
3169 case IPHC_CRTP_FH_CID8:
3171 offset_seq = ip_hdr_len + 5;
3172 ti = proto_tree_add_item(fh_tree, hf_iphc_crtp_cid8, tvb, offset_cid, 1, FALSE);
3173 ti = proto_tree_add_item(fh_tree, hf_iphc_crtp_seq, tvb, offset_seq, 1, FALSE);
3176 case IPHC_CRTP_FH_CID16:
3178 offset_cid = ip_hdr_len + 4;
3179 ti = proto_tree_add_item(fh_tree, hf_iphc_crtp_seq, tvb, offset_seq, 1, FALSE);
3180 ti = proto_tree_add_item(fh_tree, hf_iphc_crtp_cid16, tvb, offset_cid, 2, FALSE);
3184 /* information field */
3185 tvb_ensure_bytes_exist (tvb, 0, length);
3186 ti = proto_tree_add_text(fh_tree, tvb, 0,length,"Information Field");
3187 info_tree = proto_item_add_subtree(ti,ett_iphc_crtp_info);
3189 /* allocate a copy of the IP packet */
3190 ip_packet = tvb_memdup(tvb, 0, length);
3192 /* restore the proper values to the IP and UDP length fields */
3193 ip_packet[2] = length >> 8;
3194 ip_packet[3] = length;
3196 ip_packet[ip_hdr_len + 4] = (length - ip_hdr_len) >> 8;
3197 ip_packet[ip_hdr_len + 5] = (length - ip_hdr_len);
3199 next_tvb = tvb_new_real_data(ip_packet, length, length);
3200 tvb_set_child_real_data_tvbuff(tvb, next_tvb);
3201 add_new_data_source(pinfo, next_tvb, "Decompressed Data");
3202 tvb_set_free_cb(next_tvb, g_free);
3204 if (!dissector_try_port(ppp_subdissector_table, PPP_IP, next_tvb, pinfo, info_tree)) {
3205 call_dissector_only(data_handle, next_tvb, pinfo, info_tree);
3211 * 0x2067 Packets: Compressed UDP with 16-bit Context Identifier
3214 dissect_iphc_crtp_cudp16(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
3216 proto_tree *cudp_tree;
3217 proto_item *ti = NULL;
3222 if (check_col(pinfo->cinfo, COL_PROTOCOL))
3223 col_set_str(pinfo->cinfo,COL_PROTOCOL, "CRTP");
3225 if (check_col(pinfo->cinfo, COL_INFO))
3226 col_add_str(pinfo->cinfo, COL_INFO, "Compressed UDP 16");
3228 length = tvb_reported_length(tvb);
3231 ti = proto_tree_add_protocol_format(tree, proto_iphc_crtp, tvb, 0, -1,
3232 "%s", val_to_str(PPP_RTP_CUDP16, ppp_vals, "Unknown"));
3233 cudp_tree = proto_item_add_subtree(ti, ett_iphc_crtp);
3237 ti = proto_tree_add_item(cudp_tree, hf_iphc_crtp_cid16, tvb, 0, 2, FALSE);
3238 ti = proto_tree_add_item(cudp_tree, hf_iphc_crtp_seq, tvb, 2, 1, FALSE);
3240 offset += hdr_length;
3241 length -= hdr_length;
3243 ti = proto_tree_add_text(cudp_tree, tvb, offset, length, "Data (%d bytes)", length);
3248 * 0x67 Packets: Compressed UDP with 8-bit Context Identifier
3251 dissect_iphc_crtp_cudp8(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
3253 proto_tree *cudp_tree;
3254 proto_item *ti = NULL;
3259 if (check_col(pinfo->cinfo, COL_PROTOCOL))
3260 col_set_str(pinfo->cinfo,COL_PROTOCOL, "CRTP");
3262 if (check_col(pinfo->cinfo, COL_INFO))
3263 col_add_str(pinfo->cinfo, COL_INFO, "Compressed UDP 8");
3265 length = tvb_reported_length(tvb);
3268 ti = proto_tree_add_protocol_format(tree, proto_iphc_crtp, tvb, 0, -1,
3269 "%s", val_to_str(PPP_RTP_CUDP8, ppp_vals, "Unknown"));
3270 cudp_tree = proto_item_add_subtree(ti, ett_iphc_crtp);
3274 ti = proto_tree_add_item(cudp_tree, hf_iphc_crtp_cid8, tvb, 0, 1, FALSE);
3275 ti = proto_tree_add_item(cudp_tree, hf_iphc_crtp_seq, tvb, 1, 1, FALSE);
3277 offset += hdr_length;
3278 length -= hdr_length;
3280 ti = proto_tree_add_text(cudp_tree, tvb, offset, length, "Data (%d bytes)", length);
3286 * 0x2065 Packets: Context State
3289 dissect_iphc_crtp_cs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
3291 proto_tree *cs_tree;
3292 proto_item *ti = NULL;
3294 guint length, cid_size;
3295 guint offset = 2, hf;
3297 if (check_col(pinfo->cinfo, COL_PROTOCOL))
3298 col_set_str(pinfo->cinfo,COL_PROTOCOL, "CRTP");
3300 if (check_col(pinfo->cinfo, COL_INFO))
3301 col_add_str(pinfo->cinfo, COL_INFO, "Context State");
3305 ti = proto_tree_add_protocol_format(tree, proto_iphc_crtp, tvb, 0, -1,
3306 "%s", val_to_str(PPP_RTP_CS, ppp_vals, "Unknown"));
3308 cs_tree = proto_item_add_subtree(ti, ett_iphc_crtp);
3310 ti = proto_tree_add_item(cs_tree, hf_iphc_crtp_cs_flags, tvb, 0, 1, FALSE);
3311 ti = proto_tree_add_item(cs_tree, hf_iphc_crtp_cs_cnt, tvb, 1, 1, FALSE);
3313 /* calculate required length */
3314 flags = tvb_get_guint8(tvb, 0);
3315 cnt = tvb_get_guint8(tvb, 1);
3317 if (flags == IPHC_CRTP_CS_CID8) {
3318 hf = hf_iphc_crtp_cid8;
3322 hf = hf_iphc_crtp_cid16;
3327 tvb_ensure_bytes_exist(tvb, offset, length);
3329 while (offset < length) {
3330 ti = proto_tree_add_item(cs_tree, hf, tvb, offset, cid_size, FALSE);
3332 ti = proto_tree_add_item(cs_tree, hf_iphc_crtp_cs_invalid, tvb, offset, 1, FALSE);
3333 ti = proto_tree_add_item(cs_tree, hf_iphc_crtp_seq, tvb, offset, 1, FALSE);
3335 ti = proto_tree_add_item(cs_tree, hf_iphc_crtp_gen, tvb, offset, 1, FALSE);
3346 dissect_mplscp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
3348 dissect_cp(tvb, proto_mplscp, ett_mplscp, cp_vals, ett_mplscp_options,
3349 NULL, 0, pinfo, tree);
3353 * Cisco Discovery Protocol Control Protocol.
3354 * XXX - where is this documented?
3357 dissect_cdpcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
3359 dissect_cp(tvb, proto_cdpcp, ett_cdpcp, cp_vals, ett_cdpcp_options,
3360 NULL, 0, pinfo, tree);
3363 #define MP_FRAG_MASK 0xC0
3364 #define MP_FRAG(bits) ((bits) & MP_FRAG_MASK)
3365 #define MP_FRAG_FIRST 0x80
3366 #define MP_FRAG_LAST 0x40
3367 #define MP_FRAG_RESERVED 0x3f
3369 static const true_false_string frag_truth = {
3374 /* According to RFC 1717, the length the MP header isn't indicated anywhere
3375 in the header itself. It starts out at four bytes and can be
3376 negotiated down to two using LCP. We currently assume that all
3377 headers are four bytes. - gcc
3380 dissect_mp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
3382 proto_tree *mp_tree, *hdr_tree;
3383 proto_item *ti = NULL;
3385 const gchar *flag_str;
3388 if (check_col(pinfo->cinfo, COL_PROTOCOL))
3389 col_set_str(pinfo->cinfo, COL_PROTOCOL, "PPP MP");
3391 if (check_col(pinfo->cinfo, COL_INFO))
3392 col_set_str(pinfo->cinfo, COL_INFO, "PPP Multilink");
3394 flags = tvb_get_guint8(tvb, 0);
3404 case MP_FRAG_FIRST|MP_FRAG_LAST:
3405 flag_str = "First, Last";
3408 flag_str = "Unknown";
3411 ti = proto_tree_add_item(tree, proto_mp, tvb, 0, 4, FALSE);
3412 mp_tree = proto_item_add_subtree(ti, ett_mp);
3413 ti = proto_tree_add_text(mp_tree, tvb, 0, 1, "Fragment: 0x%2X (%s)",
3415 hdr_tree = proto_item_add_subtree(ti, ett_mp_flags);
3416 proto_tree_add_boolean(hdr_tree, hf_mp_frag_first, tvb, 0, 1, flags);
3417 proto_tree_add_boolean(hdr_tree, hf_mp_frag_last, tvb, 0, 1, flags),
3418 proto_tree_add_text(hdr_tree, tvb, 0, 1, "%s",
3419 decode_boolean_bitfield(flags, MP_FRAG_RESERVED, sizeof(flags) * 8,
3420 "reserved", "reserved"));
3421 proto_tree_add_item(mp_tree, hf_mp_sequence_num, tvb, 1, 3, FALSE);
3424 if (tvb_reported_length_remaining(tvb, 4) > 0) {
3425 next_tvb = tvb_new_subset(tvb, 4, -1, -1);
3426 dissect_ppp(next_tvb, pinfo, tree);
3431 * Handles PPP without HDLC framing, just a protocol field (RFC 1661).
3434 dissect_ppp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) {
3435 proto_item *ti = NULL;
3436 proto_tree *fh_tree = NULL;
3439 ti = proto_tree_add_item(tree, proto_ppp, tvb, 0, -1, FALSE);
3440 fh_tree = proto_item_add_subtree(ti, ett_ppp);
3443 dissect_ppp_common(tvb, pinfo, tree, fh_tree, ti, 0);
3447 dissect_ppp_hdlc_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
3449 proto_item *ti = NULL;
3450 proto_tree *fh_tree = NULL;
3455 byte0 = tvb_get_guint8(tvb, 0);
3457 /* PPP HDLC encapsulation */
3461 /* address and control are compressed (NULL) */
3465 /* load the top pane info. This should be overwritten by
3466 the next protocol in the stack */
3468 ti = proto_tree_add_item(tree, proto_ppp, tvb, 0, -1, FALSE);
3469 fh_tree = proto_item_add_subtree(ti, ett_ppp);
3470 if (byte0 == 0xff) {
3471 proto_tree_add_item(fh_tree, hf_ppp_address, tvb, 0, 1, FALSE);
3472 proto_tree_add_item(fh_tree, hf_ppp_control, tvb, 1, 1, FALSE);
3476 next_tvb = decode_fcs(tvb, fh_tree, ppp_fcs_decode, proto_offset);
3478 dissect_ppp_common(next_tvb, pinfo, tree, fh_tree, ti, proto_offset);
3482 * Handles link-layer encapsulations where the frame might be
3483 * a PPP in HDLC-like Framing frame (RFC 1662) or a Cisco HDLC frame.
3486 dissect_ppp_hdlc( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
3490 byte0 = tvb_get_guint8(tvb, 0);
3491 if (byte0 == CHDLC_ADDR_UNICAST || byte0 == CHDLC_ADDR_MULTICAST) {
3492 /* Cisco HDLC encapsulation */
3493 call_dissector(chdlc_handle, tvb, pinfo, tree);
3498 * XXX - should we have an exported dissector that always dissects PPP,
3499 * for use when we know the packets are PPP, not CHDLC?
3501 if(check_col(pinfo->cinfo, COL_PROTOCOL))
3502 col_set_str(pinfo->cinfo, COL_PROTOCOL, "PPP");
3503 switch (pinfo->p2p_dir) {
3506 if(check_col(pinfo->cinfo, COL_RES_DL_SRC))
3507 col_set_str(pinfo->cinfo, COL_RES_DL_SRC, "DTE");
3508 if(check_col(pinfo->cinfo, COL_RES_DL_DST))
3509 col_set_str(pinfo->cinfo, COL_RES_DL_DST, "DCE");
3513 if(check_col(pinfo->cinfo, COL_RES_DL_SRC))
3514 col_set_str(pinfo->cinfo, COL_RES_DL_SRC, "DCE");
3515 if(check_col(pinfo->cinfo, COL_RES_DL_DST))
3516 col_set_str(pinfo->cinfo, COL_RES_DL_DST, "DTE");
3520 if(check_col(pinfo->cinfo, COL_RES_DL_SRC))
3521 col_set_str(pinfo->cinfo, COL_RES_DL_SRC, "N/A");
3522 if(check_col(pinfo->cinfo, COL_RES_DL_DST))
3523 col_set_str(pinfo->cinfo, COL_RES_DL_DST, "N/A");
3527 dissect_ppp_hdlc_common(tvb, pinfo, tree);
3531 remove_escape_chars(tvbuff_t *tvb, int offset, int length)
3535 int scanned_len = 0;
3539 buff = g_malloc(length);
3541 while ( scanned_len < length ){
3542 octet = tvb_get_guint8(tvb,offset);
3546 if (scanned_len >= length)
3548 octet = tvb_get_guint8(tvb,offset);
3549 buff[i] = octet ^ 0x20;
3561 next_tvb = tvb_new_real_data(buff,i,i);
3563 /* Arrange that the allocated packet data copy be freed when the
3566 tvb_set_free_cb( next_tvb, g_free );
3568 tvb_set_child_real_data_tvbuff(tvb,next_tvb);
3574 * Handles link-layer encapsulations where we have a raw RFC 1662
3575 * HDLC-like asynchronous framing byte stream, and have to
3576 * break the byte stream into frames and remove escapes.
3579 dissect_ppp_raw_hdlc( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
3582 proto_tree *bs_tree = NULL;
3583 gint offset, end_offset, data_offset;
3584 int length, data_length;
3586 gboolean first = TRUE;
3588 if(check_col(pinfo->cinfo, COL_PROTOCOL))
3589 col_set_str(pinfo->cinfo, COL_PROTOCOL, "PPP" );
3592 ti = proto_tree_add_item(tree, proto_ppp_hdlc, tvb, 0, -1, FALSE);
3593 bs_tree = proto_item_add_subtree(ti, ett_ppp_hdlc_data);
3597 * XXX - this needs to handle a PPP frame split over multiple higher-level
3602 * Look for a frame delimiter.
3604 offset = tvb_find_guint8(tvb, 0, -1, 0x7e);
3607 * None found - this is presumably continued from an earlier
3608 * packet and continued in a later packet.
3610 if (check_col(pinfo->cinfo, COL_INFO)){
3611 col_add_str(pinfo->cinfo, COL_INFO,"PPP Fragment");
3614 proto_tree_add_text(bs_tree, tvb, offset, -1, "PPP Fragment");
3616 length = tvb_length_remaining(tvb,offset);
3617 ppp_tvb = remove_escape_chars(tvb, offset,length);
3618 if (ppp_tvb != NULL) {
3619 add_new_data_source(pinfo, ppp_tvb, "PPP Fragment");
3620 call_dissector(data_handle, ppp_tvb, pinfo, tree);
3626 * We have some data preceding the first PPP packet;
3627 * mark it as a PPP fragment.
3629 if(check_col(pinfo->cinfo, COL_INFO)){
3630 col_add_str(pinfo->cinfo, COL_INFO,"PPP Fragment");
3634 proto_tree_add_text(bs_tree, tvb, 0, length, "PPP Fragment");
3636 ppp_tvb = remove_escape_chars(tvb, 0, length - 1);
3637 if (ppp_tvb != NULL) {
3638 add_new_data_source(pinfo, ppp_tvb, "PPP Fragment");
3639 call_dissector(data_handle, ppp_tvb, pinfo, tree);
3643 while ( tvb_reported_length_remaining(tvb, offset) > 0 ){
3645 * Look for the next frame delimiter.
3647 end_offset = tvb_find_guint8(tvb, offset+1, -1, 0x7e);
3648 if ( end_offset == -1 ){
3650 * We didn't find one. This is probably continued in
3654 if(check_col(pinfo->cinfo, COL_INFO)){
3655 col_add_str(pinfo->cinfo, COL_INFO,"PPP Fragment");
3659 proto_tree_add_text(bs_tree, tvb, offset, -1, "PPP Fragment");
3661 length = tvb_length_remaining(tvb, offset);
3662 ppp_tvb = remove_escape_chars(tvb, offset,length);
3663 if (ppp_tvb != NULL) {
3664 add_new_data_source(pinfo, ppp_tvb, "PPP Fragment");
3665 call_dissector(data_handle, ppp_tvb, pinfo, tree);
3670 data_offset = offset+1; /* skip starting frame delimiter */
3671 data_length = end_offset - data_offset;
3674 * Is that frame delimiter immediately followed by another one?
3675 * Some PPP implementations put a frame delimiter at the
3676 * beginning and the end of each frame, although RFC 1662
3677 * appears only to require that there be one frame delimiter
3678 * between adjacent frames:
3680 * Each frame begins and ends with a Flag Sequence, which is the
3681 * binary sequence 01111110 (hexadecimal 0x7e). All implementations
3682 * continuously check for this flag, which is used for frame
3685 * Only one Flag Sequence is required between two frames. Two
3686 * consecutive Flag Sequences constitute an empty frame, which is
3687 * silently discarded, and not counted as a FCS error.
3689 * If the delimiter at the end of this frame is followed by
3690 * another delimiter, we consider the first delimiter part
3693 if (tvb_offset_exists(tvb, end_offset+1) &&
3694 tvb_get_guint8(tvb, end_offset+1) == 0x7e)
3696 length = end_offset - offset;
3698 proto_tree_add_text(bs_tree, tvb, offset, length, "PPP Data");
3700 ppp_tvb = remove_escape_chars(tvb, data_offset, data_length);
3701 if (ppp_tvb != NULL) {
3702 add_new_data_source(pinfo, ppp_tvb, "PPP Message");
3703 dissect_ppp_hdlc_common(ppp_tvb, pinfo, tree);
3707 offset = end_offset;
3712 proto_register_ppp_raw_hdlc(void)
3714 static gint *ett[] = {
3718 proto_ppp_hdlc = proto_register_protocol("PPP In HDLC-Like Framing", "PPP-HDLC", "ppp_hdlc");
3719 proto_register_subtree_array(ett, array_length(ett));
3723 proto_reg_handoff_ppp_raw_hdlc(void)
3725 dissector_handle_t ppp_raw_hdlc_handle;
3727 ppp_raw_hdlc_handle = create_dissector_handle(dissect_ppp_raw_hdlc, proto_ppp);
3728 dissector_add("gre.proto", ETHERTYPE_CDMA2000_A10_UBS, ppp_raw_hdlc_handle);
3729 dissector_add("gre.proto", ETHERTYPE_3GPP2, ppp_raw_hdlc_handle);
3733 * Handles PAP just as a protocol field
3736 dissect_pap( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) {
3738 proto_tree *fh_tree = NULL;
3740 proto_tree *field_tree;
3742 proto_tree *message_tree;
3744 proto_tree *peer_id_tree;
3746 proto_tree *passwd_tree;
3749 guint8 id, peer_id_length, password_length, msg_length;
3752 code = tvb_get_guint8(tvb, 0);
3753 id = tvb_get_guint8(tvb, 1);
3754 length = tvb_get_ntohs(tvb, 2);
3756 if(check_col(pinfo->cinfo, COL_PROTOCOL))
3757 col_set_str(pinfo->cinfo, COL_PROTOCOL, "PPP PAP");
3759 if(check_col(pinfo->cinfo, COL_INFO))
3760 col_add_str(pinfo->cinfo, COL_INFO,
3761 val_to_str(code, pap_vals, "Unknown"));
3764 ti = proto_tree_add_item(tree, proto_pap, tvb, 0, length, FALSE);
3765 fh_tree = proto_item_add_subtree(ti, ett_pap);
3766 proto_tree_add_text(fh_tree, tvb, 0, 1, "Code: %s (0x%02x)",
3767 val_to_str(code, pap_vals, "Unknown"), code);
3768 proto_tree_add_text(fh_tree, tvb, 1, 1, "Identifier: 0x%02x",
3770 proto_tree_add_text(fh_tree, tvb, 2, 2, "Length: %u",
3780 tf = proto_tree_add_text(fh_tree, tvb, offset, length,
3781 "Data (%d byte%s)", length, plurality(length, "", "s"));
3782 field_tree = proto_item_add_subtree(tf, ett_pap_data);
3783 peer_id_length = tvb_get_guint8(tvb, offset);
3784 tp = proto_tree_add_text(field_tree, tvb, offset, 1,
3785 "Peer ID length: %d byte%s", peer_id_length, plurality(peer_id_length, "", "s"));
3787 peer_id_tree = proto_item_add_subtree(tp, ett_pap_peer_id);
3788 proto_tree_add_text(peer_id_tree, tvb, ++offset, ppp_min(peer_id_length, length),
3789 "Peer-ID (%d byte%s)", peer_id_length, plurality(peer_id_length, "", "s"));
3790 offset+=peer_id_length;
3791 length-=peer_id_length;
3793 password_length = tvb_get_guint8(tvb, offset);
3795 tpw = proto_tree_add_text(field_tree, tvb, offset, 1,
3796 "Password length: %d byte%s", password_length, plurality(password_length, "", "s"));
3797 passwd_tree = proto_item_add_subtree(tpw, ett_pap_password);
3798 proto_tree_add_text(passwd_tree, tvb, ++offset, ppp_min(password_length, length),
3799 "Password (%d byte%s)", password_length, plurality(password_length, "", "s"));
3811 tf = proto_tree_add_text(fh_tree, tvb, offset, length,
3812 "Data (%d byte%s)", length, plurality(length, "", "s"));
3813 field_tree = proto_item_add_subtree(tf, ett_pap_data);
3814 msg_length = tvb_get_guint8(tvb, offset);
3815 tm = proto_tree_add_text(field_tree, tvb, offset, 1,
3816 "Message length: %d byte%s", msg_length, plurality(msg_length, "", "s"));
3818 message_tree = proto_item_add_subtree(tm, ett_pap_message);
3819 proto_tree_add_text(message_tree, tvb, ++offset, ppp_min(msg_length, length),
3820 "Message (%d byte%s)", msg_length, plurality(msg_length, "", "s"));
3827 proto_tree_add_text(fh_tree, tvb, offset, length, "Stuff (%d byte%s)",
3828 length, plurality(length, "", "s"));
3835 * Handles CHAP just as a protocol field
3838 dissect_chap( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) {
3839 proto_item *ti = NULL;
3840 proto_tree *fh_tree = NULL;
3842 proto_tree *field_tree;
3844 guint8 code, value_size;
3848 code = tvb_get_guint8(tvb, 0);
3849 if(check_col(pinfo->cinfo, COL_PROTOCOL))
3850 col_set_str(pinfo->cinfo, COL_PROTOCOL, "PPP CHAP");
3852 if(check_col(pinfo->cinfo, COL_INFO))
3853 col_add_str(pinfo->cinfo, COL_INFO,
3854 val_to_str(code, chap_vals, "Unknown"));
3857 /* Create CHAP protocol tree */
3858 ti = proto_tree_add_item(tree, proto_chap, tvb, 0, -1, FALSE);
3859 fh_tree = proto_item_add_subtree(ti, ett_chap);
3862 proto_tree_add_item(fh_tree, hf_chap_code, tvb, 0, 1, FALSE);
3865 proto_tree_add_item(fh_tree, hf_chap_identifier, tvb, 1, 1, FALSE);
3868 /* Length - make sure it's valid */
3869 length = tvb_get_ntohs(tvb, 2);
3872 proto_tree_add_uint_format(fh_tree, hf_chap_length, tvb, 2, 2, length,
3873 "Length: %u (invalid, must be >= 4)",
3878 proto_item_set_len(ti, length);
3880 proto_tree_add_item(fh_tree, hf_chap_length, tvb, 2, 2, FALSE);
3883 /* Offset moved to after length field */
3885 /* Length includes previous 4 bytes, subtract */
3889 /* Challenge or Response data */
3894 guint value_offset=0;
3895 guint name_offset=0, name_size = 0;
3897 /* Create data subtree */
3898 tf = proto_tree_add_text(fh_tree, tvb, offset, length,
3899 "Data (%d byte%s)", length,
3900 plurality(length, "", "s"));
3901 field_tree = proto_item_add_subtree(tf, ett_chap_data);
3905 value_size = tvb_get_guint8(tvb, offset);
3906 if (value_size > length) {
3907 proto_tree_add_text(field_tree, tvb, offset, 1,
3908 "Value Size: %d byte%s (invalid, must be <= %u)",
3909 value_size, plurality(value_size, "", "s"),
3913 proto_tree_add_item(field_tree, hf_chap_value_size, tvb, offset, 1, FALSE);
3918 value_offset = offset;
3919 proto_tree_add_item(field_tree, hf_chap_value, tvb, offset, value_size, FALSE);
3921 /* Move along value_size bytes */
3925 /* Find name in remaining bytes */
3927 tvb_ensure_bytes_exist(tvb, offset, length);
3928 proto_tree_add_item(field_tree, hf_chap_name, tvb, offset, length, FALSE);
3929 name_offset = offset;
3933 /* Show name and value in info column */
3934 if(check_col(pinfo->cinfo, COL_INFO)){
3935 col_append_fstr(pinfo->cinfo, COL_INFO, " (NAME='%s%s', VALUE=0x%s)",
3936 tvb_format_text(tvb, name_offset,
3937 (name_size > 20) ? 20 : name_size),
3938 (name_size > 20) ? "..." : "",
3939 tvb_bytes_to_str(tvb, value_offset, value_size));
3946 /* Success or Failure data */
3951 proto_tree_add_item(fh_tree, hf_chap_message, tvb, offset, length, FALSE);
3955 /* Show message in info column */
3956 if(check_col(pinfo->cinfo, COL_INFO)){
3957 col_append_fstr(pinfo->cinfo, COL_INFO, " (MESSAGE='%s')",
3958 tvb_format_text(tvb, offset, length));
3962 /* Code from unknown code type... */
3965 proto_tree_add_text(fh_tree, tvb, offset, length, "Stuff (%u byte%s)",
3966 length, plurality(length, "", "s"));
3975 dissect_ipv6cp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
3977 dissect_cp(tvb, proto_ipv6cp, ett_ipv6cp, cp_vals, ett_ipv6cp_options,
3978 ipv6cp_opts, N_IPV6CP_OPTS, pinfo, tree);
3981 static void dissect_ipv6cp_if_id_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
3982 int offset, guint length, packet_info *pinfo _U_,
3985 proto_tree_add_text(tree, tvb, offset, length, "%s: %02x%02x:%02x%02x:%02x%x:%02x%02x",
3987 tvb_get_guint8(tvb, offset + 2),
3988 tvb_get_guint8(tvb, offset + 3),
3989 tvb_get_guint8(tvb, offset + 4),
3990 tvb_get_guint8(tvb, offset + 5),
3991 tvb_get_guint8(tvb, offset + 6),
3992 tvb_get_guint8(tvb, offset + 7),
3993 tvb_get_guint8(tvb, offset + 8),
3994 tvb_get_guint8(tvb, offset + 9)
3999 proto_register_ppp(void)
4001 static hf_register_info hf[] = {
4003 { "Address", "ppp.address", FT_UINT8, BASE_HEX,
4004 NULL, 0x0, "", HFILL }},
4007 { "Control", "ppp.control", FT_UINT8, BASE_HEX,
4008 NULL, 0x0, "", HFILL }},
4011 { "Protocol", "ppp.protocol", FT_UINT16, BASE_HEX,
4012 VALS(ppp_vals), 0x0, "", HFILL }},
4014 static gint *ett[] = {
4018 module_t *ppp_module;
4020 proto_ppp = proto_register_protocol("Point-to-Point Protocol", "PPP", "ppp");
4021 proto_register_field_array(proto_ppp, hf, array_length(hf));
4022 proto_register_subtree_array(ett, array_length(ett));
4024 /* subdissector code */
4025 ppp_subdissector_table = register_dissector_table("ppp.protocol",
4026 "PPP protocol", FT_UINT16, BASE_HEX);
4028 register_dissector("ppp_hdlc", dissect_ppp_hdlc, proto_ppp);
4029 register_dissector("ppp_lcp_options", dissect_lcp_options, proto_ppp);
4030 register_dissector("ppp", dissect_ppp, proto_ppp);
4032 /* Register the preferences for the ppp protocol */
4033 ppp_module = prefs_register_protocol(proto_ppp, NULL);
4035 prefs_register_enum_preference(ppp_module,
4037 "PPP Frame Checksum Type",
4038 "The type of PPP frame checksum (none, 16-bit, 32-bit)",
4040 fcs_options, FALSE);
4041 prefs_register_bool_preference(ppp_module,
4043 "Decompress Van Jacobson-compressed frames",
4044 "Whether Van Jacobson-compressed PPP frames should be decompressed",
4046 prefs_register_uint_preference(ppp_module,
4048 "PPPMuxCP Default PID",
4049 "Default Protocol ID to be used for PPPMuxCP",
4050 16, &pppmux_def_prot_id);
4054 proto_reg_handoff_ppp(void)
4056 dissector_handle_t ppp_hdlc_handle, ppp_handle;
4059 * Get a handle for the CHDLC dissector.
4061 chdlc_handle = find_dissector("chdlc");
4062 data_handle = find_dissector("data");
4064 ppp_handle = find_dissector("ppp");
4065 dissector_add("fr.ietf", NLPID_PPP, ppp_handle);
4067 ppp_hdlc_handle = find_dissector("ppp_hdlc");
4068 dissector_add("wtap_encap", WTAP_ENCAP_PPP, ppp_hdlc_handle);
4069 dissector_add("wtap_encap", WTAP_ENCAP_PPP_WITH_PHDR, ppp_hdlc_handle);
4070 dissector_add("osinl.excl", NLPID_PPP, ppp_handle);
4071 dissector_add("gre.proto", ETHERTYPE_PPP, ppp_hdlc_handle);
4075 proto_register_mp(void)
4077 static hf_register_info hf[] = {
4078 { &hf_mp_frag_first,
4079 { "First fragment", "mp.first", FT_BOOLEAN, 8,
4080 TFS(&frag_truth), MP_FRAG_FIRST, "", HFILL }},
4083 { "Last fragment", "mp.last", FT_BOOLEAN, 8,
4084 TFS(&frag_truth), MP_FRAG_LAST, "", HFILL }},
4086 { &hf_mp_sequence_num,
4087 { "Sequence number", "mp.seq", FT_UINT24, BASE_DEC, NULL, 0x0,
4090 static gint *ett[] = {
4095 proto_mp = proto_register_protocol("PPP Multilink Protocol", "PPP MP", "mp");
4096 proto_register_field_array(proto_mp, hf, array_length(hf));
4097 proto_register_subtree_array(ett, array_length(ett));
4101 proto_reg_handoff_mp(void)
4103 dissector_handle_t mp_handle;
4105 mp_handle = create_dissector_handle(dissect_mp, proto_mp);
4106 dissector_add("ppp.protocol", PPP_MP, mp_handle);
4110 proto_register_lcp(void)
4112 static gint *ett[] = {
4115 &ett_lcp_authprot_opt,
4116 &ett_lcp_qualprot_opt,
4117 &ett_lcp_fcs_alternatives_opt,
4118 &ett_lcp_numbered_mode_opt,
4119 &ett_lcp_callback_opt,
4120 &ett_lcp_multilink_ep_disc_opt,
4121 &ett_lcp_internationalization_opt,
4124 proto_lcp = proto_register_protocol("PPP Link Control Protocol", "PPP LCP",
4126 proto_register_subtree_array(ett, array_length(ett));
4130 proto_reg_handoff_lcp(void)
4132 dissector_handle_t lcp_handle;
4134 lcp_handle = create_dissector_handle(dissect_lcp, proto_lcp);
4135 dissector_add("ppp.protocol", PPP_LCP, lcp_handle);
4138 * NDISWAN on Windows translates Ethernet frames from higher-level
4139 * protocols into PPP frames to hand to the PPP driver, and translates
4140 * PPP frames from the PPP driver to hand to the higher-level protocols.
4142 * Apparently the PPP driver, on at least some versions of Windows,
4143 * passes frames for internal-to-PPP protocols up through NDISWAN;
4144 * the protocol type field appears to be passed through unchanged
4145 * (unlike what's done with, for example, the protocol type field
4146 * for IP, which is mapped from its PPP value to its Ethernet value).
4148 * This means that we may see, on Ethernet captures, frames for
4149 * protocols internal to PPP, so we register PPP_LCP with the
4150 * "ethertype" dissector table as well as the PPP protocol dissector
4153 dissector_add("ethertype", PPP_LCP, lcp_handle);
4156 * for GSM-A / MobileL3 / GPRS SM / PCO
4158 dissector_add("sm_pco.protocol", PPP_LCP, lcp_handle);
4163 proto_register_ipcp(void)
4165 static gint *ett[] = {
4168 &ett_ipcp_ipaddrs_opt,
4169 &ett_ipcp_compress_opt,
4172 proto_ipcp = proto_register_protocol("PPP IP Control Protocol", "PPP IPCP",
4174 proto_register_subtree_array(ett, array_length(ett));
4178 proto_reg_handoff_ipcp(void)
4180 dissector_handle_t ipcp_handle;
4182 ipcp_handle = create_dissector_handle(dissect_ipcp, proto_ipcp);
4183 dissector_add("ppp.protocol", PPP_IPCP, ipcp_handle);
4186 * See above comment about NDISWAN for an explanation of why we're
4187 * registering with the "ethertype" dissector table.
4189 dissector_add("ethertype", PPP_IPCP, ipcp_handle);
4192 * for GSM-A / MobileL3 / GPRS SM / PCO
4194 dissector_add("sm_pco.protocol", PPP_IPCP, ipcp_handle);
4199 proto_register_bcp(void)
4201 proto_bcp = proto_register_protocol("PPP Bridge Control Protocol", "PPP BCP", "bcp");
4205 proto_register_osicp(void)
4207 static gint *ett[] = {
4210 &ett_osicp_align_npdu_opt,
4213 proto_osicp = proto_register_protocol("PPP OSI Control Protocol", "PPP OSICP",
4215 proto_register_subtree_array(ett, array_length(ett));
4219 proto_reg_handoff_bcp(void)
4221 dissector_handle_t bcp_handle;
4222 eth_withfcs_handle = find_dissector("eth_withfcs");
4224 bcp_handle = create_dissector_handle(dissect_bcp, proto_bcp);
4225 dissector_add("ppp.protocol", PPP_BPDU, bcp_handle);
4229 proto_reg_handoff_osicp(void)
4231 dissector_handle_t osicp_handle;
4233 osicp_handle = create_dissector_handle(dissect_osicp, proto_osicp);
4234 dissector_add("ppp.protocol", PPP_OSICP, osicp_handle);
4237 * See above comment about NDISWAN for an explanation of why we're
4238 * registering with the "ethertype" dissector table.
4240 dissector_add("ethertype", PPP_OSICP, osicp_handle);
4244 proto_register_ccp(void)
4246 static gint *ett[] = {
4251 &ett_ccp_bsdcomp_opt,
4252 &ett_ccp_lzsdcp_opt,
4254 &ett_ccp_deflate_opt,
4257 proto_ccp = proto_register_protocol("PPP Compression Control Protocol",
4259 proto_register_subtree_array(ett, array_length(ett));
4263 proto_reg_handoff_ccp(void)
4265 dissector_handle_t ccp_handle;
4267 ccp_handle = create_dissector_handle(dissect_ccp, proto_ccp);
4268 dissector_add("ppp.protocol", PPP_CCP, ccp_handle);
4271 * See above comment about NDISWAN for an explanation of why we're
4272 * registering with the "ethertype" dissector table.
4274 dissector_add("ethertype", PPP_CCP, ccp_handle);
4278 proto_register_cbcp(void)
4280 static gint *ett[] = {
4283 &ett_cbcp_callback_opt,
4284 &ett_cbcp_callback_opt_addr
4287 proto_cbcp = proto_register_protocol("PPP Callback Control Protocol",
4288 "PPP CBCP", "cbcp");
4289 proto_register_subtree_array(ett, array_length(ett));
4293 proto_reg_handoff_cbcp(void)
4295 dissector_handle_t cbcp_handle;
4297 cbcp_handle = create_dissector_handle(dissect_cbcp, proto_cbcp);
4298 dissector_add("ppp.protocol", PPP_CBCP, cbcp_handle);
4301 * See above comment about NDISWAN for an explanation of why we're
4302 * registering with the "ethertype" dissector table.
4304 dissector_add("ethertype", PPP_CBCP, cbcp_handle);
4308 proto_register_bacp(void)
4310 static gint *ett[] = {
4313 &ett_bacp_favored_peer_opt
4316 proto_bacp = proto_register_protocol("PPP Bandwidth Allocation Control Protocol",
4317 "PPP BACP", "bacp");
4318 proto_register_subtree_array(ett, array_length(ett));
4322 proto_reg_handoff_bacp(void)
4324 dissector_handle_t bacp_handle;
4326 bacp_handle = create_dissector_handle(dissect_bacp, proto_bacp);
4327 dissector_add("ppp.protocol", PPP_BACP, bacp_handle);
4330 * See above comment about NDISWAN for an explanation of why we're
4331 * registering with the "ethertype" dissector table.
4333 dissector_add("ethertype", PPP_BACP, bacp_handle);
4337 proto_register_bap(void)
4339 static gint *ett[] = {
4342 &ett_bap_link_type_opt,
4343 &ett_bap_phone_delta_opt,
4344 &ett_bap_phone_delta_subopt,
4345 &ett_bap_call_status_opt
4348 proto_bap = proto_register_protocol("PPP Bandwidth Allocation Protocol",
4350 proto_register_subtree_array(ett, array_length(ett));
4354 proto_reg_handoff_bap(void)
4356 dissector_handle_t bap_handle;
4358 bap_handle = create_dissector_handle(dissect_bap, proto_bap);
4359 dissector_add("ppp.protocol", PPP_BAP, bap_handle);
4362 * See above comment about NDISWAN for an explanation of why we're
4363 * registering with the "ethertype" dissector table.
4365 dissector_add("ethertype", PPP_BAP, bap_handle);
4369 proto_register_comp_data(void)
4371 static gint *ett[] = {
4375 proto_comp_data = proto_register_protocol("PPP Compressed Datagram",
4376 "PPP Comp", "comp_data");
4377 proto_register_subtree_array(ett, array_length(ett));
4381 proto_reg_handoff_comp_data(void)
4383 dissector_handle_t comp_data_handle;
4385 comp_data_handle = create_dissector_handle(dissect_comp_data,
4387 dissector_add("ppp.protocol", PPP_COMP, comp_data_handle);
4390 * See above comment about NDISWAN for an explanation of why we're
4391 * registering with the "ethertype" dissector table.
4393 dissector_add("ethertype", PPP_COMP, comp_data_handle);
4397 proto_register_pap(void)
4399 static gint *ett[] = {
4407 proto_pap = proto_register_protocol("PPP Password Authentication Protocol", "PPP PAP",
4409 proto_register_subtree_array(ett, array_length(ett));
4413 proto_reg_handoff_pap(void)
4415 dissector_handle_t pap_handle;
4417 pap_handle = create_dissector_handle(dissect_pap, proto_pap);
4418 dissector_add("ppp.protocol", PPP_PAP, pap_handle);
4421 * See above comment about NDISWAN for an explanation of why we're
4422 * registering with the "ethertype" dissector table.
4424 dissector_add("ethertype", PPP_PAP, pap_handle);
4427 * for GSM-A / MobileL3 / GPRS SM / PCO
4429 dissector_add("sm_pco.protocol", PPP_PAP, pap_handle);
4433 proto_register_chap(void)
4435 static gint *ett[] = {
4443 static hf_register_info hf[] =
4448 "Code", "chap.code",
4450 VALS(chap_vals), 0x0,
4455 &hf_chap_identifier,
4457 "Identifier", "chap.identifier",
4460 "CHAP identifier", HFILL
4466 "Length", "chap.length",
4467 FT_UINT16, BASE_DEC,
4469 "CHAP length", HFILL
4473 &hf_chap_value_size,
4475 "Value Size", "chap.value_size",
4478 "CHAP value size", HFILL
4484 "Value", "chap.value",
4485 FT_BYTES, BASE_NONE,
4487 "CHAP value data", HFILL
4493 "Name", "chap.name",
4494 FT_STRING, BASE_NONE,
4502 "Message", "chap.message",
4503 FT_STRING, BASE_NONE,
4505 "CHAP message", HFILL
4511 proto_chap = proto_register_protocol("PPP Challenge Handshake Authentication Protocol", "PPP CHAP",
4513 proto_register_field_array(proto_chap, hf, array_length(hf));
4514 proto_register_subtree_array(ett, array_length(ett));
4518 proto_reg_handoff_chap(void)
4520 dissector_handle_t chap_handle = create_dissector_handle(dissect_chap, proto_chap);
4521 dissector_add("ppp.protocol", PPP_CHAP, chap_handle);
4524 * See above comment about NDISWAN for an explanation of why we're
4525 * registering with the "ethertype" dissector table.
4527 dissector_add("ethertype", PPP_CHAP, chap_handle);
4530 * for GSM-A / MobileL3 / GPRS SM / PCO
4532 dissector_add("sm_pco.protocol", PPP_CHAP, chap_handle);
4536 proto_register_pppmuxcp(void)
4538 static gint *ett[] = {
4540 &ett_pppmuxcp_options,
4543 proto_pppmuxcp = proto_register_protocol("PPPMux Control Protocol",
4546 proto_register_subtree_array(ett, array_length(ett));
4551 proto_reg_handoff_pppmuxcp(void)
4553 dissector_handle_t muxcp_handle;
4555 muxcp_handle = create_dissector_handle(dissect_pppmuxcp, proto_pppmuxcp);
4556 dissector_add("ppp.protocol", PPP_MUXCP, muxcp_handle);
4559 * See above comment about NDISWAN for an explanation of why we're
4560 * registering with the "ethertype" dissector table.
4562 dissector_add("ethertype", PPP_MUXCP, muxcp_handle);
4567 proto_register_pppmux(void)
4569 static hf_register_info hf[] =
4571 { &hf_pppmux_protocol,
4572 { "Protocol", "ppp.protocol", FT_UINT16, BASE_HEX,
4573 VALS(ppp_vals), 0x0,
4574 "The protocol of the sub-frame.", HFILL }},
4577 static gint *ett[] = {
4579 &ett_pppmux_subframe,
4580 &ett_pppmux_subframe_hdr,
4581 &ett_pppmux_subframe_flags,
4582 &ett_pppmux_subframe_info,
4585 proto_pppmux = proto_register_protocol("PPP Multiplexing",
4588 proto_register_field_array(proto_pppmux, hf, array_length(hf));
4589 proto_register_subtree_array(ett, array_length(ett));
4593 proto_reg_handoff_pppmux(void)
4595 dissector_handle_t pppmux_handle;
4597 pppmux_handle = create_dissector_handle(dissect_pppmux, proto_pppmux);
4598 dissector_add("ppp.protocol", PPP_MUX, pppmux_handle);
4601 * See above comment about NDISWAN for an explanation of why we're
4602 * registering with the "ethertype" dissector table.
4604 dissector_add("ethertype", PPP_MUX, pppmux_handle);
4608 proto_register_mplscp(void)
4610 static gint *ett[] = {
4612 &ett_mplscp_options,
4615 proto_mplscp = proto_register_protocol("PPP MPLS Control Protocol",
4616 "PPP MPLSCP", "mplscp");
4617 proto_register_subtree_array(ett, array_length(ett));
4621 proto_reg_handoff_mplscp(void)
4623 dissector_handle_t mplscp_handle;
4625 mplscp_handle = create_dissector_handle(dissect_mplscp, proto_mplscp);
4626 dissector_add("ppp.protocol", PPP_MPLSCP, mplscp_handle);
4629 * See above comment about NDISWAN for an explanation of why we're
4630 * registering with the "ethertype" dissector table.
4632 dissector_add("ethertype", PPP_MPLSCP, mplscp_handle);
4636 proto_register_cdpcp(void)
4638 static gint *ett[] = {
4643 proto_cdpcp = proto_register_protocol("PPP CDP Control Protocol",
4644 "PPP CDPCP", "cdpcp");
4645 proto_register_subtree_array(ett, array_length(ett));
4649 proto_reg_handoff_cdpcp(void)
4651 dissector_handle_t cdpcp_handle;
4653 cdpcp_handle = create_dissector_handle(dissect_cdpcp, proto_cdpcp);
4654 dissector_add("ppp.protocol", PPP_CDPCP, cdpcp_handle);
4657 * See above comment about NDISWAN for an explanation of why we're
4658 * registering with the "ethertype" dissector table.
4660 dissector_add("ethertype", PPP_CDPCP, cdpcp_handle);
4664 proto_register_ipv6cp(void)
4666 static gint *ett[] = {
4668 &ett_ipv6cp_options,
4669 &ett_ipv6cp_if_id_opt,
4670 &ett_ipv6cp_compress_opt,
4673 proto_ipv6cp = proto_register_protocol("PPP IPv6 Control Protocol",
4674 "PPP IPV6CP", "ipv6cp");
4675 proto_register_subtree_array(ett, array_length(ett));
4679 proto_reg_handoff_ipv6cp(void)
4681 dissector_handle_t ipv6cp_handle;
4683 ipv6cp_handle = create_dissector_handle(dissect_ipv6cp, proto_ipv6cp);
4684 dissector_add("ppp.protocol", PPP_IPV6CP, ipv6cp_handle);
4687 * See above comment about NDISWAN for an explanation of why we're
4688 * registering with the "ethertype" dissector table.
4690 dissector_add("ethertype", PPP_IPV6CP, ipv6cp_handle);
4694 proto_register_iphc_crtp(void)
4696 static hf_register_info hf[] =
4699 &hf_iphc_crtp_cid16,
4701 "Context Id", "crtp.cid",
4702 FT_UINT16, BASE_DEC,
4704 "The context identifier of the compressed packet.", HFILL
4710 "Context Id", "crtp.cid",
4713 "The context identifier of the compressed packet.", HFILL
4719 "Generation", "crtp.gen",
4722 "The generation of the compressed packet.", HFILL
4728 "Sequence", "crtp.seq",
4731 "The sequence of the compressed packet.", HFILL
4735 &hf_iphc_crtp_fh_flags,
4737 "Flags", "crtp.flags",
4739 iphc_crtp_fh_flags, 0xc0,
4740 "The flags of the full header packet.", HFILL
4744 &hf_iphc_crtp_cs_flags,
4746 "Flags", "crtp.flags",
4748 iphc_crtp_cs_flags, 0x0,
4749 "The flags of the context state packet.", HFILL
4753 &hf_iphc_crtp_cs_cnt,
4755 "Count", "crtp.cnt",
4758 "The count of the context state packet.", HFILL
4762 &hf_iphc_crtp_cs_invalid,
4764 "Invalid", "crtp.invalid",
4767 "The invalid bit of the context state packet.", HFILL
4772 static gint *ett[] = {
4775 &ett_iphc_crtp_info,
4778 proto_iphc_crtp = proto_register_protocol("CRTP", "CRTP", "crtp");
4779 proto_register_field_array(proto_iphc_crtp, hf, array_length(hf));
4780 proto_register_subtree_array(ett, array_length(ett));
4784 proto_reg_handoff_iphc_crtp(void)
4786 dissector_handle_t fh_handle;
4787 dissector_handle_t cudp16_handle;
4788 dissector_handle_t cudp8_handle;
4789 dissector_handle_t cs_handle;
4791 fh_handle = create_dissector_handle(dissect_iphc_crtp_fh, proto_iphc_crtp);
4792 dissector_add("ppp.protocol", PPP_RTP_FH, fh_handle);
4794 cudp16_handle = create_dissector_handle(dissect_iphc_crtp_cudp16, proto_iphc_crtp);
4795 dissector_add("ppp.protocol", PPP_RTP_CUDP16, cudp16_handle);
4797 cudp8_handle = create_dissector_handle(dissect_iphc_crtp_cudp8, proto_iphc_crtp);
4798 dissector_add("ppp.protocol", PPP_RTP_CUDP8, cudp16_handle);
4800 cs_handle = create_dissector_handle(dissect_iphc_crtp_cs, proto_iphc_crtp);
4801 dissector_add("ppp.protocol", PPP_RTP_CS, cs_handle);
4804 * See above comment about NDISWAN for an explanation of why we're
4805 * registering with the "ethertype" dissector table.
4807 dissector_add("ethertype", PPP_RTP_FH, fh_handle);
4808 dissector_add("ethertype", PPP_RTP_CUDP16, cudp16_handle);
4809 dissector_add("ethertype", PPP_RTP_CUDP8, cudp16_handle);
4810 dissector_add("ethertype", PPP_RTP_CS, cs_handle);