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.
33 #include <epan/prefs.h>
34 #include <epan/packet.h>
35 #include <epan/emem.h>
36 #include "packet-ppp.h"
37 #include <epan/ppptypes.h>
38 #include <epan/etypes.h>
39 #include <epan/ip_opts.h>
40 #include <epan/atalk-utils.h>
41 #include "packet-chdlc.h"
42 #include "packet-ip.h"
43 #include "packet-ipx.h"
44 #include "packet-vines.h"
45 #include <epan/nlpid.h>
46 #include <epan/crc16.h>
47 #include <epan/crc32.h>
48 #include <epan/ipproto.h>
49 #include "packet-usb.h"
50 #include "packet-sll.h"
52 #define ppp_min(a, b) (((a)<(b)) ? (a) : (b))
54 static int proto_ppp = -1;
55 static int hf_ppp_direction = -1;
56 static int hf_ppp_address = -1;
57 static int hf_ppp_control = -1;
58 static int hf_ppp_protocol = -1;
60 static gint ett_ppp = -1;
62 static int proto_ppp_hdlc = -1;
64 static gint ett_ppp_hdlc_data = -1;
66 static int proto_lcp = -1;
68 static gint ett_lcp = -1;
69 static gint ett_lcp_options = -1;
70 static gint ett_lcp_authprot_opt = -1;
71 static gint ett_lcp_qualprot_opt = -1;
72 static gint ett_lcp_fcs_alternatives_opt = -1;
73 static gint ett_lcp_numbered_mode_opt = -1;
74 static gint ett_lcp_callback_opt = -1;
75 static gint ett_lcp_multilink_ep_disc_opt = -1;
76 static gint ett_lcp_internationalization_opt = -1;
78 static int proto_ipcp = -1;
80 static gint ett_ipcp = -1;
81 static gint ett_ipcp_options = -1;
82 static gint ett_ipcp_ipaddrs_opt = -1;
83 static gint ett_ipcp_compress_opt = -1;
84 static gint ett_ipcp_iphc_disableprot_opt = -1;
86 static int proto_vsncp = -1;
88 static gint ett_vsncp = -1;
89 static gint ett_vsncp_options = -1;
91 static int proto_vsnp = -1;
92 static gint hf_vsnp = -1;
93 static gint hf_vsnp_header = -1;
94 static gint hf_vsnp_type = -1;
95 static gint hf_vsnp_data = -1;
97 static gint ett_vsnp =-1;
98 static gint ett_vsnp_pdnid = -1;
100 static int proto_osicp = -1;
102 static gint ett_osicp = -1;
103 static gint ett_osicp_options = -1;
104 static gint ett_osicp_align_npdu_opt = -1;
106 static int proto_bcp = -1;
107 static int hf_bcp_flags = -1;
108 static int hf_bcp_fcs_present = -1;
109 static int hf_bcp_zeropad = -1;
110 static int hf_bcp_bcontrol = -1;
111 static int hf_bcp_pads = -1;
112 static int hf_bcp_mac_type = -1;
114 static gint ett_bcp = -1;
115 static gint ett_bcp_flags = -1;
117 static int proto_ccp = -1;
119 static gint ett_ccp = -1;
120 static gint ett_ccp_options = -1;
121 static gint ett_ccp_stac_opt = -1;
122 static gint ett_ccp_mppc_opt = -1;
123 static gint ett_ccp_bsdcomp_opt = -1;
124 static gint ett_ccp_lzsdcp_opt = -1;
125 static gint ett_ccp_mvrca_opt = -1;
126 static gint ett_ccp_deflate_opt = -1;
128 static int proto_cbcp = -1;
130 static gint ett_cbcp = -1;
131 static gint ett_cbcp_options = -1;
132 static gint ett_cbcp_callback_opt = -1;
133 static gint ett_cbcp_callback_opt_addr = -1;
135 static int proto_bacp = -1;
137 static gint ett_bacp = -1;
138 static gint ett_bacp_options = -1;
139 static gint ett_bacp_favored_peer_opt = -1;
141 static int proto_bap = -1;
143 static gint ett_bap = -1;
144 static gint ett_bap_options = -1;
145 static gint ett_bap_link_type_opt = -1;
146 static gint ett_bap_phone_delta_opt = -1;
147 static gint ett_bap_phone_delta_subopt = -1;
148 static gint ett_bap_call_status_opt = -1;
150 static int proto_comp_data = -1;
152 static gint ett_comp_data = -1;
154 static int proto_pppmuxcp = -1;
156 static gint ett_pppmuxcp = -1;
157 static gint ett_pppmuxcp_options = -1;
159 static int proto_pppmux = -1;
160 static int hf_pppmux_protocol = -1;
162 static gint ett_pppmux = -1;
163 static gint ett_pppmux_subframe = -1;
164 static gint ett_pppmux_subframe_hdr = -1;
165 static gint ett_pppmux_subframe_flags = -1;
166 static gint ett_pppmux_subframe_info = -1;
168 static int proto_mp = -1;
169 static int hf_mp_frag_first = -1;
170 static int hf_mp_frag_last = -1;
171 static int hf_mp_sequence_num = -1;
172 static int hf_mp_short_sequence_num = -1;
174 static int ett_mp = -1;
175 static int ett_mp_flags = -1;
177 static int proto_mplscp = -1;
178 static gint ett_mplscp = -1;
179 static gint ett_mplscp_options = -1;
181 static int proto_cdpcp = -1;
182 static gint ett_cdpcp = -1;
183 static gint ett_cdpcp_options = -1;
185 static int proto_pap = -1; /* PAP vars */
186 static gint ett_pap = -1;
187 static gint ett_pap_data = -1;
188 static gint ett_pap_peer_id = -1;
189 static gint ett_pap_password = -1;
190 static gint ett_pap_message = -1;
192 static int proto_chap = -1; /* CHAP vars */
193 static gint ett_chap = -1;
194 static gint ett_chap_data = -1;
195 static gint ett_chap_value = -1;
196 static gint ett_chap_name = -1;
197 static gint ett_chap_message = -1;
200 static gint hf_chap_code = -1;
201 static gint hf_chap_identifier = -1;
202 static gint hf_chap_length = -1;
203 static gint hf_chap_value_size = -1;
204 static gint hf_chap_value = -1;
205 static gint hf_chap_name = -1;
206 static gint hf_chap_message = -1;
209 static int proto_ipv6cp = -1; /* IPv6CP vars */
211 static gint ett_ipv6cp = -1;
212 static gint ett_ipv6cp_options = -1;
213 static gint ett_ipv6cp_if_id_opt = -1;
214 static gint ett_ipv6cp_compress_opt = -1;
216 static int proto_iphc_crtp = -1; /* CRTP vars */
217 static int hf_iphc_crtp_cid8 = -1;
218 static int hf_iphc_crtp_cid16 = -1;
219 static int hf_iphc_crtp_gen = -1;
220 static int hf_iphc_crtp_seq = -1;
221 static int hf_iphc_crtp_fh_flags = -1;
222 static int hf_iphc_crtp_cs_flags = -1;
223 static int hf_iphc_crtp_cs_cnt = -1;
224 static int hf_iphc_crtp_cs_invalid = -1;
226 static gint ett_iphc_crtp = -1;
227 static gint ett_iphc_crtp_hdr = -1;
228 static gint ett_iphc_crtp_info = -1;
230 static dissector_table_t ppp_subdissector_table;
231 static dissector_handle_t chdlc_handle;
232 static dissector_handle_t data_handle;
233 static dissector_handle_t eth_withfcs_handle;
234 static dissector_handle_t eth_withoutfcs_handle;
236 static const value_string ppp_direction_vals[] = {
237 { P2P_DIR_RECV, "DCE->DTE"},
238 { P2P_DIR_SENT, "DTE->DCE"},
243 static gint ppp_fcs_decode = 0; /* 0 = No FCS, 1 = 16 bit FCS, 2 = 32 bit FCS */
248 const enum_val_t fcs_options[] = {
249 {"none", "None", NO_FCS},
250 {"16-bit", "16-Bit", FCS_16},
251 {"32-bit", "32-Bit", FCS_32},
255 gboolean ppp_vj_decomp = TRUE; /* Default to VJ header decompression */
258 * For Default Protocol ID negotiated with PPPMuxCP. We need to
259 * this ID so that if the first subframe doesn't have protocol
263 static guint pppmux_def_prot_id = 0;
265 /* PPP definitions */
268 * Used by the GTP dissector as well.
270 const value_string ppp_vals[] = {
271 {PPP_PADDING, "Padding Protocol" },
272 {PPP_ROHC_SCID, "ROHC small-CID" },
273 {PPP_ROHC_LCID, "ROHC large-CID" },
276 {PPP_XNSIDP, "Xerox NS IDP" },
277 {PPP_DEC4, "DECnet Phase IV" },
278 {PPP_AT, "Appletalk" },
279 {PPP_IPX, "Netware IPX/SPX"},
280 {PPP_VJC_COMP, "VJ compressed TCP"},
281 {PPP_VJC_UNCOMP,"VJ uncompressed TCP"},
282 {PPP_BCP, "Bridging Control Protocol"},
283 {PPP_ST, "Stream Protocol (ST-II)" },
284 {PPP_VINES, "Vines" },
285 {PPP_AT_EDDP, "AppleTalk EDDP" },
286 {PPP_AT_SB, "AppleTalk SmartBuffered" },
287 {PPP_MP, "Multilink"},
288 {PPP_NB, "NETBIOS Framing" },
289 {PPP_CISCO, "Cisco Systems" },
290 {PPP_ASCOM, "Ascom Timeplex" },
291 {PPP_LBLB, "Fujitsu Link Backup and Load Balancing" },
292 {PPP_RL, "DCA Remote Lan" },
293 {PPP_SDTP, "Serial Data Transport Protocol" },
294 {PPP_LLC, "SNA over LLC" },
296 {PPP_IPV6HC, "IPv6 Header Compression " },
297 {PPP_KNX, "KNX Bridging Data" },
298 {PPP_ENCRYPT, "Encryption" },
299 {PPP_ILE, "Individual Link Encryption" },
301 {PPP_MUX, "PPP Multiplexing"},
302 {PPP_VSNP, "Vendor-Specific Network Protocol"},
303 {PPP_RTP_FH, "RTP IPHC Full Header" },
304 {PPP_RTP_CTCP, "RTP IPHC Compressed TCP" },
305 {PPP_RTP_CNTCP, "RTP IPHC Compressed Non TCP" },
306 {PPP_RTP_CUDP8, "RTP IPHC Compressed UDP 8" },
307 {PPP_RTP_CRTP8, "RTP IPHC Compressed RTP 8" },
308 {PPP_STAMPEDE, "Stampede Bridging" },
309 {PPP_MPPLUS, "MP+ Protocol" },
310 {PPP_NTCITS_IPI,"NTCITS IPI" },
311 {PPP_ML_SLCOMP, "single link compression in multilink" },
312 {PPP_COMP, "compressed packet" },
313 {PPP_STP_HELLO, "802.1D Hello Packet" },
314 {PPP_IBM_SR, "IBM Source Routing BPDU" },
315 {PPP_DEC_LB, "DEC LANBridge100 Spanning Tree"},
316 {PPP_CDP, "Cisco Discovery Protocol" },
317 {PPP_NETCS, "Netcs Twin Routing" },
318 {PPP_STP, "Scheduled Transfer Protocol" },
319 {PPP_EDP, "Extreme Discovery Protocol" },
320 {PPP_OSCP, "Optical Supervisory Channel Protocol" },
321 {PPP_OSCP2, "Optical Supervisory Channel Protocol" },
322 {PPP_LUXCOM, "Luxcom" },
323 {PPP_SIGMA, "Sigma Network Systems" },
324 {PPP_ACSP, "Apple Client Server Protocol" },
325 {PPP_MPLS_UNI, "MPLS Unicast"},
326 {PPP_MPLS_MULTI, "MPLS Multicast"},
327 {PPP_P12844, "IEEE p1284.4 standard - data packets" },
328 {PPP_TETRA, "ETSI TETRA Networks Protocol Type 1" },
329 {PPP_MFTP, "Multichannel Flow Treatment Protocol" },
330 {PPP_RTP_CTCPND,"RTP IPHC Compressed TCP No Delta" },
331 {PPP_RTP_CS, "RTP IPHC Context State" },
332 {PPP_RTP_CUDP16,"RTP IPHC Compressed UDP 16" },
333 {PPP_RTP_CRDP16,"RTP IPHC Compressed RTP 16" },
334 {PPP_CCCP, "Cray Communications Control Protocol" },
335 {PPP_CDPD_MNRP, "CDPD Mobile Network Registration Protocol" },
336 {PPP_EXPANDAP, "Expand accelerator protocol" },
337 {PPP_ODSICP, "ODSICP NCP" },
338 {PPP_DOCSIS, "DOCSIS DLL" },
339 {PPP_CETACEANNDP, "Cetacean Network Detection Protocol" },
340 {PPP_LZS, "Stacker LZS" },
341 {PPP_REFTEK, "RefTek Protocol" },
342 {PPP_FC, "Fibre Channel" },
343 {PPP_EMIT, "EMIT Protocols" },
344 {PPP_VSP, "Vendor-Specific Protocol" },
345 {PPP_IPCP, "IP Control Protocol" },
346 {PPP_OSICP, "OSI Control Protocol" },
347 {PPP_XNSIDPCP, "Xerox NS IDP Control Protocol" },
348 {PPP_DECNETCP, "DECnet Phase IV Control Protocol" },
349 {PPP_ATCP, "AppleTalk Control Protocol" },
350 {PPP_IPXCP, "IPX Control Protocol" },
351 {PPP_BRIDGENCP, "Bridging NCP" },
352 {PPP_SPCP, "Stream Protocol Control Protocol" },
353 {PPP_BVCP, "Banyan Vines Control Protocol" },
354 {PPP_MLCP, "Multi-Link Control Protocol" },
355 {PPP_NBCP, "NETBIOS Framing Control Protocol" },
356 {PPP_CISCOCP, "Cisco Systems Control Protocol" },
357 {PPP_ASCOMCP, "Ascom Timeplex" },
358 {PPP_LBLBCP, "Fujitsu LBLB Control Protocol" },
359 {PPP_RLNCP, "DCA Remote Lan Network Control Protocol" },
360 {PPP_SDCP, "Serial Data Control Protocol" },
361 {PPP_LLCCP, "SNA over LLC Control Protocol" },
362 {PPP_SNACP, "SNA Control Protocol" },
363 {PPP_KNXCP, "KNX Bridging Control Protocol" },
364 {PPP_ECP, "Encryption Control Protocol" },
365 {PPP_ILECP, "Individual Encryption Control Protocol" },
366 {PPP_IPV6CP, "IPv6 Control Protocol" },
367 {PPP_MUXCP, "PPPMux Control Protocol"},
368 {PPP_VSNCP, "Vendor-Specific Network Control Protocol"},
369 {PPP_STAMPEDECP,"Stampede Bridging Control Protocol" },
370 {PPP_MPPCP, "MP+ Control Protocol" },
371 {PPP_IPICP, "NTCITS IPI Control Protocol" },
372 {PPP_SLCC, "single link compression in multilink control" },
373 {PPP_CCP, "Compression Control Protocol" },
374 {PPP_CDPCP, "CDP Control Protocol" },
375 {PPP_NETCSCP, "Netcs Twin Routing" },
376 {PPP_STPCP, "STP - Control Protocol" },
377 {PPP_EDPCP, "EDP Control Protocol" },
378 {PPP_ACSPC, "Apple Client Server Protocol Control" },
379 {PPP_MPLSCP, "MPLS Control Protocol" },
380 {PPP_P12844CP, "IEEE p1284.4 standard - Protocol Control" },
381 {PPP_TETRACP, "ETSI TETRA TNP1 Control Protocol" },
382 {PPP_MFTPCP, "Multichannel Flow Treatment Protocol" },
383 {PPP_LCP, "Link Control Protocol" },
384 {PPP_PAP, "Password Authentication Protocol" },
385 {PPP_LQR, "Link Quality Report protocol" },
386 {PPP_SPAP, "Shiva Password Authentication Protocol" },
387 {PPP_CBCP, "Callback Control Protocol" },
388 {PPP_BACP, "Bandwidth Allocation Control Protocol" },
389 {PPP_BAP, "Bandwidth Allocation Protocol" },
390 {PPP_VSAP, "Vendor-Specific Authentication Protocol" },
391 {PPP_CONTCP, "Container Control Protocol" },
392 {PPP_CHAP, "Challenge Handshake Authentication Protocol" },
393 {PPP_RSAAP, "RSA Authentication Protocol" },
394 {PPP_EAP, "Extensible Authentication Protocol" },
395 {PPP_SIEP, "Mitsubishi Security Information Exchange Protocol"},
396 {PPP_SBAP, "Stampede Bridging Authorization Protocol" },
397 {PPP_PRPAP, "Proprietary Authentication Protocol" },
398 {PPP_PRPAP2, "Proprietary Authentication Protocol" },
399 {PPP_PRPNIAP, "Proprietary Node ID Authentication Protocol" },
403 /* CP (LCP, IPCP, etc.) codes.
406 #define CONFREQ 1 /* Configuration Request */
407 #define CONFACK 2 /* Configuration Ack */
408 #define CONFNAK 3 /* Configuration Nak */
409 #define CONFREJ 4 /* Configuration Reject */
410 #define TERMREQ 5 /* Termination Request */
411 #define TERMACK 6 /* Termination Ack */
412 #define CODEREJ 7 /* Code Reject */
414 static const value_string cp_vals[] = {
415 {CONFREQ, "Configuration Request" },
416 {CONFACK, "Configuration Ack" },
417 {CONFNAK, "Configuration Nak" },
418 {CONFREJ, "Configuration Reject" },
419 {TERMREQ, "Termination Request" },
420 {TERMACK, "Termination Ack" },
421 {CODEREJ, "Code Reject" },
425 * LCP-specific packet types.
427 #define PROTREJ 8 /* Protocol Reject */
428 #define ECHOREQ 9 /* Echo Request */
429 #define ECHOREP 10 /* Echo Reply */
430 #define DISCREQ 11 /* Discard Request */
431 #define IDENT 12 /* Identification */
432 #define TIMEREMAIN 13 /* Time remaining */
435 * CCP-specific packet types.
437 #define RESETREQ 14 /* Reset Request */
438 #define RESETACK 15 /* Reset Ack */
441 * CBCP-specific packet types.
443 #define CBREQ 1 /* Callback Request */
444 #define CBRES 2 /* Callback Response */
445 #define CBACK 3 /* Callback Ack */
447 #define CBCP_OPT 6 /* Use callback control protocol */
450 * BAP-specific packet types.
452 #define BAP_CREQ 1 /* Call Request */
453 #define BAP_CRES 2 /* Call Response */
454 #define BAP_CBREQ 3 /* Callback Request */
455 #define BAP_CBRES 4 /* Callback Response */
456 #define BAP_LDQREQ 5 /* Link Drop Query Request */
457 #define BAP_LDQRES 6 /* Link Drop Query Response */
458 #define BAP_CSI 7 /* Call Status Indication */
459 #define BAP_CSRES 8 /* Call Status Response */
461 static const value_string lcp_vals[] = {
462 {CONFREQ, "Configuration Request" },
463 {CONFACK, "Configuration Ack" },
464 {CONFNAK, "Configuration Nak" },
465 {CONFREJ, "Configuration Reject" },
466 {TERMREQ, "Termination Request" },
467 {TERMACK, "Termination Ack" },
468 {CODEREJ, "Code Reject" },
469 {PROTREJ, "Protocol Reject" },
470 {ECHOREQ, "Echo Request" },
471 {ECHOREP, "Echo Reply" },
472 {DISCREQ, "Discard Request" },
473 {IDENT, "Identification" },
474 {TIMEREMAIN, "Time Remaining" },
478 static const value_string ccp_vals[] = {
479 {CONFREQ, "Configuration Request" },
480 {CONFACK, "Configuration Ack" },
481 {CONFNAK, "Configuration Nak" },
482 {CONFREJ, "Configuration Reject" },
483 {TERMREQ, "Termination Request" },
484 {TERMACK, "Termination Ack" },
485 {CODEREJ, "Code Reject" },
486 {RESETREQ, "Reset Request" },
487 {RESETACK, "Reset Ack" },
491 static const value_string cbcp_vals[] = {
492 {CBREQ, "Callback Request" },
493 {CBRES, "Callback Response" },
494 {CBACK, "Callback Ack" },
498 static const value_string bap_vals[] = {
499 {BAP_CREQ, "Call Request" },
500 {BAP_CRES, "Call Response" },
501 {BAP_CBREQ, "Callback Request" },
502 {BAP_CBRES, "Callback Response" },
503 {BAP_LDQREQ, "Link Drop Query Request" },
504 {BAP_LDQRES, "Link Drop Query Response" },
505 {BAP_CSI, "Call Status Indication" },
506 {BAP_CSRES, "Call Status Response" },
510 #define BAP_RESP_CODE_REQACK 0x00
511 #define BAP_RESP_CODE_REQNAK 0x01
512 #define BAP_RESP_CODE_REQREJ 0x02
513 #define BAP_RESP_CODE_REQFULLNAK 0x03
514 static const value_string bap_resp_code_vals[] = {
515 {BAP_RESP_CODE_REQACK, "Request Ack" },
516 {BAP_RESP_CODE_REQNAK, "Request Nak" },
517 {BAP_RESP_CODE_REQREJ, "Request Rej" },
518 {BAP_RESP_CODE_REQFULLNAK, "Request Full Nak" },
522 #define BAP_LINK_TYPE_ISDN 0 /* ISDN */
523 #define BAP_LINK_TYPE_X25 1 /* X.25 */
524 #define BAP_LINK_TYPE_ANALOG 2 /* Analog */
525 #define BAP_LINK_TYPE_SD 3 /* Switched Digital (non-ISDN) */
526 #define BAP_LINK_TYPE_ISDNOV 4 /* ISDN data over voice */
527 #define BAP_LINK_TYPE_RESV5 5 /* Reserved */
528 #define BAP_LINK_TYPE_RESV6 6 /* Reserved */
529 #define BAP_LINK_TYPE_RESV7 7 /* Reserved */
530 static const value_string bap_link_type_vals[] = {
531 {BAP_LINK_TYPE_ISDN, "ISDN" },
532 {BAP_LINK_TYPE_X25, "X.25" },
533 {BAP_LINK_TYPE_ANALOG, "Analog" },
534 {BAP_LINK_TYPE_SD, "Switched Digital (non-ISDN)" },
535 {BAP_LINK_TYPE_ISDNOV, "ISDN data over voice" },
536 {BAP_LINK_TYPE_RESV5, "Reserved" },
537 {BAP_LINK_TYPE_RESV6, "Reserved" },
538 {BAP_LINK_TYPE_RESV7, "Reserved" },
542 #define BAP_PHONE_DELTA_SUBOPT_UNIQ_DIGIT 1 /* Unique Digit */
543 #define BAP_PHONE_DELTA_SUBOPT_SUBSC_NUM 2 /* Subscriber Number */
544 #define BAP_PHONE_DELTA_SUBOPT_PHONENUM_SUBADDR 3 /* Phone Number Sub Address */
545 static const value_string bap_phone_delta_subopt_vals[] = {
546 {BAP_PHONE_DELTA_SUBOPT_UNIQ_DIGIT, "Unique Digit" },
547 {BAP_PHONE_DELTA_SUBOPT_SUBSC_NUM, "Subscriber Number" },
548 {BAP_PHONE_DELTA_SUBOPT_PHONENUM_SUBADDR, "Phone Number Sub Address" },
553 * Cause codes for Cause.
555 * The following code table is taken from packet-q931.c but is slightly
556 * adapted to BAP protocol.
558 static const value_string q931_cause_code_vals[] = {
559 { 0x00, "Call successful" },
560 { 0x01, "Unallocated (unassigned) number" },
561 { 0x02, "No route to specified transit network" },
562 { 0x03, "No route to destination" },
563 { 0x04, "Send special information tone" },
564 { 0x05, "Misdialled trunk prefix" },
565 { 0x06, "Channel unacceptable" },
566 { 0x07, "Call awarded and being delivered in an established channel" },
567 { 0x08, "Prefix 0 dialed but not allowed" },
568 { 0x09, "Prefix 1 dialed but not allowed" },
569 { 0x0A, "Prefix 1 dialed but not required" },
570 { 0x0B, "More digits received than allowed, call is proceeding" },
571 { 0x10, "Normal call clearing" },
572 { 0x11, "User busy" },
573 { 0x12, "No user responding" },
574 { 0x13, "No answer from user (user alerted)" },
575 { 0x14, "Subscriber absent" },
576 { 0x15, "Call rejected" },
577 { 0x16, "Number changed" },
578 { 0x17, "Reverse charging rejected" },
579 { 0x18, "Call suspended" },
580 { 0x19, "Call resumed" },
581 { 0x1A, "Non-selected user clearing" },
582 { 0x1B, "Destination out of order" },
583 { 0x1C, "Invalid number format (incomplete number)" },
584 { 0x1D, "Facility rejected" },
585 { 0x1E, "Response to STATUS ENQUIRY" },
586 { 0x1F, "Normal unspecified" },
587 { 0x21, "Circuit out of order" },
588 { 0x22, "No circuit/channel available" },
589 { 0x23, "Destination unattainable" },
590 { 0x25, "Degraded service" },
591 { 0x26, "Network out of order" },
592 { 0x27, "Transit delay range cannot be achieved" },
593 { 0x28, "Throughput range cannot be achieved" },
594 { 0x29, "Temporary failure" },
595 { 0x2A, "Switching equipment congestion" },
596 { 0x2B, "Access information discarded" },
597 { 0x2C, "Requested circuit/channel not available" },
598 { 0x2D, "Pre-empted" },
599 { 0x2E, "Precedence call blocked" },
600 { 0x2F, "Resources unavailable, unspecified" },
601 { 0x31, "Quality of service unavailable" },
602 { 0x32, "Requested facility not subscribed" },
603 { 0x33, "Reverse charging not allowed" },
604 { 0x34, "Outgoing calls barred" },
605 { 0x35, "Outgoing calls barred within CUG" },
606 { 0x36, "Incoming calls barred" },
607 { 0x37, "Incoming calls barred within CUG" },
608 { 0x38, "Call waiting not subscribed" },
609 { 0x39, "Bearer capability not authorized" },
610 { 0x3A, "Bearer capability not presently available" },
611 { 0x3E, "Inconsistency in designated outgoing access information and subscriber class" },
612 { 0x3F, "Service or option not available, unspecified" },
613 { 0x41, "Bearer capability not implemented" },
614 { 0x42, "Channel type not implemented" },
615 { 0x43, "Transit network selection not implemented" },
616 { 0x44, "Message not implemented" },
617 { 0x45, "Requested facility not implemented" },
618 { 0x46, "Only restricted digital information bearer capability is available" },
619 { 0x4F, "Service or option not implemented, unspecified" },
620 { 0x51, "Invalid call reference value" },
621 { 0x52, "Identified channel does not exist" },
622 { 0x53, "Call identity does not exist for suspended call" },
623 { 0x54, "Call identity in use" },
624 { 0x55, "No call suspended" },
625 { 0x56, "Call having the requested call identity has been cleared" },
626 { 0x57, "Called user not member of CUG" },
627 { 0x58, "Incompatible destination" },
628 { 0x59, "Non-existent abbreviated address entry" },
629 { 0x5A, "Destination address missing, and direct call not subscribed" },
630 { 0x5B, "Invalid transit network selection (national use)" },
631 { 0x5C, "Invalid facility parameter" },
632 { 0x5D, "Mandatory information element is missing" },
633 { 0x5F, "Invalid message, unspecified" },
634 { 0x60, "Mandatory information element is missing" },
635 { 0x61, "Message type non-existent or not implemented" },
636 { 0x62, "Message not compatible with call state or message type non-existent or not implemented" },
637 { 0x63, "Information element non-existent or not implemented" },
638 { 0x64, "Invalid information element contents" },
639 { 0x65, "Message not compatible with call state" },
640 { 0x66, "Recovery on timer expiry" },
641 { 0x67, "Parameter non-existent or not implemented - passed on" },
642 { 0x6E, "Message with unrecognized parameter discarded" },
643 { 0x6F, "Protocol error, unspecified" },
644 { 0x7F, "Internetworking, unspecified" },
645 { 0xFF, "Non-specific failure" },
649 static const value_string bap_call_status_opt_action_vals[] = {
655 #define STAC_CM_NONE 0
656 #define STAC_CM_LCB 1
657 #define STAC_CM_CRC 2
659 #define STAC_CM_EXTMODE 4
660 static const value_string stac_checkmode_vals[] = {
661 {STAC_CM_NONE, "None" },
662 {STAC_CM_LCB, "LCB" },
663 {STAC_CM_CRC, "CRC" },
664 {STAC_CM_SN, "Sequence Number" },
665 {STAC_CM_EXTMODE, "Extended Mode" },
669 #define LZSDCP_CM_NONE 0
670 #define LZSDCP_CM_LCB 1
671 #define LZSDCP_CM_SN 2
672 #define LZSDCP_CM_SN_LCB 3
673 static const value_string lzsdcp_checkmode_vals[] = {
674 {LZSDCP_CM_NONE, "None" },
675 {LZSDCP_CM_LCB, "LCB" },
676 {LZSDCP_CM_SN, "Sequence Number" },
677 {LZSDCP_CM_SN_LCB, "Sequence Number + LCB" },
681 #define LZSDCP_PM_NONE 0
682 #define LZSDCP_PM_PROC_UNCOMP 1
683 static const value_string lzsdcp_processmode_vals[] = {
684 {LZSDCP_PM_NONE, "None" },
685 {LZSDCP_PM_PROC_UNCOMP, "Process-Uncompressed" },
692 #define CI_MRU 1 /* Maximum Receive Unit */
693 #define CI_ASYNCMAP 2 /* Async Control Character Map */
694 #define CI_AUTHTYPE 3 /* Authentication Type */
695 #define CI_QUALITY 4 /* Quality Protocol */
696 #define CI_MAGICNUMBER 5 /* Magic Number */
697 #define CI_PCOMPRESSION 7 /* Protocol Field Compression */
698 #define CI_ACCOMPRESSION 8 /* Address/Control Field Compression */
699 #define CI_FCS_ALTERNATIVES 9 /* FCS Alternatives (RFC 1570) */
700 #define CI_SELF_DESCRIBING_PAD 10 /* Self-Describing Pad (RFC 1570) */
701 #define CI_NUMBERED_MODE 11 /* Numbered Mode (RFC 1663) */
702 #define CI_CALLBACK 13 /* Callback (RFC 1570) */
703 #define CI_COMPOUND_FRAMES 15 /* Compound frames (RFC 1570) */
704 #define CI_MULTILINK_MRRU 17 /* Multilink MRRU (RFC 1990) */
705 #define CI_MULTILINK_SSNH 18 /* Multilink Short Sequence Number
707 #define CI_MULTILINK_EP_DISC 19 /* Multilink Endpoint Discriminator
709 #define CI_DCE_IDENTIFIER 21 /* DCE Identifier */
710 #define CI_MULTILINK_PLUS_PROC 22 /* Multilink Plus Procedure */
711 #define CI_LINK_DISC_FOR_BACP 23 /* Link Discriminator for BACP
713 #define CI_LCP_AUTHENTICATION 24 /* LCP Authentication Option */
714 #define CI_COBS 25 /* Consistent Overhead Byte
716 #define CI_PREFIX_ELISION 26 /* Prefix elision */
717 #define CI_MULTILINK_HDR_FMT 27 /* Multilink header format */
718 #define CI_INTERNATIONALIZATION 28 /* Internationalization (RFC 2484) */
719 #define CI_SDL_ON_SONET_SDH 29 /* Simple Data Link on SONET/SDH */
721 static void dissect_lcp_mru_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
722 int offset, guint length, packet_info *pinfo,
724 static void dissect_lcp_async_map_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
725 int offset, guint length, packet_info *pinfo,
727 static void dissect_lcp_protocol_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
728 int offset, guint length, packet_info *pinfo,
730 static void dissect_lcp_authprot_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
731 int offset, guint length, packet_info *pinfo,
733 static void dissect_lcp_magicnumber_opt(const ip_tcp_opt *optp,
734 tvbuff_t *tvb, int offset, guint length,
735 packet_info *pinfo, proto_tree *tree);
736 static void dissect_lcp_fcs_alternatives_opt(const ip_tcp_opt *optp,
737 tvbuff_t *tvb, int offset, guint length,
738 packet_info *pinfo, proto_tree *tree);
739 static void dissect_lcp_numbered_mode_opt(const ip_tcp_opt *optp,
740 tvbuff_t *tvb, int offset, guint length,
741 packet_info *pinfo, proto_tree *tree);
742 static void dissect_lcp_self_describing_pad_opt(const ip_tcp_opt *optp,
743 tvbuff_t *tvb, int offset, guint length,
744 packet_info *pinfo, proto_tree *tree);
745 static void dissect_lcp_callback_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
746 int offset, guint length, packet_info *pinfo,
748 static void dissect_lcp_multilink_mrru_opt(const ip_tcp_opt *optp,
749 tvbuff_t *tvb, int offset, guint length,
750 packet_info *pinfo, proto_tree *tree);
751 static void dissect_lcp_multilink_ep_disc_opt(const ip_tcp_opt *optp,
752 tvbuff_t *tvb, int offset, guint length,
753 packet_info *pinfo, proto_tree *tree);
754 static void dissect_lcp_bap_link_discriminator_opt(const ip_tcp_opt *optp,
755 tvbuff_t *tvb, int offset, guint length,
756 packet_info *pinfo, proto_tree *tree);
757 static void dissect_lcp_internationalization_opt(const ip_tcp_opt *optp,
758 tvbuff_t *tvb, int offset, guint length,
759 packet_info *pinfo, proto_tree *tree);
760 static void dissect_mp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
762 static const ip_tcp_opt lcp_opts[] = {
765 "Maximum Receive Unit",
773 "Async Control Character Map",
777 dissect_lcp_async_map_opt
781 "Authentication protocol",
782 &ett_lcp_authprot_opt,
785 dissect_lcp_authprot_opt
790 &ett_lcp_qualprot_opt,
793 dissect_lcp_protocol_opt
801 dissect_lcp_magicnumber_opt
805 "Protocol field compression",
813 "Address/control field compression",
822 &ett_lcp_fcs_alternatives_opt,
825 dissect_lcp_fcs_alternatives_opt
828 CI_SELF_DESCRIBING_PAD,
829 "Maximum octets of self-describing padding",
833 dissect_lcp_self_describing_pad_opt
838 &ett_lcp_numbered_mode_opt,
841 dissect_lcp_numbered_mode_opt
846 &ett_lcp_callback_opt,
849 dissect_lcp_callback_opt,
865 dissect_lcp_multilink_mrru_opt
869 "Use short sequence number headers",
876 CI_MULTILINK_EP_DISC,
877 "Multilink endpoint discriminator",
878 &ett_lcp_multilink_ep_disc_opt,
881 dissect_lcp_multilink_ep_disc_opt,
892 CI_MULTILINK_PLUS_PROC,
893 "Multilink Plus Procedure",
900 CI_LINK_DISC_FOR_BACP,
901 "Link discriminator for BAP",
905 dissect_lcp_bap_link_discriminator_opt
908 CI_LCP_AUTHENTICATION,
909 "LCP authentication",
917 "Consistent Overhead Byte Stuffing",
932 CI_MULTILINK_HDR_FMT,
933 "Multilink header format",
940 CI_INTERNATIONALIZATION,
941 "Internationalization",
942 &ett_lcp_internationalization_opt,
945 dissect_lcp_internationalization_opt
949 "Simple data link on SONET/SDH",
957 #define N_LCP_OPTS (sizeof lcp_opts / sizeof lcp_opts[0])
963 #define CI_PDN_IDENTIFIER 1
964 #define CI_ACCESS_POINT_NM 2
965 #define CI_PDN_TYPE 3
966 #define CI_PDN_ADDRESS 4
967 #define CI_PROTOCOL_CONFIG 5
968 #define CI_ERROR_CODE 6
969 #define CI_ATTACH_TYPE 7
970 #define CI_IPv4DEFAULT_ROUTER 8
971 #define CI_ADDRESS_ALLOC 9
972 #define CI_APN_AMBR 10
974 static void dissect_vsncp_pdnid_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
975 int offset, guint length, packet_info *pinfo,
977 static void dissect_vsncp_apname_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
978 int offset, guint length, packet_info *pinfo,
980 static void dissect_vsncp_pdntype_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
981 int offset, guint length, packet_info *pinfo,
983 static void dissect_vsncp_pdnaddress_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
984 int offset, guint length, packet_info *pinfo,
986 static void dissect_vsncp_pco_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
987 int offset, guint length, packet_info *pinfo,
989 static void dissect_vsncp_errorcode_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
990 int offset, guint length, packet_info *pinfo,
992 static void dissect_vsncp_attachtype_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
993 int offset, guint length, packet_info *pinfo,
995 static void dissect_vsncp_ipv4adress_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
996 int offset, guint length, packet_info *pinfo,
998 static void dissect_vsncp_addressalloc_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
999 int offset, guint length, packet_info *pinfo,
1002 static const ip_tcp_opt vsncp_opts[] = {
1009 dissect_vsncp_pdnid_opt
1013 "Access Point Name",
1017 dissect_vsncp_apname_opt
1025 dissect_vsncp_pdntype_opt
1033 dissect_vsncp_pdnaddress_opt
1037 "Protocol Configuration Options",
1041 dissect_vsncp_pco_opt
1049 dissect_vsncp_errorcode_opt
1057 dissect_vsncp_attachtype_opt
1060 CI_IPv4DEFAULT_ROUTER,
1061 "IPv4 Default Router Address",
1065 dissect_vsncp_ipv4adress_opt
1069 "Address Allocation Cause",
1073 dissect_vsncp_addressalloc_opt
1085 #define N_VSNCP_OPTS (sizeof vsncp_opts / sizeof vsncp_opts[0])
1090 #define CHAP_ALG_MD5 0x05 /* CHAP with MD5 */
1091 #define CHAP_ALG_MSV1 0x80 /* MS-CHAPv1 */
1092 #define CHAP_ALG_MSV2 0x81 /* MS-CHAPv2 */
1094 static const value_string chap_alg_vals[] = {
1095 {CHAP_ALG_MD5, "CHAP with MD5" },
1096 {CHAP_ALG_MSV1, "MS-CHAP" },
1097 {CHAP_ALG_MSV2, "MS-CHAP-2" },
1105 #define CI_ADDRS 1 /* IP Addresses (deprecated) (RFC 1172) */
1106 #define CI_COMPRESSTYPE 2 /* Compression Type (RFC 1332) */
1107 #define CI_ADDR 3 /* IP Address (RFC 1332) */
1108 #define CI_MOBILE_IPv4 4 /* Mobile IPv4 (RFC 2290) */
1109 #define CI_MS_DNS1 129 /* Primary DNS value (RFC 1877) */
1110 #define CI_MS_WINS1 130 /* Primary WINS value (RFC 1877) */
1111 #define CI_MS_DNS2 131 /* Secondary DNS value (RFC 1877) */
1112 #define CI_MS_WINS2 132 /* Secondary WINS value (RFC 1877) */
1114 static void dissect_ipcp_addrs_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1115 int offset, guint length, packet_info *pinfo,
1117 static void dissect_ipcp_addr_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1118 int offset, guint length, packet_info *pinfo,
1120 static void dissect_ipcp_compress_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1121 int offset, guint length, packet_info *pinfo,
1123 static void dissect_ipcp_iphc_disableprot_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1124 int offset, guint length, packet_info *pinfo,
1127 static const ip_tcp_opt ipcp_opts[] = {
1130 "IP addresses (deprecated)",
1131 &ett_ipcp_ipaddrs_opt,
1134 dissect_ipcp_addrs_opt
1139 &ett_ipcp_compress_opt,
1142 dissect_ipcp_compress_opt
1150 dissect_ipcp_addr_opt
1154 "Mobile node's home IP address",
1158 dissect_ipcp_addr_opt
1162 "Primary DNS server IP address",
1166 dissect_ipcp_addr_opt
1170 "Primary WINS server IP address",
1174 dissect_ipcp_addr_opt
1178 "Secondary DNS server IP address",
1182 dissect_ipcp_addr_opt
1186 "Secondary WINS server IP address",
1190 dissect_ipcp_addr_opt
1194 #define N_IPCP_OPTS (sizeof ipcp_opts / sizeof ipcp_opts[0])
1198 * IP Compression options
1200 #define IPCP_COMPRESS_VJ_1172 0x37 /* value defined in RFC1172 (typo) */
1201 #define IPCP_COMPRESS_VJ 0x2d /* value defined in RFC1332 (correct) */
1202 #define IPCP_COMPRESS_IPHC 0x61
1204 const value_string ipcp_compress_proto_vals[] = {
1205 { IPCP_COMPRESS_VJ_1172, "VJ compression (RFC1172-typo)" },
1206 { IPCP_COMPRESS_VJ, "VJ compression" },
1207 { IPCP_COMPRESS_IPHC, "IPHC compression" },
1211 /* IPHC suboptions (RFC2508, 3544) */
1212 #define IPCP_IPHC_CRTP 1
1213 #define IPCP_IPHC_ECRTP 2
1214 #define IPCP_IPHC_DISABLE_PROTO 3 /* Disable compression for protocol */
1216 const value_string ipcp_iphc_disable_proto_vals[] = {
1222 static const ip_tcp_opt ipcp_iphc_subopts[] = {
1225 "RTP compression (RFC2508)",
1233 "Enhanced RTP compression (RFC3545)",
1240 IPCP_IPHC_DISABLE_PROTO,
1241 "Enhanced RTP compression (RFC3545)",
1242 &ett_ipcp_iphc_disableprot_opt,
1245 dissect_ipcp_iphc_disableprot_opt
1249 #define N_IPCP_IPHC_SUBOPTS (sizeof ipcp_iphc_subopts / sizeof ipcp_iphc_subopts[0])
1255 #define CI_OSICP_ALIGN_NPDU 1 /* Alignment of the OSI NPDU (RFC 1377) */
1257 static void dissect_osicp_align_npdu_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1258 int offset, guint length, packet_info *pinfo,
1261 static const ip_tcp_opt osicp_opts[] = {
1263 CI_OSICP_ALIGN_NPDU,
1265 &ett_osicp_align_npdu_opt,
1268 dissect_osicp_align_npdu_opt
1272 #define N_OSICP_OPTS (sizeof osicp_opts / sizeof osicp_opts[0])
1277 #define CI_CCP_OUI 0 /* OUI (RFC1962) */
1278 #define CI_CCP_PREDICT1 1 /* Predictor type 1 (RFC1962) */
1279 #define CI_CCP_PREDICT2 2 /* Predictor type 2 (RFC1962) */
1280 #define CI_CCP_PUDDLE 3 /* Puddle Jumper (RFC1962) */
1281 #define CI_CCP_HPPPC 16 /* Hewlett-Packard PPC (RFC1962) */
1282 #define CI_CCP_STAC 17 /* stac Electronics LZS (RFC1974) */
1283 #define CI_CCP_MPPC 18 /* Microsoft PPC (RFC2218/3078) */
1284 #define CI_CCP_GFZA 19 /* Gandalf FZA (RFC1962) */
1285 #define CI_CCP_V42BIS 20 /* V.42bis compression */
1286 #define CI_CCP_BSDLZW 21 /* BSD LZW Compress (RFC1977) */
1287 #define CI_CCP_LZSDCP 23 /* LZS-DCP (RFC1967) */
1288 #define CI_CCP_MVRCA 24 /* MVRCA (Magnalink) (RFC1975) */
1289 #define CI_CCP_DEFLATE 26 /* Deflate (RFC1979) */
1290 #define CI_CCP_RESERVED 255 /* Reserved (RFC1962) */
1293 * Microsoft Point-To-Point Compression (MPPC) and Encryption (MPPE)
1296 #define MPPC_SUPPORTED_BITS_C 0x00000001 /* MPPC negotiation */
1297 #define MPPE_SUPPORTED_BITS_D 0x00000010 /* Obsolete */
1298 #define MPPE_SUPPORTED_BITS_L 0x00000020 /* 40-bit encryption */
1299 #define MPPE_SUPPORTED_BITS_S 0x00000040 /* 128-bit encryption */
1300 #define MPPE_SUPPORTED_BITS_M 0x00000080 /* 56-bit encryption */
1301 #define MPPE_SUPPORTED_BITS_H 0x01000000 /* stateless mode */
1303 static void dissect_ccp_stac_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1304 int offset, guint length, packet_info *pinfo,
1307 static void dissect_ccp_mppc_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1308 int offset, guint length, packet_info *pinfo,
1311 static void dissect_ccp_bsdcomp_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1312 int offset, guint length, packet_info *pinfo,
1315 static void dissect_ccp_lzsdcp_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1316 int offset, guint length, packet_info *pinfo,
1319 static void dissect_ccp_mvrca_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1320 int offset, guint length, packet_info *pinfo,
1323 static void dissect_ccp_deflate_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1324 int offset, guint length, packet_info *pinfo,
1327 static const ip_tcp_opt ccp_opts[] = {
1330 "Stac Electronics LZS",
1334 /* In RFC 1974, this is a fixed-length field of size 5,
1335 but in Ascend Proprietary STAC compression this field
1336 is 6 octets. Sigh... */
1337 dissect_ccp_stac_opt
1345 dissect_ccp_mppc_opt
1350 &ett_ccp_bsdcomp_opt,
1353 dissect_ccp_bsdcomp_opt
1358 &ett_ccp_lzsdcp_opt,
1361 dissect_ccp_lzsdcp_opt
1365 "MVRCA (Magnalink)",
1369 dissect_ccp_mvrca_opt
1374 &ett_ccp_deflate_opt,
1376 4, /* RFC1979 says the length is 3 but it's actually 4. */
1377 dissect_ccp_deflate_opt
1381 #define N_CCP_OPTS (sizeof ccp_opts / sizeof ccp_opts[0])
1386 #define CI_CBCP_NO_CALLBACK 1 /* No callback */
1387 #define CI_CBCP_CB_USER 2 /* Callback to a user-specified number */
1388 #define CI_CBCP_CB_PRE 3 /* Callback to a pre-specified or
1389 administrator specified number */
1390 #define CI_CBCP_CB_ANY 4 /* Callback to any of a list of numbers */
1392 static void dissect_cbcp_no_callback_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1393 int offset, guint length, packet_info *pinfo,
1396 static void dissect_cbcp_callback_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1397 int offset, guint length, packet_info *pinfo,
1400 static const ip_tcp_opt cbcp_opts[] = {
1402 CI_CBCP_NO_CALLBACK,
1407 dissect_cbcp_no_callback_opt
1411 "Callback to a user-specified number",
1412 &ett_cbcp_callback_opt,
1415 dissect_cbcp_callback_opt
1419 "Callback to a pre-specified or admin-specified number",
1420 &ett_cbcp_callback_opt,
1423 dissect_cbcp_callback_opt
1427 "Callback to any of a list of numbers",
1428 &ett_cbcp_callback_opt,
1431 dissect_cbcp_callback_opt
1436 #define N_CBCP_OPTS (sizeof cbcp_opts / sizeof cbcp_opts[0])
1441 #define CI_BACP_FAVORED_PEER 1 /* Favored-Peer */
1443 static void dissect_bacp_favored_peer_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1444 int offset, guint length, packet_info *pinfo,
1447 static const ip_tcp_opt bacp_opts[] = {
1449 CI_BACP_FAVORED_PEER,
1451 &ett_bacp_favored_peer_opt,
1454 dissect_bacp_favored_peer_opt
1458 #define N_BACP_OPTS (sizeof bacp_opts / sizeof bacp_opts[0])
1463 #define CI_BAP_LINK_TYPE 1 /* Link Type */
1464 #define CI_BAP_PHONE_DELTA 2 /* Phone-Delta */
1465 #define CI_BAP_NO_PHONE_NUM_NEEDED 3 /* No Phone Number Needed */
1466 #define CI_BAP_REASON 4 /* Reason */
1467 #define CI_BAP_LINK_DISC 5 /* Link Discriminator */
1468 #define CI_BAP_CALL_STATUS 6 /* Call Status */
1470 static void dissect_bap_link_type_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1471 int offset, guint length, packet_info *pinfo,
1474 static void dissect_bap_phone_delta_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1475 int offset, guint length, packet_info *pinfo,
1478 static void dissect_bap_link_disc_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1479 int offset, guint length, packet_info *pinfo,
1482 static void dissect_bap_reason_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1483 int offset, guint length, packet_info *pinfo,
1486 static void dissect_bap_call_status_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1487 int offset, guint length, packet_info *pinfo,
1490 static const ip_tcp_opt bap_opts[] = {
1494 &ett_bap_link_type_opt,
1497 dissect_bap_link_type_opt
1502 &ett_bap_phone_delta_opt,
1505 dissect_bap_phone_delta_opt
1508 CI_BAP_NO_PHONE_NUM_NEEDED,
1509 "No Phone Number Needed",
1521 dissect_bap_reason_opt
1525 "Link Discriminator",
1529 dissect_bap_link_disc_opt
1534 &ett_bap_call_status_opt,
1537 dissect_bap_call_status_opt
1541 #define N_BAP_OPTS (sizeof bap_opts / sizeof bap_opts[0])
1543 static void dissect_ppp(tvbuff_t *tvb, packet_info *pinfo,
1546 static const value_string pap_vals[] = {
1547 {CONFREQ, "Authenticate-Request" },
1548 {CONFACK, "Authenticate-Ack" },
1549 {CONFNAK, "Authenticate-Nak" },
1552 static void dissect_pap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
1554 #define CHAP_CHAL 1 /* CHAP Challenge */
1555 #define CHAP_RESP 2 /* CHAP Response */
1556 #define CHAP_SUCC 3 /* CHAP Success */
1557 #define CHAP_FAIL 4 /* CHAP Failure */
1559 static const value_string chap_vals[] = {
1560 {CHAP_CHAL, "Challenge" },
1561 {CHAP_RESP, "Response" },
1562 {CHAP_SUCC, "Success" },
1563 {CHAP_FAIL, "Failure" },
1566 static void dissect_chap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
1568 static const value_string pppmuxcp_vals[] = {
1569 {CONFREQ, "Configuration Request" },
1570 {CONFACK, "Configuration Ack" },
1578 #define CI_DEFAULT_PID 1
1580 static void dissect_pppmuxcp_def_pid_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1581 int offset, guint length, packet_info *pinfo, proto_tree *tree);
1584 static const ip_tcp_opt pppmuxcp_opts[] = {
1587 "Default Protocol ID",
1591 dissect_pppmuxcp_def_pid_opt
1595 #define N_PPPMUXCP_OPTS (sizeof pppmuxcp_opts / sizeof pppmuxcp_opts[0])
1600 #define CI_IPV6CP_IF_ID 1 /* Interface Identifier (RFC 2472) */
1601 #define CI_IPV6CP_COMPRESSTYPE 2 /* Compression Type (RFC 2472) */
1603 static void dissect_ipv6cp_if_id_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1604 int offset, guint length, packet_info *pinfo,
1607 static const ip_tcp_opt ipv6cp_opts[] = {
1610 "Interface Identifier",
1611 &ett_ipv6cp_if_id_opt,
1614 dissect_ipv6cp_if_id_opt
1619 &ett_ipv6cp_compress_opt,
1622 dissect_ipcp_compress_opt
1626 #define N_IPV6CP_OPTS (sizeof ipv6cp_opts / sizeof ipv6cp_opts[0])
1629 *******************************************************************************
1630 * DETAILS : Calculate a new FCS-16 given the current FCS-16 and the new data.
1631 *******************************************************************************
1634 fcs16(tvbuff_t * tvbuff)
1636 guint len = tvb_length(tvbuff)-2;
1638 /* Check for Invalid Length */
1641 return crc16_ccitt_tvb(tvbuff, len);
1645 *******************************************************************************
1646 * DETAILS : Calculate a new FCS-32 given the current FCS-32 and the new data.
1647 *******************************************************************************
1650 fcs32(tvbuff_t * tvbuff)
1652 guint len = tvb_length(tvbuff)-4;
1654 /* Check for invalid Length */
1656 return (0x00000000);
1657 return crc32_ccitt_tvb(tvbuff, len);
1661 decode_fcs(tvbuff_t *tvb, proto_tree *fh_tree, int fcs_decode, int proto_offset)
1664 gint len, reported_len;
1670 * Remove the FCS, if any, from the packet data.
1672 switch (fcs_decode) {
1675 next_tvb = tvb_new_subset_remaining(tvb, proto_offset);
1680 * Do we have the entire packet, and does it include a 2-byte FCS?
1682 len = tvb_length_remaining(tvb, proto_offset);
1683 reported_len = tvb_reported_length_remaining(tvb, proto_offset);
1684 if (reported_len < 2 || len < 0) {
1686 * The packet is claimed not to even have enough data for a 2-byte FCS,
1687 * or we're already past the end of the captured data.
1688 * Don't slice anything off.
1690 next_tvb = tvb_new_subset_remaining(tvb, proto_offset);
1691 } else if (len < reported_len) {
1693 * The packet is claimed to have enough data for a 2-byte FCS, but
1694 * we didn't capture all of the packet.
1695 * Slice off the 2-byte FCS from the reported length, and trim the
1696 * captured length so it's no more than the reported length; that
1697 * will slice off what of the FCS, if any, is in the captured
1701 if (len > reported_len)
1703 next_tvb = tvb_new_subset(tvb, proto_offset, len, reported_len);
1706 * We have the entire packet, and it includes a 2-byte FCS.
1711 next_tvb = tvb_new_subset(tvb, proto_offset, len, reported_len);
1714 * Compute the FCS and put it into the tree.
1716 rx_fcs_offset = proto_offset + len;
1717 rx_fcs_exp = fcs16(tvb);
1718 rx_fcs_got = tvb_get_letohs(tvb, rx_fcs_offset);
1719 if (rx_fcs_got != rx_fcs_exp) {
1720 proto_tree_add_text(fh_tree, tvb, rx_fcs_offset, 2,
1721 "FCS 16: 0x%04x [incorrect, should be 0x%04x]",
1722 rx_fcs_got, rx_fcs_exp);
1724 proto_tree_add_text(fh_tree, tvb, rx_fcs_offset, 2,
1725 "FCS 16: 0x%04x [correct]",
1733 * Do we have the entire packet, and does it include a 4-byte FCS?
1735 len = tvb_length_remaining(tvb, proto_offset);
1736 reported_len = tvb_reported_length_remaining(tvb, proto_offset);
1737 if (reported_len < 4) {
1739 * The packet is claimed not to even have enough data for a 4-byte FCS.
1740 * Just pass on the tvbuff as is.
1742 next_tvb = tvb_new_subset_remaining(tvb, proto_offset);
1743 } else if (len < reported_len) {
1745 * The packet is claimed to have enough data for a 4-byte FCS, but
1746 * we didn't capture all of the packet.
1747 * Slice off the 4-byte FCS from the reported length, and trim the
1748 * captured length so it's no more than the reported length; that
1749 * will slice off what of the FCS, if any, is in the captured
1753 if (len > reported_len)
1755 next_tvb = tvb_new_subset(tvb, proto_offset, len, reported_len);
1758 * We have the entire packet, and it includes a 4-byte FCS.
1763 next_tvb = tvb_new_subset(tvb, proto_offset, len, reported_len);
1766 * Compute the FCS and put it into the tree.
1768 rx_fcs_offset = proto_offset + len;
1769 rx_fcs_exp = fcs32(tvb);
1770 rx_fcs_got = tvb_get_letohl(tvb, rx_fcs_offset);
1771 if (rx_fcs_got != rx_fcs_exp) {
1772 proto_tree_add_text(fh_tree, tvb, rx_fcs_offset, 4,
1773 "FCS 32: 0x%08x [incorrect, should be 0x%08x]",
1774 rx_fcs_got, rx_fcs_exp);
1776 proto_tree_add_text(fh_tree, tvb, rx_fcs_offset, 4,
1777 "FCS 32: 0x%08x [correct]",
1784 DISSECTOR_ASSERT_NOT_REACHED();
1792 capture_ppp_hdlc( const guchar *pd, int offset, int len, packet_counts *ld ) {
1793 if (!BYTES_ARE_IN_FRAME(offset, len, 2)) {
1797 if (pd[0] == CHDLC_ADDR_UNICAST || pd[0] == CHDLC_ADDR_MULTICAST) {
1798 capture_chdlc(pd, offset, len, ld);
1801 if (!BYTES_ARE_IN_FRAME(offset, len, 4)) {
1805 switch (pntohs(&pd[offset + 2])) {
1807 capture_ip(pd, offset + 4, len, ld);
1822 dissect_lcp_mru_opt(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
1823 guint length, packet_info *pinfo _U_,
1826 proto_tree_add_text(tree, tvb, offset, length, "%s: %u", optp->name,
1827 tvb_get_ntohs(tvb, offset + 2));
1831 dissect_lcp_async_map_opt(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
1832 guint length, packet_info *pinfo _U_,
1837 static const char *ctrlchars[32] = {
1838 "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL",
1839 "BS", "HT", "NL", "VT", "NP (FF)", "CR", "SO", "SI",
1840 "DLE", "DC1 (XON)", "DC2", "DC3 (XOFF)", "DC4", "NAK", "SYN", "ETB",
1841 "CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US"
1843 gint returned_length, str_index;
1847 * XXX - walk through the map and show the characters to map?
1848 * Put them in a subtree of this item, and have the top-level item
1849 * either say "None", "All", or give a list of the characters?)
1851 map = tvb_get_ntohl(tvb, offset + 2);
1852 if (map == 0x00000000)
1853 mapstr = "None"; /* don't map any control characters */
1854 else if (map == 0xffffffff)
1855 mapstr = "All"; /* map all control characters */
1857 #define MAX_MAPSTR_LEN (32*(10+2)+1)
1858 mapstr=ep_alloc(MAX_MAPSTR_LEN);
1860 * Show the names of the control characters being mapped.
1863 for (i = 0; i < 32; i++) {
1864 if (map & (1 << i)) {
1865 returned_length = g_snprintf((char *)(&mapstr[str_index]), MAX_MAPSTR_LEN-str_index,
1866 "%s%s", str_index?"":", ", ctrlchars[i]);
1867 str_index += MIN(returned_length, MAX_MAPSTR_LEN-str_index);
1871 proto_tree_add_text(tree, tvb, offset, length, "%s: 0x%08x (%s)", optp->name,
1876 dissect_lcp_protocol_opt(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
1877 guint length, packet_info *pinfo _U_,
1882 proto_tree *field_tree = NULL;
1884 tf = proto_tree_add_text(tree, tvb, offset, length, "%s: %u byte%s",
1885 optp->name, length, plurality(length, "", "s"));
1886 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
1889 protocol = tvb_get_ntohs(tvb, offset);
1890 proto_tree_add_text(field_tree, tvb, offset, 2, "%s: %s (0x%02x)", optp->name,
1891 val_to_str(protocol, ppp_vals, "Unknown"), protocol);
1895 proto_tree_add_text(field_tree, tvb, offset, length, "Data (%d byte%s)", length,
1896 plurality(length, "", "s"));
1900 dissect_lcp_authprot_opt(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
1901 guint length, packet_info *pinfo _U_,
1907 proto_tree *field_tree = NULL;
1909 tf = proto_tree_add_text(tree, tvb, offset, length, "%s: %u byte%s",
1910 optp->name, length, plurality(length, "", "s"));
1911 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
1914 protocol = tvb_get_ntohs(tvb, offset);
1915 proto_tree_add_text(field_tree, tvb, offset, 2, "%s: %s (0x%02x)", optp->name,
1916 val_to_str(protocol, ppp_vals, "Unknown"), protocol);
1920 if (protocol == PPP_CHAP) {
1921 algorithm = tvb_get_guint8(tvb, offset);
1922 proto_tree_add_text(field_tree, tvb, offset, length,
1923 "Algorithm: %s (0x%02x)",
1924 val_to_str(algorithm, chap_alg_vals, "Unknown"),
1928 proto_tree_add_text(field_tree, tvb, offset, length, "Data (%d byte%s)", length,
1929 plurality(length, "", "s"));
1935 dissect_lcp_magicnumber_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1936 int offset, guint length, packet_info *pinfo _U_,
1939 proto_tree_add_text(tree, tvb, offset, length, "%s: 0x%08x", optp->name,
1940 tvb_get_ntohl(tvb, offset + 2));
1944 dissect_lcp_fcs_alternatives_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1945 int offset, guint length, packet_info *pinfo _U_,
1949 proto_tree *field_tree = NULL;
1950 guint8 alternatives;
1952 alternatives = tvb_get_guint8(tvb, offset + 2);
1953 tf = proto_tree_add_text(tree, tvb, offset, length, "%s: 0x%02x",
1954 optp->name, alternatives);
1955 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
1957 if (alternatives & 0x1)
1958 proto_tree_add_text(field_tree, tvb, offset + 2, 1, "%s",
1959 decode_boolean_bitfield(alternatives, 0x1, 8, "Null FCS", NULL));
1960 if (alternatives & 0x2)
1961 proto_tree_add_text(field_tree, tvb, offset + 2, 1, "%s",
1962 decode_boolean_bitfield(alternatives, 0x2, 8, "CCITT 16-bit FCS", NULL));
1963 if (alternatives & 0x4)
1964 proto_tree_add_text(field_tree, tvb, offset + 2, 1, "%s",
1965 decode_boolean_bitfield(alternatives, 0x4, 8, "CCITT 32-bit FCS", NULL));
1969 dissect_lcp_self_describing_pad_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1970 int offset, guint length, packet_info *pinfo _U_,
1973 proto_tree_add_text(tree, tvb, offset, length, "%s: %u", optp->name,
1974 tvb_get_guint8(tvb, offset + 2));
1978 dissect_lcp_numbered_mode_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
1979 int offset, guint length, packet_info *pinfo _U_,
1983 proto_tree *field_tree = NULL;
1985 tf = proto_tree_add_text(tree, tvb, offset, length, "%s: %u byte%s",
1986 optp->name, length, plurality(length, "", "s"));
1987 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
1990 proto_tree_add_text(field_tree, tvb, offset, 1, "Window: %u",
1991 tvb_get_guint8(tvb, offset));
1995 proto_tree_add_text(field_tree, tvb, offset, length, "Address (%d byte%s)",
1996 length, plurality(length, "", "s"));
1999 static const value_string callback_op_vals[] = {
2000 {0, "Location is determined by user authentication" },
2001 {1, "Message is dialing string" },
2002 {2, "Message is location identifier" },
2003 {3, "Message is E.164" },
2004 {4, "Message is distinguished name" },
2006 {6, "Location is determined during CBCP negotiation" },
2011 dissect_lcp_callback_opt(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
2012 guint length, packet_info *pinfo _U_,
2016 proto_tree *field_tree = NULL;
2019 tf = proto_tree_add_text(tree, tvb, offset, length, "%s: %u byte%s",
2020 optp->name, length, plurality(length, "", "s"));
2021 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
2024 operation = tvb_get_guint8(tvb, offset);
2025 proto_tree_add_text(field_tree, tvb, offset, 1, "Operation: %s (0x%02x)",
2026 val_to_str(operation, callback_op_vals, "Unknown"),
2031 proto_tree_add_text(field_tree, tvb, offset, length, "Message (%d byte%s)",
2032 length, plurality(length, "", "s"));
2036 dissect_lcp_multilink_mrru_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2037 int offset, guint length, packet_info *pinfo _U_,
2040 proto_tree_add_text(tree, tvb, offset, length, "%s: %u", optp->name,
2041 tvb_get_ntohs(tvb, offset + 2));
2044 #define CLASS_NULL 0
2045 #define CLASS_LOCAL 1
2047 #define CLASS_IEEE_802_1 3
2048 #define CLASS_PPP_MAGIC_NUMBER 4
2049 #define CLASS_PSDN_DIRECTORY_NUMBER 5
2051 static const value_string multilink_ep_disc_class_vals[] = {
2052 {CLASS_NULL, "Null" },
2053 {CLASS_LOCAL, "Locally assigned address" },
2054 {CLASS_IP, "IP address" },
2055 {CLASS_IEEE_802_1, "IEEE 802.1 globally assigned MAC address" },
2056 {CLASS_PPP_MAGIC_NUMBER, "PPP magic-number block" },
2057 {CLASS_PSDN_DIRECTORY_NUMBER, "Public switched network directory number" },
2062 dissect_lcp_multilink_ep_disc_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2063 int offset, guint length, packet_info *pinfo _U_,
2067 proto_tree *field_tree = NULL;
2068 guint8 ep_disc_class;
2070 tf = proto_tree_add_text(tree, tvb, offset, length, "%s: %u byte%s",
2071 optp->name, length, plurality(length, "", "s"));
2072 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
2075 ep_disc_class = tvb_get_guint8(tvb, offset);
2076 proto_tree_add_text(field_tree, tvb, offset, 1, "Class: %s (%u)",
2077 val_to_str(ep_disc_class, multilink_ep_disc_class_vals, "Unknown"),
2082 switch (ep_disc_class) {
2085 proto_tree_add_text(field_tree, tvb, offset, length,
2086 "Address (%d byte%s), should have been empty",
2087 length, plurality(length, "", "s"));
2092 proto_tree_add_text(field_tree, tvb, offset, length,
2093 "Address (%d byte%s), should have been <20",
2094 length, plurality(length, "", "s"));
2096 proto_tree_add_text(field_tree, tvb, offset, length,
2097 "Address (%d byte%s)",
2098 length, plurality(length, "", "s"));
2104 proto_tree_add_text(field_tree, tvb, offset, length,
2105 "Address (%d byte%s), should have been 4",
2106 length, plurality(length, "", "s"));
2108 proto_tree_add_text(field_tree, tvb, offset, length,
2109 "Address: %s", ip_to_str(tvb_get_ptr(tvb, offset, 4)));
2113 case CLASS_IEEE_802_1:
2115 proto_tree_add_text(field_tree, tvb, offset, length,
2116 "Address (%d byte%s), should have been 6",
2117 length, plurality(length, "", "s"));
2119 proto_tree_add_text(field_tree, tvb, offset, length,
2120 "Address: %s", ether_to_str(tvb_get_ptr(tvb, offset, 6)));
2124 case CLASS_PPP_MAGIC_NUMBER:
2125 /* XXX - dissect as 32-bit magic numbers */
2127 proto_tree_add_text(field_tree, tvb, offset, length,
2128 "Address (%d byte%s), should have been <20",
2129 length, plurality(length, "", "s"));
2131 proto_tree_add_text(field_tree, tvb, offset, length,
2132 "Address (%d byte%s)",
2133 length, plurality(length, "", "s"));
2137 case CLASS_PSDN_DIRECTORY_NUMBER:
2139 proto_tree_add_text(field_tree, tvb, offset, length,
2140 "Address (%d byte%s), should have been <20",
2141 length, plurality(length, "", "s"));
2143 proto_tree_add_text(field_tree, tvb, offset, length,
2144 "Address (%d byte%s)",
2145 length, plurality(length, "", "s"));
2150 proto_tree_add_text(field_tree, tvb, offset, length,
2151 "Address (%d byte%s)",
2152 length, plurality(length, "", "s"));
2159 dissect_lcp_bap_link_discriminator_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2160 int offset, guint length, packet_info *pinfo _U_,
2163 proto_tree_add_text(tree, tvb, offset, length,
2164 "%s: 0x%04x", optp->name,
2165 tvb_get_ntohs(tvb, offset + 2));
2168 /* Character set numbers from the IANA charset registry. */
2169 static const value_string charset_num_vals[] = {
2175 dissect_lcp_internationalization_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2176 int offset, guint length, packet_info *pinfo _U_,
2180 proto_tree *field_tree = NULL;
2183 tf = proto_tree_add_text(tree, tvb, offset, length, "%s: %u byte%s",
2184 optp->name, length, plurality(length, "", "s"));
2185 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
2188 charset = tvb_get_ntohl(tvb, offset);
2189 proto_tree_add_text(field_tree, tvb, offset, 4, "Character set: %s (0x%04x)",
2190 val_to_str(charset, charset_num_vals, "Unknown"),
2195 /* XXX - should be displayed as an ASCII string */
2196 proto_tree_add_text(field_tree, tvb, offset, length, "Language tag (%d byte%s)",
2197 length, plurality(length, "", "s"));
2202 dissect_ipcp_addrs_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2203 int offset, guint length, packet_info *pinfo _U_,
2207 proto_tree *field_tree = NULL;
2209 tf = proto_tree_add_text(tree, tvb, offset, length, "%s: %u byte%s",
2210 optp->name, length, plurality(length, "", "s"));
2211 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
2214 proto_tree_add_text(field_tree, tvb, offset, 4,
2215 "Source IP address: %s",
2216 ip_to_str(tvb_get_ptr(tvb, offset, 4)));
2219 proto_tree_add_text(field_tree, tvb, offset, 4,
2220 "Destination IP address: %s",
2221 ip_to_str(tvb_get_ptr(tvb, offset, 4)));
2224 static void dissect_ipcp_addr_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2225 int offset, guint length, packet_info *pinfo _U_,
2228 proto_tree_add_text(tree, tvb, offset, length, "%s: %s", optp->name,
2229 ip_to_str(tvb_get_ptr(tvb, offset + 2, 4)));
2232 static void dissect_ipcp_compress_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2233 int offset, guint length, packet_info *pinfo _U_,
2239 proto_tree *field_tree = NULL;
2241 tf = proto_tree_add_text(tree, tvb, offset, length, "%s: %u byte%s",
2242 optp->name, length, plurality(length, "", "s"));
2244 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
2245 offset += 2; /* Skip option type + length */
2248 us = tvb_get_ntohs(tvb, offset);
2249 proto_tree_add_text( field_tree, tvb, offset, 2, "IP compression protocol: %s (0x%04x)",
2250 val_to_str( us, ipcp_compress_proto_vals, "Unknown protocol" ),
2252 offset += 2; /* skip protocol */
2257 case IPCP_COMPRESS_VJ_1172:
2258 case IPCP_COMPRESS_VJ:
2259 /* First byte is max slot id */
2260 ub = tvb_get_guint8( tvb, offset );
2261 proto_tree_add_text( field_tree, tvb, offset, 1,
2262 "Max slot id: %u (0x%02x)",
2268 /* second byte is "compress slot id" */
2269 ub = tvb_get_guint8( tvb, offset );
2270 proto_tree_add_text( field_tree, tvb, offset, 1,
2271 "Compress slot id: %s (0x%02x)",
2272 ub ? "yes" : "no", ub );
2279 case IPCP_COMPRESS_IPHC:
2283 us = tvb_get_ntohs(tvb, offset);
2284 proto_tree_add_text( field_tree, tvb, offset, 2,
2285 "TCP space: %u (0x%04x)",
2294 us = tvb_get_ntohs(tvb, offset);
2295 proto_tree_add_text( field_tree, tvb, offset, 2,
2296 "Non-TCP space: %u (0x%04x)",
2305 us = tvb_get_ntohs(tvb, offset);
2306 proto_tree_add_text( field_tree, tvb, offset, 2,
2307 "Max period: %u (0x%04x) compressed packets",
2316 us = tvb_get_ntohs(tvb, offset);
2317 proto_tree_add_text( field_tree, tvb, offset, 2,
2318 "Max time: %u (0x%04x) seconds",
2327 us = tvb_get_ntohs(tvb, offset);
2328 proto_tree_add_text( field_tree, tvb, offset, 2,
2329 "Max header: %u (0x%04x) bytes",
2336 tf = proto_tree_add_text(field_tree, tvb, offset, length,
2337 "Suboptions: (%u byte%s)",
2338 length, plurality(length, "", "s"));
2339 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
2340 dissect_ip_tcp_options(tvb, offset, length,
2341 ipcp_iphc_subopts, N_IPCP_IPHC_SUBOPTS, -1,
2342 pinfo, field_tree, NULL);
2348 proto_tree_add_text(field_tree, tvb, offset, length,
2349 "Data (%d byte%s)", length,
2350 plurality(length, "", "s"));
2355 static void dissect_ipcp_iphc_disableprot_opt(const ip_tcp_opt *optp,
2357 int offset, guint length,
2358 packet_info *pinfo _U_,
2362 proto_tree *field_tree;
2365 tf = proto_tree_add_text(tree, tvb, offset, length, "%s", optp->name);
2366 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
2368 param = tvb_get_guint8(tvb, offset + 2);
2369 proto_tree_add_text(field_tree, tvb, offset + 2, 1,
2370 "Protocol: %s (0x%02x)",
2371 val_to_str( param, ipcp_iphc_disable_proto_vals, "Unknown" ),
2376 static void dissect_osicp_align_npdu_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2377 int offset, guint length, packet_info *pinfo _U_,
2381 proto_tree *field_tree;
2384 tf = proto_tree_add_text(tree, tvb, offset, length, "%s", optp->name);
2385 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
2387 alignment = tvb_get_guint8(tvb, offset + 2);
2388 proto_tree_add_text(field_tree, tvb, offset + 2, 1,
2389 "Alignment: %u", alignment);
2392 static void dissect_pppmuxcp_def_pid_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2393 int offset, guint length, packet_info *pinfo _U_,
2396 pppmux_def_prot_id = tvb_get_ntohs(tvb, offset + 2);
2397 proto_tree_add_text(tree, tvb, offset + 2, length - 2, "%s: %s (0x%02x)",optp->name,
2398 val_to_str(pppmux_def_prot_id, ppp_vals, "Unknown"), pppmux_def_prot_id);
2403 dissect_ccp_stac_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2404 int offset, guint length, packet_info *pinfo _U_,
2408 proto_tree *field_tree;
2412 proto_tree_add_text(tree, tvb, offset, length,
2413 "%s (Ascend Proprietary version)", optp->name);
2414 /* We don't know how to decode the following 4 octets, since
2415 there's no public document that describe their usage. */
2417 tf = proto_tree_add_text(tree, tvb, offset, length, "%s", optp->name);
2418 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
2420 proto_tree_add_text(field_tree, tvb, offset + 2, 2,
2421 "History Count: %u", tvb_get_ntohs(tvb, offset + 2));
2422 check_mode = tvb_get_guint8(tvb, offset + 4);
2423 proto_tree_add_text(field_tree, tvb, offset + 4, 1,
2424 "Check Mode: %s (0x%02X)",
2425 val_to_str(check_mode, stac_checkmode_vals, "Unknown"),
2431 dissect_ccp_mppc_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2432 int offset, guint length, packet_info *pinfo _U_,
2436 proto_tree *flags_tree;
2437 guint32 supported_bits;
2439 supported_bits = tvb_get_ntohl(tvb, offset + 2);
2440 tf = proto_tree_add_text(tree, tvb, offset, length,
2441 "%s: Supported Bits: 0x%08X", optp->name, supported_bits);
2442 flags_tree = proto_item_add_subtree(tf, *optp->subtree_index);
2443 proto_tree_add_text(flags_tree, tvb, offset + 2, 4, "%s",
2444 decode_boolean_bitfield(supported_bits, MPPC_SUPPORTED_BITS_C, 8*4,
2445 "Desire to negotiate MPPC", "NO Desire to negotiate MPPC"));
2446 proto_tree_add_text(flags_tree, tvb, offset + 2, 4, "%s",
2447 decode_boolean_bitfield(supported_bits, MPPE_SUPPORTED_BITS_D, 8*4,
2448 "Obsolete (should NOT be 1)", "Obsolete (should ALWAYS be 0)"));
2449 proto_tree_add_text(flags_tree, tvb, offset + 2, 4, "%s",
2450 decode_boolean_bitfield(supported_bits, MPPE_SUPPORTED_BITS_L, 8*4,
2451 "40-bit encryption ON", "40-bit encryption OFF"));
2452 proto_tree_add_text(flags_tree, tvb, offset + 2, 4, "%s",
2453 decode_boolean_bitfield(supported_bits, MPPE_SUPPORTED_BITS_S, 8*4,
2454 "128-bit encryption ON", "128-bit encryption OFF"));
2455 proto_tree_add_text(flags_tree, tvb, offset + 2, 4, "%s",
2456 decode_boolean_bitfield(supported_bits, MPPE_SUPPORTED_BITS_M, 8*4,
2457 "56-bit encryption ON", "56-bit encryption OFF"));
2458 proto_tree_add_text(flags_tree, tvb, offset + 2, 4, "%s",
2459 decode_boolean_bitfield(supported_bits, MPPE_SUPPORTED_BITS_H, 8*4,
2460 "Stateless mode ON", "Stateless mode OFF"));
2464 dissect_ccp_bsdcomp_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2465 int offset, guint length, packet_info *pinfo _U_,
2469 proto_tree *field_tree;
2471 tf = proto_tree_add_text(tree, tvb, offset, length, "%s", optp->name);
2472 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
2474 proto_tree_add_text(field_tree, tvb, offset + 2, 1,
2475 "Version: %u", tvb_get_guint8(tvb, offset + 2) >> 5);
2476 proto_tree_add_text(field_tree, tvb, offset + 2, 1,
2478 tvb_get_guint8(tvb, offset + 2) & 0x1f);
2482 dissect_ccp_lzsdcp_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2483 int offset, guint length, packet_info *pinfo _U_,
2487 proto_tree *field_tree;
2489 guint8 process_mode;
2491 tf = proto_tree_add_text(tree, tvb, offset, length, "%s", optp->name);
2492 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
2494 proto_tree_add_text(field_tree, tvb, offset + 2, 2,
2495 "History Count: %u", tvb_get_ntohs(tvb, offset + 2));
2496 check_mode = tvb_get_guint8(tvb, offset + 4);
2497 proto_tree_add_text(field_tree, tvb, offset + 4, 1,
2498 "Check Mode: %s (0x%02X)",
2499 val_to_str(check_mode, lzsdcp_checkmode_vals, "Unknown"),
2501 process_mode = tvb_get_guint8(tvb, offset + 5);
2502 proto_tree_add_text(field_tree, tvb, offset + 5, 1,
2503 "Process Mode: %s (0x%02X)",
2504 val_to_str(process_mode, lzsdcp_processmode_vals, "Unkown"),
2509 dissect_ccp_mvrca_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2510 int offset, guint length, packet_info *pinfo _U_,
2514 proto_tree *field_tree;
2516 tf = proto_tree_add_text(tree, tvb, offset, length, "%s", optp->name);
2517 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
2519 proto_tree_add_text(field_tree, tvb, offset + 2, 1,
2520 "Features: %u", tvb_get_guint8(tvb, offset + 2) >> 5);
2521 proto_tree_add_text(field_tree, tvb, offset + 2, 1,
2522 "Packet by Packet flag: %s",
2523 tvb_get_guint8(tvb, offset + 2) & 0x20 ? "true" : "false");
2524 proto_tree_add_text(field_tree, tvb, offset + 2, 1,
2525 "History: %u", tvb_get_guint8(tvb, offset + 2) & 0x20);
2526 proto_tree_add_text(field_tree, tvb, offset + 3, 1,
2527 "Number of contexts: %u", tvb_get_guint8(tvb, offset + 3));
2531 dissect_ccp_deflate_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2532 int offset, guint length, packet_info *pinfo _U_,
2536 proto_tree *field_tree;
2539 tf = proto_tree_add_text(tree, tvb, offset, length, "%s", optp->name);
2540 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
2542 proto_tree_add_text(field_tree, tvb, offset + 2, 1,
2543 "Window: %u", hi_nibble(tvb_get_guint8(tvb, offset + 2)));
2544 method = lo_nibble(tvb_get_guint8(tvb, offset + 2));
2545 proto_tree_add_text(field_tree, tvb, offset + 2, 1,
2546 "Method: %s (0x%02x)",
2547 method == 0x08 ? "zlib compression" : "other", method);
2548 proto_tree_add_text(field_tree, tvb, offset + 3, 1,
2549 "Sequence number check method: %u",
2550 tvb_get_guint8(tvb, offset + 2) & 0x03);
2554 dissect_cbcp_no_callback_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2555 int offset, guint length, packet_info *pinfo _U_,
2558 proto_tree_add_text(tree, tvb, offset, length, "%s", optp->name);
2562 dissect_cbcp_callback_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2563 int offset, guint length, packet_info *pinfo _U_,
2567 proto_tree *field_tree;
2569 proto_tree *addr_tree;
2573 tf = proto_tree_add_text(tree, tvb, offset, length, "%s", optp->name);
2574 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
2576 proto_tree_add_text(field_tree, tvb, offset + 2, 1,
2577 "Callback delay: %u", tvb_get_guint8(tvb, offset + 2));
2581 while (length > 0) {
2582 ta = proto_tree_add_text(field_tree, tvb, offset, length,
2583 "Callback Address");
2584 addr_type = tvb_get_guint8(tvb, offset);
2585 addr_tree = proto_item_add_subtree(tf, ett_cbcp_callback_opt_addr);
2586 proto_tree_add_text(addr_tree, tvb, offset, 1,
2587 "Address Type: %s (%u)",
2588 ((addr_type == 1) ? "PSTN/ISDN" : "Other"), addr_type);
2591 addr_len = tvb_strsize(tvb, offset);
2592 if (addr_len > length) {
2593 proto_tree_add_text(addr_tree, tvb, offset, length,
2594 "Address: (runs past end of option)");
2597 proto_tree_add_text(addr_tree, tvb, offset, addr_len,
2599 tvb_format_text(tvb, offset, addr_len - 1));
2606 dissect_bacp_favored_peer_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2607 int offset, guint length, packet_info *pinfo _U_,
2611 proto_tree *field_tree;
2613 tf = proto_tree_add_text(tree, tvb, offset, length, "%s", optp->name);
2614 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
2616 proto_tree_add_text(field_tree, tvb, offset + 2, 4,
2617 "Magic number: 0x%08x", tvb_get_ntohl(tvb, offset + 2));
2621 dissect_bap_link_type_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2622 int offset, guint length, packet_info *pinfo _U_,
2626 proto_tree *field_tree;
2629 tf = proto_tree_add_text(tree, tvb, offset, length, "%s", optp->name);
2630 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
2632 proto_tree_add_text(field_tree, tvb, offset + 2, 2,
2633 "Link Speed: %u kbps", tvb_get_ntohs(tvb, offset + 2));
2634 link_type = tvb_get_guint8(tvb, offset + 4);
2635 proto_tree_add_text(field_tree, tvb, offset + 4, 1,
2636 "Link Type: %s (%u)", val_to_str(link_type, bap_link_type_vals,
2637 "Unknown"), link_type);
2641 dissect_bap_phone_delta_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2642 int offset, guint length, packet_info *pinfo _U_,
2646 proto_tree *field_tree;
2648 proto_tree *suboption_tree;
2652 tf = proto_tree_add_text(tree, tvb, offset, length, "%s", optp->name);
2653 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
2658 while (length > 0) {
2659 subopt_type = tvb_get_guint8(tvb, offset);
2660 subopt_len = tvb_get_guint8(tvb, offset + 1);
2661 ti = proto_tree_add_text(field_tree, tvb, offset, subopt_len,
2662 "Sub-Option (%u byte%s)",
2663 subopt_len, plurality(subopt_len, "", "s"));
2664 suboption_tree = proto_item_add_subtree(ti, ett_bap_phone_delta_subopt);
2666 proto_tree_add_text(suboption_tree, tvb, offset, 1,
2667 "Sub-Option Type: %s (%u)",
2668 val_to_str(subopt_type, bap_phone_delta_subopt_vals, "Unknown"),
2671 if (subopt_len < 2) {
2672 proto_tree_add_text(suboption_tree, tvb, offset + 1, 1,
2673 "Sub-Option Length: %u (invalid, must be >= 2)", subopt_len);
2676 if (subopt_len > length) {
2677 proto_tree_add_text(suboption_tree, tvb, offset + 1, 1,
2678 "Sub-Option Length: %u (invalid, must be <= length remaining in option %u)", subopt_len, length);
2682 proto_tree_add_text(suboption_tree, tvb, offset + 1, 1,
2683 "Sub-Option Length: %u", subopt_len);
2685 switch (subopt_type) {
2686 case BAP_PHONE_DELTA_SUBOPT_UNIQ_DIGIT:
2687 if (subopt_len == 3) {
2688 proto_tree_add_text(suboption_tree, tvb, offset + 2, 1, "Unique Digit: %u",
2689 tvb_get_guint8(tvb, offset + 2));
2691 proto_tree_add_text(suboption_tree, tvb, offset + 1, 1,
2692 "Invalid suboption length: %u (must be == 3)",
2696 case BAP_PHONE_DELTA_SUBOPT_SUBSC_NUM:
2697 if (subopt_len > 2) {
2698 proto_tree_add_text(suboption_tree, tvb, offset + 2, subopt_len - 2,
2699 "Subscriber Number: %s",
2700 tvb_format_text(tvb, offset + 2, subopt_len - 2));
2702 proto_tree_add_text(suboption_tree, tvb, offset + 1, 1,
2703 "Invalid suboption length: %u (must be > 2)",
2707 case BAP_PHONE_DELTA_SUBOPT_PHONENUM_SUBADDR:
2708 if (subopt_len > 2) {
2709 proto_tree_add_text(suboption_tree, tvb, offset + 2, subopt_len - 2,
2710 "Phone Number Sub Address: %s",
2711 tvb_format_text(tvb, offset + 2, subopt_len - 2));
2713 proto_tree_add_text(suboption_tree, tvb, offset + 1, 1,
2714 "Invalid suboption length: %u (must be > 2)",
2719 if (subopt_len > 2) {
2720 proto_tree_add_text(suboption_tree, tvb, offset + 2, subopt_len - 2,
2723 proto_tree_add_text(suboption_tree, tvb, offset + 1, 1,
2724 "Invalid suboption length: %u (must be > 2)",
2729 offset += subopt_len;
2730 length -= subopt_len;
2735 dissect_bap_reason_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2736 int offset, guint length, packet_info *pinfo _U_,
2740 proto_tree_add_text(tree, tvb, offset, length, "%s: %s",
2742 tvb_format_text(tvb, offset + 2, length - 2));
2747 dissect_bap_link_disc_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2748 int offset, guint length, packet_info *pinfo _U_,
2751 proto_tree_add_text(tree, tvb, offset, length, "%s: 0x%04x",
2752 optp->name, tvb_get_ntohs(tvb, offset + 2));
2756 dissect_bap_call_status_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2757 int offset, guint length, packet_info *pinfo _U_,
2761 proto_tree *field_tree;
2762 guint8 status, action;
2764 tf = proto_tree_add_text(tree, tvb, offset, length, "%s", optp->name);
2765 field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
2767 status = tvb_get_guint8(tvb, offset + 2);
2768 proto_tree_add_text(field_tree, tvb, offset + 2, 1,
2769 "Status: %s (0x%02x)",
2770 val_to_str(status, q931_cause_code_vals, "Unknown"), status);
2772 action = tvb_get_guint8(tvb, offset + 3);
2773 proto_tree_add_text(field_tree, tvb, offset + 3, 1,
2774 "Action: %s (0x%02x)",
2775 val_to_str(action, bap_call_status_opt_action_vals, "Unknown"), action);
2778 static void dissect_vsncp_pdnid_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2779 int offset, guint length, packet_info *pinfo _U_,
2785 PDNID = tvb_get_guint8(tvb, offset + 2);
2786 tf = proto_tree_add_text(tree, tvb, offset, length, "%s: 0x%02x",
2791 static void dissect_vsncp_attachtype_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2792 int offset, guint length, packet_info *pinfo _U_,
2795 static const value_string attach_vals[] =
2797 {1, "Initial Attach" },
2798 {3, "Handover Attach"},
2803 attach = tvb_get_guint8(tvb, offset + 2);
2807 proto_tree_add_text(tree, tvb, offset, length, "%s: %s (0x%02x)",
2808 optp->name, val_to_str(attach , attach_vals, "Unknown"), attach);
2814 static void dissect_vsncp_pdntype_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2815 int offset, guint length, packet_info *pinfo _U_,
2818 static const value_string pdntype_vals[] =
2827 pdntype = tvb_get_guint8(tvb, offset + 2);
2831 proto_tree_add_text(tree, tvb, offset, length, "%s: %s (0x%02x)",
2832 optp->name, val_to_str(pdntype, pdntype_vals, "Unknown"), pdntype);
2837 static void dissect_vsncp_errorcode_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2838 int offset, guint length, packet_info *pinfo _U_,
2841 static const value_string errorcode_vals[] =
2843 {0, "General Eror" },
2844 {1, "Unauthorized APN" },
2845 {2, "PDN Limit Exceeded" },
2846 {3, "NO PG-W Available" },
2847 {4, "P-GW Unreachable" },
2848 {5, "P-GW Reject" },
2849 {6, "Insufficient Parameters" },
2850 {7, "Resource Unavailable" },
2851 {8, "Admin Prohibited" },
2852 {9, "PDN-ID Already in Use" },
2853 {10, "Subscription Limitation" },
2854 {11, "PDN connection already exists for APN"},
2859 pdntype = tvb_get_guint8(tvb, offset + 2);
2863 proto_tree_add_text(tree, tvb, offset, length, "%s: %s (0x%02x)",
2864 optp->name, val_to_str(pdntype, errorcode_vals, "Unknown"), pdntype);
2869 static void dissect_vsncp_pdnaddress_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2870 int offset, guint length, packet_info *pinfo _U_,
2875 static const value_string pdntype_vals[] =
2877 {0, "Initial Request by UE" },
2878 {1, "IPv4 Address" },
2879 {2, "IPv6 Address" },
2880 {3, "IPv6/IPv4 Address" },
2884 proto_tree *field_tree;
2886 tf = proto_tree_add_text(tree, tvb, offset, length,
2887 "%s: (%d byte%s)", optp->name, length, plurality(length, "", "s"));
2889 field_tree = proto_item_add_subtree(tf, ett_lcp_options);
2892 pdnaddtype = tvb_get_guint8(tvb, offset + 2);
2894 proto_tree_add_text(field_tree, tvb, offset+2, 1, "PDN Type (%s): 0x%02x",
2895 val_to_str(pdnaddtype, pdntype_vals, "Unknown"), pdnaddtype);
2901 proto_tree_add_text(field_tree, tvb, offset+3, length-3, "%s: %s",
2902 val_to_str(pdnaddtype, pdntype_vals, "Unknown"),
2903 ip_to_str(tvb_get_ptr(tvb, offset + 3, 4)));
2908 struct e_in6_addr *ad = ep_alloc0(sizeof (struct e_in6_addr));
2909 tvb_memcpy(tvb, &ad->bytes[8], offset+3, 8);
2911 proto_tree_add_text(field_tree, tvb, offset+3, length-3, "%s: %s",
2912 val_to_str(pdnaddtype, pdntype_vals, "Unknown"), ip6_to_str(ad));
2917 struct e_in6_addr *ad = ep_alloc0(sizeof (struct e_in6_addr));
2918 tvb_memcpy(tvb, &ad->bytes[8], offset+3, 8);
2920 proto_tree_add_text(field_tree, tvb, offset+3, length-3, "%s: %s",
2921 val_to_str(pdnaddtype, pdntype_vals, "Unknown"), ip6_to_str(ad));
2923 proto_tree_add_text(field_tree, tvb, offset+11, length-11, "%s: %s",
2924 val_to_str(pdnaddtype, pdntype_vals, "Unknown"),
2925 ip_to_str(tvb_get_ptr(tvb, offset + 11, 4)));
2935 static void dissect_vsncp_ipv4adress_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2936 int offset, guint length, packet_info *pinfo _U_,
2939 proto_tree_add_text(tree, tvb, offset, length, "%s: %s", optp->name,
2940 ip_to_str(tvb_get_ptr(tvb, offset + 2, 4)));
2944 static void dissect_vsncp_apname_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2945 int offset, guint length, packet_info *pinfo _U_,
2949 proto_tree *field_tree;
2951 tf = proto_tree_add_text(tree, tvb, offset, length,
2952 "%s: (%d byte%s)", optp->name, length, plurality(length, "", "s"));
2954 field_tree = proto_item_add_subtree(tf, ett_lcp_options);
2965 lengthofapn = tvb_get_guint8(tvb, off);
2967 proto_tree_add_text(field_tree, tvb, off, lengthofapn,
2968 "Label%d (%d byte%s): %s", j, lengthofapn, plurality(lengthofapn, "", "s"),
2969 tvb_format_text(tvb, off, lengthofapn));
2970 off = off+lengthofapn;
2971 i = i+lengthofapn+1;
2977 static void dissect_vsncp_addressalloc_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
2978 int offset, guint length, packet_info *pinfo _U_,
2981 static const value_string alloc_vals[] =
2983 {0, "Null Value (Attach or Handover)" },
2984 {18, "New PDN type due to network preference" },
2990 alloc = tvb_get_guint8(tvb, offset + 2);
2994 proto_tree_add_text(tree, tvb, offset, length, "%s: %s (0x%02x)",
2995 optp->name, val_to_str(alloc, alloc_vals, "Unknown"), alloc);
3000 static void dissect_vsncp_pco_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
3001 int offset, guint length, packet_info *pinfo _U_,
3004 static const value_string pco_vals[] =
3006 {0x8021, "IPCP (DNS Address Request)" },
3007 {0x0001, "P-CSCF Address Request (IPv6)" },
3008 {0x0003, "DNS Server Address (IPv6)" },
3009 {0x000A, "IP address allocation via NAS signalling" },
3018 proto_tree *field_tree;
3020 tf = proto_tree_add_text(tree, tvb, offset, length,
3021 "%s: (%d byte%s)", optp->name, length, plurality(length, "", "s"));
3023 field_tree = proto_item_add_subtree(tf, ett_lcp_options);
3027 pcotype = tvb_get_ntohs(tvb, off);
3028 len = tvb_get_guint8(tvb, (off+2));
3029 proto_tree_add_text(field_tree, tvb, off,2, "Protocol: %s (0x%02x)",
3030 val_to_str(pcotype, pco_vals, "Unknown"), pcotype);
3031 proto_tree_add_text(field_tree, tvb, off+2,1, "Length:(0x%02x)", len);
3033 proto_tree_add_text(field_tree, tvb, off+3,len, "Data (%d byte%s)", len, plurality(len, "", "s"));
3041 dissect_cp( tvbuff_t *tvb, int proto_id, int proto_subtree_index,
3042 const value_string *proto_vals, int options_subtree_index,
3043 const ip_tcp_opt *opts, int nopts, packet_info *pinfo,
3047 proto_tree *fh_tree = NULL;
3049 proto_tree *field_tree;
3056 code = tvb_get_guint8(tvb, 0);
3057 id = tvb_get_guint8(tvb, 1);
3058 length = tvb_get_ntohs(tvb, 2);
3060 if(check_col(pinfo->cinfo, COL_PROTOCOL))
3061 col_set_str(pinfo->cinfo, COL_PROTOCOL,
3062 proto_get_protocol_short_name(find_protocol_by_id(proto_id)));
3064 if(check_col(pinfo->cinfo, COL_INFO))
3065 col_add_str(pinfo->cinfo, COL_INFO,
3066 val_to_str(code, proto_vals, "Unknown"));
3069 ti = proto_tree_add_item(tree, proto_id, tvb, 0, length, FALSE);
3070 fh_tree = proto_item_add_subtree(ti, proto_subtree_index);
3071 proto_tree_add_text(fh_tree, tvb, 0, 1, "Code: %s (0x%02x)",
3072 val_to_str(code, proto_vals, "Unknown"), code);
3073 proto_tree_add_text(fh_tree, tvb, 1, 1, "Identifier: 0x%02x",
3075 proto_tree_add_text(fh_tree, tvb, 2, 2, "Length: %u",
3088 tf = proto_tree_add_text(fh_tree, tvb, offset, length,
3089 "Options: (%d byte%s)", length, plurality(length, "", "s"));
3090 field_tree = proto_item_add_subtree(tf, options_subtree_index);
3091 dissect_ip_tcp_options(tvb, offset, length, opts, nopts, -1,
3092 pinfo, field_tree, NULL);
3101 proto_tree_add_text(fh_tree, tvb, offset, 4, "Magic number: 0x%08x",
3102 tvb_get_ntohl(tvb, offset));
3106 proto_tree_add_text(fh_tree, tvb, offset, length, "Message (%d byte%s)",
3107 length, plurality(length, "", "s"));
3113 proto_tree_add_text(fh_tree, tvb, offset, 4, "Magic number: 0x%08x",
3114 tvb_get_ntohl(tvb, offset));
3118 proto_tree_add_text(fh_tree, tvb, offset, length, "Message: %s",
3119 tvb_format_text(tvb, offset, length));
3125 proto_tree_add_text(fh_tree, tvb, offset, 4, "Magic number: 0x%08x",
3126 tvb_get_ntohl(tvb, offset));
3129 proto_tree_add_text(fh_tree, tvb, offset, 4, "Seconds remaining: %u",
3130 tvb_get_ntohl(tvb, offset));
3134 proto_tree_add_text(fh_tree, tvb, offset, length, "Message (%d byte%s)",
3135 length, plurality(length, "", "s"));
3141 gboolean save_in_error_pkt;
3144 protocol = tvb_get_ntohs(tvb, offset);
3145 proto_tree_add_text(fh_tree, tvb, offset, 2,
3146 "Rejected protocol: %s (0x%04x)",
3147 val_to_str(protocol, ppp_vals, "Unknown"),
3152 proto_tree_add_text(fh_tree, tvb, offset, length,
3153 "Rejected packet (%d byte%s)",
3154 length, plurality(length, "", "s"));
3156 /* Save the current value of the "we're inside an error packet"
3157 flag, and set that flag; subdissectors may treat packets
3158 that are the payload of error packets differently from
3160 save_in_error_pkt = pinfo->in_error_pkt;
3161 pinfo->in_error_pkt = TRUE;
3163 /* Decode the rejected packet. */
3164 next_tvb = tvb_new_subset(tvb, offset, length, length);
3165 if (!dissector_try_port(ppp_subdissector_table, protocol,
3166 next_tvb, pinfo, fh_tree)) {
3167 call_dissector(data_handle, next_tvb, pinfo, fh_tree);
3170 /* Restore the "we're inside an error packet" flag. */
3171 pinfo->in_error_pkt = save_in_error_pkt;
3177 /* decode the rejected LCP packet here. */
3179 proto_tree_add_text(fh_tree, tvb, offset, length, "Rejected packet (%d byte%s)",
3180 length, plurality(length, "", "s"));
3186 proto_tree_add_text(fh_tree, tvb, offset, length, "Data (%d byte%s)",
3187 length, plurality(length, "", "s"));
3192 proto_tree_add_text(fh_tree, tvb, offset, length, "Stuff (%d byte%s)",
3193 length, plurality(length, "", "s"));
3198 /* Protocol field compression */
3199 #define PFC_BIT 0x01
3202 dissect_ppp_common( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
3203 proto_tree *fh_tree, proto_item *ti, int proto_offset )
3209 /* Make direction information filterable */
3211 (pinfo->p2p_dir == P2P_DIR_RECV ||
3212 pinfo->p2p_dir == P2P_DIR_SENT)) {
3213 proto_item *direction_ti = proto_tree_add_uint(tree, hf_ppp_direction,
3214 tvb, 0, 0, pinfo->p2p_dir);
3215 PROTO_ITEM_SET_GENERATED(direction_ti);
3218 ppp_prot = tvb_get_guint8(tvb, 0);
3219 if (ppp_prot & PFC_BIT) {
3220 /* Compressed protocol field - just the byte we fetched. */
3223 /* Uncompressed protocol field - fetch all of it. */
3224 ppp_prot = tvb_get_ntohs(tvb, 0);
3228 /* If "ti" is not null, it refers to the top-level "proto_ppp" item
3229 for PPP, and proto_offset is the length of any stuff in the header
3230 preceding the protocol type, e.g. an HDLC header; add the length
3231 of the protocol type field to it, and set the length of that item
3234 proto_item_set_len(ti, proto_offset + proto_len);
3237 proto_tree_add_uint(fh_tree, hf_ppp_protocol, tvb, 0, proto_len, ppp_prot);
3239 next_tvb = tvb_new_subset_remaining(tvb, proto_len);
3241 /* do lookup with the subdissector table */
3242 if (!dissector_try_port(ppp_subdissector_table, ppp_prot, next_tvb, pinfo, tree)) {
3243 if (check_col(pinfo->cinfo, COL_PROTOCOL))
3244 col_add_fstr(pinfo->cinfo, COL_PROTOCOL, "0x%04x", ppp_prot);
3245 if (check_col(pinfo->cinfo, COL_INFO))
3246 col_add_fstr(pinfo->cinfo, COL_INFO, "PPP %s (0x%04x)",
3247 val_to_str(ppp_prot, ppp_vals, "Unknown"), ppp_prot);
3248 call_dissector(data_handle,next_tvb, pinfo, tree);
3253 dissect_lcp_options(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
3255 dissect_ip_tcp_options(tvb, 0, tvb_reported_length(tvb), lcp_opts, N_LCP_OPTS,
3256 -1, pinfo, tree, NULL);
3260 * RFC's 1661, 2153 and 1570.
3263 dissect_lcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
3265 dissect_cp(tvb, proto_lcp, ett_lcp, lcp_vals, ett_lcp_options,
3266 lcp_opts, N_LCP_OPTS, pinfo, tree);
3270 dissect_vsncp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
3273 proto_tree *fh_tree = NULL;
3275 proto_tree *field_tree;
3282 static const value_string OUI_vals[] =
3284 {0xcf0002, "3GPP2 Unique Organization Number" },
3288 code = tvb_get_guint8(tvb, 0);
3289 id = tvb_get_guint8(tvb, 1);
3290 length = tvb_get_ntohs(tvb, 2);
3291 OUI = tvb_get_ntoh24(tvb, 4);
3293 col_set_str(pinfo->cinfo, COL_PROTOCOL, "VSNCP");
3294 col_add_str(pinfo->cinfo, COL_INFO, val_to_str(code, cp_vals, "Unknown"));
3298 ti = proto_tree_add_item(tree, proto_vsncp, tvb, 0, length, FALSE);
3299 fh_tree = proto_item_add_subtree(ti, ett_vsncp);
3300 proto_tree_add_text(fh_tree, tvb, 0, 1, "Code: %s (0x%02x)", val_to_str(code, cp_vals, "Unknown"), code);
3301 proto_tree_add_text(fh_tree, tvb, 1, 1, "Identifier: 0x%02x", id);
3302 proto_tree_add_text(fh_tree, tvb, 2, 2, "Length: %u", length);
3303 proto_tree_add_text(fh_tree, tvb, 4, 3, "OUI: %s (0x%02x)", val_to_str(OUI, OUI_vals, "Unknown"), OUI);
3320 tf = proto_tree_add_text(fh_tree, tvb, offset, length,
3321 "Options: (%d byte%s)", length, plurality(length, "", "s"));
3322 field_tree = proto_item_add_subtree(tf, ett_vsncp_options);
3323 dissect_ip_tcp_options(tvb, offset, length, vsncp_opts, N_VSNCP_OPTS, -1,
3324 pinfo, field_tree, NULL);
3332 dissect_vsnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
3335 proto_item *vsnp_item = NULL;
3336 proto_tree *vsnp_tree = NULL;
3339 /* To pass it on to IP */
3342 col_set_str(pinfo->cinfo, COL_PROTOCOL, "VSNP");
3344 PDNID = tvb_get_guint8(tvb, 0); /* Get the PDNID byte */
3347 if (tree) /* we are being asked for details */
3349 vsnp_item = proto_tree_add_item(tree, proto_vsnp, tvb, 0, -1, FALSE);
3350 vsnp_tree = proto_item_add_subtree(vsnp_item, ett_vsnp);
3351 proto_tree_add_text(vsnp_tree, tvb, offset, 1, "PDN ID: 0x%02x", PDNID);
3353 next_tvb = tvb_new_subset(tvb, 1, -1, -1);
3355 /* do lookup with the subdissector table */
3356 if (!dissector_try_port(ppp_subdissector_table, PPP_IP, next_tvb, pinfo, tree))
3358 col_add_fstr(pinfo->cinfo, COL_PROTOCOL, "0x%04x", PPP_IP);
3360 col_add_fstr(pinfo->cinfo, COL_INFO, "PPP %s (0x%04x)",
3361 val_to_str(PPP_IP, ppp_vals, "Unknown"), PPP_IP);
3362 call_dissector(data_handle, next_tvb, pinfo, tree);
3370 dissect_ipcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
3372 dissect_cp(tvb, proto_ipcp, ett_ipcp, cp_vals, ett_ipcp_options,
3373 ipcp_opts, N_IPCP_OPTS, pinfo, tree);
3379 #define BCP_FCS_PRESENT 0x80
3380 #define BCP_ZEROPAD 0x20
3381 #define BCP_IS_BCONTROL 0x10
3382 #define BCP_PADS_MASK 0x0f
3384 #define BCP_MACT_ETHERNET 1
3385 #define BCP_MACT_802_4 2
3386 #define BCP_MACT_802_5_NONCANON 3
3387 #define BCP_MACT_FDDI_NONCANON 4
3388 #define BCP_MACT_802_5_CANON 11
3389 #define BCP_MACT_FDDI_CANON 12
3391 static const value_string bcp_mac_type_vals[] = {
3392 { BCP_MACT_ETHERNET, "IEEE 802.3/Ethernet" },
3393 { BCP_MACT_802_4, "IEEE 802.4" },
3394 { BCP_MACT_802_5_NONCANON, "IEEE 802.5, non-canonical addresses" },
3395 { BCP_MACT_FDDI_NONCANON, "FDDI, non-canonical addresses" },
3396 { BCP_MACT_802_5_CANON, "IEEE 802.5, canonical addresses" },
3397 { BCP_MACT_FDDI_CANON, "FDDI, canonical addresses" },
3402 dissect_bcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
3404 proto_item *ti = NULL, *flags_item;
3405 proto_tree *bcp_tree = NULL, *flags_tree;
3409 gint captured_length, reported_length, pad_length;
3412 col_set_str(pinfo->cinfo, COL_PROTOCOL, "PPP BCP");
3414 col_clear(pinfo->cinfo, COL_INFO);
3417 ti = proto_tree_add_item(tree, proto_bcp, tvb, 0, -1, FALSE);
3418 bcp_tree = proto_item_add_subtree(ti, ett_bcp);
3421 flags = tvb_get_guint8(tvb, offset);
3422 if (flags & BCP_IS_BCONTROL) {
3423 col_set_str(pinfo->cinfo, COL_INFO, "Bridge control");
3426 flags_item = proto_tree_add_uint(bcp_tree, hf_bcp_flags, tvb, offset, 1, flags);
3427 flags_tree = proto_item_add_subtree(flags_item, ett_bcp_flags);
3428 proto_tree_add_boolean(flags_tree, hf_bcp_fcs_present, tvb, offset, 1, flags);
3429 proto_tree_add_boolean(flags_tree, hf_bcp_zeropad, tvb, offset, 1, flags);
3430 proto_tree_add_boolean(flags_tree, hf_bcp_bcontrol, tvb, offset, 1, flags);
3431 proto_tree_add_uint(flags_tree, hf_bcp_pads, tvb, offset, 1, flags);
3435 mac_type = tvb_get_guint8(tvb, offset);
3436 if (!(flags & BCP_IS_BCONTROL)) {
3437 if (check_col(pinfo->cinfo, COL_INFO))
3438 col_add_str(pinfo->cinfo, COL_INFO,
3439 val_to_str(mac_type, bcp_mac_type_vals,
3440 "Unknown MAC type %u"));
3443 proto_tree_add_uint(bcp_tree, hf_bcp_mac_type, tvb, offset, 1, mac_type);
3448 case BCP_MACT_802_4:
3449 case BCP_MACT_802_5_NONCANON:
3450 case BCP_MACT_FDDI_NONCANON:
3451 case BCP_MACT_802_5_CANON:
3452 case BCP_MACT_FDDI_CANON:
3454 proto_tree_add_text(bcp_tree, tvb, offset, 1, "Pad");
3459 if (!(flags & BCP_IS_BCONTROL)) {
3460 captured_length = tvb_length_remaining(tvb, offset);
3461 reported_length = tvb_reported_length_remaining(tvb, offset);
3462 pad_length = flags & BCP_PADS_MASK;
3463 if (reported_length >= pad_length) {
3464 reported_length -= pad_length;
3465 if (captured_length > reported_length)
3466 captured_length = reported_length;
3467 next_tvb = tvb_new_subset(tvb, offset, captured_length, reported_length);
3470 case BCP_MACT_ETHERNET:
3471 if (flags & BCP_FCS_PRESENT)
3472 call_dissector(eth_withfcs_handle, next_tvb, pinfo, tree);
3474 call_dissector(eth_withoutfcs_handle, next_tvb, pinfo, tree);
3477 case BCP_MACT_802_4:
3478 case BCP_MACT_802_5_NONCANON:
3479 case BCP_MACT_FDDI_NONCANON:
3480 case BCP_MACT_802_5_CANON:
3481 case BCP_MACT_FDDI_CANON:
3485 call_dissector(data_handle, next_tvb, pinfo, tree);
3496 dissect_osicp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
3498 dissect_cp(tvb, proto_osicp, ett_osicp, cp_vals, ett_osicp_options,
3499 osicp_opts, N_OSICP_OPTS, pinfo, tree);
3506 dissect_ccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
3508 dissect_cp(tvb, proto_ccp, ett_ccp, ccp_vals, ett_ccp_options,
3509 ccp_opts, N_CCP_OPTS, pinfo, tree);
3513 * Callback Control Protocol - see
3515 * http://www.linet.gr.jp/~manabe/PPxP/doc/Standards/draft-gidwani-ppp-callback-cp-00.txt
3518 dissect_cbcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
3520 dissect_cp(tvb, proto_cbcp, ett_cbcp, cbcp_vals, ett_cbcp_options,
3521 cbcp_opts, N_CBCP_OPTS, pinfo, tree);
3525 * RFC 2125 (BACP and BAP).
3528 dissect_bacp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
3530 dissect_cp(tvb, proto_bacp, ett_bacp, cp_vals, ett_bacp_options,
3531 bacp_opts, N_BACP_OPTS, pinfo, tree);
3535 dissect_bap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
3538 proto_tree *fh_tree = NULL;
3540 proto_tree *field_tree;
3547 type = tvb_get_guint8(tvb, 0);
3548 id = tvb_get_guint8(tvb, 1);
3549 length = tvb_get_ntohs(tvb, 2);
3551 col_set_str(pinfo->cinfo, COL_PROTOCOL, "PPP BAP");
3553 if(check_col(pinfo->cinfo, COL_INFO))
3554 col_add_str(pinfo->cinfo, COL_INFO,
3555 val_to_str(type, bap_vals, "Unknown"));
3558 ti = proto_tree_add_item(tree, proto_bap, tvb, 0, length, FALSE);
3559 fh_tree = proto_item_add_subtree(ti, ett_bap_options);
3560 proto_tree_add_text(fh_tree, tvb, 0, 1, "Type: %s (0x%02x)",
3561 val_to_str(type, bap_vals, "Unknown"), type);
3562 proto_tree_add_text(fh_tree, tvb, 1, 1, "Identifier: 0x%02x",
3564 proto_tree_add_text(fh_tree, tvb, 2, 2, "Length: %u",
3570 if (type == BAP_CRES || type == BAP_CBRES ||
3571 type == BAP_LDQRES || type == BAP_CSRES) {
3572 resp_code = tvb_get_guint8(tvb, offset);
3573 proto_tree_add_text(fh_tree, tvb, offset, 1, "Response Code: %s (0x%02x)",
3574 val_to_str(resp_code, bap_resp_code_vals, "Unknown"), resp_code);
3581 tf = proto_tree_add_text(fh_tree, tvb, offset, length,
3582 "Data (%d byte%s)", length, plurality(length, "", "s"));
3583 field_tree = proto_item_add_subtree(tf, ett_bap_options);
3584 dissect_ip_tcp_options(tvb, offset, length, bap_opts, N_BAP_OPTS, -1,
3585 pinfo, field_tree, NULL);
3591 dissect_comp_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
3594 proto_tree *comp_data_tree;
3596 col_set_str(pinfo->cinfo, COL_PROTOCOL, "PPP Comp");
3598 col_set_str(pinfo->cinfo, COL_INFO, "Compressed data");
3601 ti = proto_tree_add_item(tree, proto_comp_data, tvb, 0, -1, FALSE);
3602 comp_data_tree = proto_item_add_subtree(ti, ett_comp_data);
3607 * RFC 3153 (both PPPMuxCP and PPPMux).
3610 dissect_pppmuxcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
3612 dissect_cp(tvb,proto_pppmuxcp,ett_pppmuxcp,pppmuxcp_vals,
3613 ett_pppmuxcp_options,pppmuxcp_opts,N_PPPMUXCP_OPTS,pinfo,tree);
3616 #define PPPMUX_FLAGS_MASK 0xc0
3617 #define PPPMUX_PFF_BIT_SET 0x80
3618 #define PPPMUX_LXT_BIT_SET 0x40
3621 dissect_pppmux(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
3623 proto_tree *mux_tree, *hdr_tree, *sub_tree, *flag_tree;
3624 proto_tree *info_tree;
3625 proto_item *ti = NULL,*sub_ti = NULL;
3630 int offset = 0, length_remaining;
3631 int length_field = 0, pid_field = 0,hdr_length = 0;
3633 col_set_str(pinfo->cinfo,COL_PROTOCOL, "PPP PPPMux");
3635 col_set_str(pinfo->cinfo, COL_INFO, "PPP Multiplexing");
3637 length_remaining = tvb_reported_length(tvb);
3640 ti = proto_tree_add_item(tree, proto_pppmux, tvb, 0, -1, FALSE);
3641 mux_tree = proto_item_add_subtree(ti,ett_pppmux);
3643 while (length_remaining > 0) {
3645 flags = tvb_get_guint8(tvb,offset) & PPPMUX_FLAGS_MASK;
3647 if (flags & PPPMUX_LXT_BIT_SET ) {
3648 length = tvb_get_ntohs(tvb,offset) & 0x3fff;
3651 length = tvb_get_guint8(tvb,offset) & 0x3f;
3655 if (flags & PPPMUX_PFF_BIT_SET) {
3656 byte = tvb_get_guint8(tvb,offset + length_field);
3657 if (byte & PFC_BIT) { /* Compressed PID field*/
3660 } else { /*PID field is 2 bytes*/
3661 pid = tvb_get_ntohs(tvb,offset + length_field);
3665 pid_field = 0; /*PID field is 0 bytes*/
3666 if (!pid){ /*No Last PID, hence use the default */
3667 if (pppmux_def_prot_id)
3668 pid = pppmux_def_prot_id;
3672 hdr_length = length_field + pid_field;
3674 ti = proto_tree_add_text(mux_tree, tvb, offset, length + length_field,
3675 "PPPMux Sub-frame");
3676 sub_tree = proto_item_add_subtree(ti,ett_pppmux_subframe);
3677 sub_ti = proto_tree_add_text(sub_tree, tvb, offset,
3678 hdr_length,"Header field");
3680 hdr_tree = proto_item_add_subtree(sub_ti,ett_pppmux_subframe_hdr);
3681 ti = proto_tree_add_text(hdr_tree, tvb, offset, length_field, "PFF/LXT: 0x%02X",
3684 flag_tree = proto_item_add_subtree(ti,ett_pppmux_subframe_flags);
3685 proto_tree_add_text(flag_tree,tvb,offset,length_field,"%s",
3686 decode_boolean_bitfield(flags,0x80,8,"PID Present","PID not present"));
3687 proto_tree_add_text(flag_tree,tvb,offset,length_field,"%s",
3688 decode_boolean_bitfield(flags,0x40,8,"2 bytes length field ","1 byte length field"));
3690 ti = proto_tree_add_text(hdr_tree,tvb,offset,length_field,"Sub-frame Length = %u",length);
3692 ti = proto_tree_add_uint(hdr_tree,hf_pppmux_protocol,tvb,offset + length_field,pid_field, pid);
3694 /* if protocol is not present in the sub-frame */
3695 if (!(flags & PPPMUX_PFF_BIT_SET))
3696 /* mark this item as generated */
3697 PROTO_ITEM_SET_GENERATED(ti);
3699 offset += hdr_length;
3700 length_remaining -= hdr_length;
3701 length -= pid_field;
3703 tvb_ensure_bytes_exist (tvb,offset,length);
3704 sub_ti = proto_tree_add_text(sub_tree,tvb,offset,length,"Information Field");
3705 info_tree = proto_item_add_subtree(sub_ti,ett_pppmux_subframe_info);
3707 next_tvb = tvb_new_subset(tvb,offset,length,length);
3709 if (!dissector_try_port(ppp_subdissector_table, pid, next_tvb, pinfo, info_tree)) {
3710 call_dissector(data_handle, next_tvb, pinfo, info_tree);
3713 length_remaining -= length;
3714 } /* While length_remaining */
3720 * RFC 2508 Internet Protocol Header Compression
3723 #define IPHC_CRTP_FH_FLAG_MASK 0xc0
3724 #define IPHC_CRTP_FH_FLAG_POS 6
3725 #define IPHC_CRTP_FH_CID8 1
3726 #define IPHC_CRTP_FH_CID16 3
3728 #define IPHC_CRTP_CS_CID8 1
3729 #define IPHC_CRTP_CS_CID16 2
3731 static const value_string iphc_crtp_fh_flags[] = {
3732 {IPHC_CRTP_FH_CID8, "8-bit Context Id" },
3733 {IPHC_CRTP_FH_CID16, "16-bit Context Id" },
3737 static const value_string iphc_crtp_cs_flags[] = {
3738 {IPHC_CRTP_CS_CID8, "8-bit Context Id" },
3739 {IPHC_CRTP_CS_CID16, "16-bit Context Id" },
3744 * 0x61 Packets: Full IP/UDP Header
3748 dissect_iphc_crtp_fh(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
3750 proto_tree *fh_tree, *info_tree;
3751 proto_item *ti = NULL;
3753 guint ip_hdr_len, flags;
3762 guint8 next_protocol;
3766 length = tvb_reported_length(tvb);
3768 col_set_str(pinfo->cinfo,COL_PROTOCOL, "CRTP");
3770 col_set_str(pinfo->cinfo, COL_INFO, "Full Header");
3772 /* only dissect IPv4 and UDP */
3773 ip_version = tvb_get_guint8(tvb, 0) >> 4;
3774 next_protocol = tvb_get_guint8(tvb, 9);
3778 ti = proto_tree_add_protocol_format(tree, proto_iphc_crtp, tvb, 0, -1,
3779 "%s", val_to_str(PPP_RTP_FH, ppp_vals, "Unknown"));
3780 fh_tree = proto_item_add_subtree(ti, ett_iphc_crtp);
3782 flags = (tvb_get_guint8(tvb, 2) & IPHC_CRTP_FH_FLAG_MASK) >> IPHC_CRTP_FH_FLAG_POS;
3785 ti = proto_tree_add_item(fh_tree, hf_iphc_crtp_fh_flags, tvb, 2, 1, FALSE);
3787 /* generation field */
3788 ti = proto_tree_add_item(fh_tree, hf_iphc_crtp_gen, tvb, 2, 1, FALSE);
3790 /* calculate length of IP header, assume IPv4 */
3791 ip_hdr_len = (tvb_get_guint8(tvb, 0) & 0x0f) * 4;
3793 /* calculate total hdr length, assume UDP */
3794 hdr_len = ip_hdr_len + 8;
3796 if (ip_version != 4) {
3797 proto_tree_add_text(fh_tree, tvb, 3, -1,
3798 "IP version is %u: the only supported version is 4",
3803 if (next_protocol != IP_PROTO_UDP) {
3804 proto_tree_add_text(fh_tree, tvb, 3, -1,
3805 "Next protocol is %s (%u): the only supported protocol is UDP",
3806 ipprotostr(next_protocol), next_protocol);
3810 /* context id and sequence fields */
3813 case IPHC_CRTP_FH_CID8:
3815 offset_seq = ip_hdr_len + 5;
3816 ti = proto_tree_add_item(fh_tree, hf_iphc_crtp_cid8, tvb, offset_cid, 1, FALSE);
3817 ti = proto_tree_add_item(fh_tree, hf_iphc_crtp_seq, tvb, offset_seq, 1, FALSE);
3820 case IPHC_CRTP_FH_CID16:
3822 offset_cid = ip_hdr_len + 4;
3823 ti = proto_tree_add_item(fh_tree, hf_iphc_crtp_seq, tvb, offset_seq, 1, FALSE);
3824 ti = proto_tree_add_item(fh_tree, hf_iphc_crtp_cid16, tvb, offset_cid, 2, FALSE);
3828 /* information field */
3829 tvb_ensure_bytes_exist (tvb, 0, hdr_len);
3830 ti = proto_tree_add_text(fh_tree, tvb, 0,length,"Information Field");
3831 info_tree = proto_item_add_subtree(ti,ett_iphc_crtp_info);
3833 /* allocate a copy of the IP packet */
3834 ip_packet = tvb_memdup(tvb, 0, length);
3836 /* restore the proper values to the IP and UDP length fields */
3837 ip_packet[2] = length >> 8;
3838 ip_packet[3] = length;
3840 ip_packet[ip_hdr_len + 4] = (length - ip_hdr_len) >> 8;
3841 ip_packet[ip_hdr_len + 5] = (length - ip_hdr_len);
3843 next_tvb = tvb_new_child_real_data(tvb, ip_packet, length, length);
3844 add_new_data_source(pinfo, next_tvb, "Decompressed Data");
3845 tvb_set_free_cb(next_tvb, g_free);
3847 if (!dissector_try_port(ppp_subdissector_table, PPP_IP, next_tvb, pinfo, info_tree)) {
3848 call_dissector_only(data_handle, next_tvb, pinfo, info_tree);
3854 * 0x2067 Packets: Compressed UDP with 16-bit Context Identifier
3857 dissect_iphc_crtp_cudp16(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
3859 proto_tree *cudp_tree;
3860 proto_item *ti = NULL;
3865 col_set_str(pinfo->cinfo,COL_PROTOCOL, "CRTP");
3867 col_set_str(pinfo->cinfo, COL_INFO, "Compressed UDP 16");
3869 length = tvb_reported_length(tvb);
3872 ti = proto_tree_add_protocol_format(tree, proto_iphc_crtp, tvb, 0, -1,
3873 "%s", val_to_str(PPP_RTP_CUDP16, ppp_vals, "Unknown"));
3874 cudp_tree = proto_item_add_subtree(ti, ett_iphc_crtp);
3878 ti = proto_tree_add_item(cudp_tree, hf_iphc_crtp_cid16, tvb, 0, 2, FALSE);
3879 ti = proto_tree_add_item(cudp_tree, hf_iphc_crtp_seq, tvb, 2, 1, FALSE);
3881 offset += hdr_length;
3882 length -= hdr_length;
3884 ti = proto_tree_add_text(cudp_tree, tvb, offset, length, "Data (%d bytes)", length);
3889 * 0x67 Packets: Compressed UDP with 8-bit Context Identifier
3892 dissect_iphc_crtp_cudp8(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
3894 proto_tree *cudp_tree;
3895 proto_item *ti = NULL;
3900 col_set_str(pinfo->cinfo,COL_PROTOCOL, "CRTP");
3902 col_set_str(pinfo->cinfo, COL_INFO, "Compressed UDP 8");
3904 length = tvb_reported_length(tvb);
3907 ti = proto_tree_add_protocol_format(tree, proto_iphc_crtp, tvb, 0, -1,
3908 "%s", val_to_str(PPP_RTP_CUDP8, ppp_vals, "Unknown"));
3909 cudp_tree = proto_item_add_subtree(ti, ett_iphc_crtp);
3913 ti = proto_tree_add_item(cudp_tree, hf_iphc_crtp_cid8, tvb, 0, 1, FALSE);
3914 ti = proto_tree_add_item(cudp_tree, hf_iphc_crtp_seq, tvb, 1, 1, FALSE);
3916 offset += hdr_length;
3917 length -= hdr_length;
3919 ti = proto_tree_add_text(cudp_tree, tvb, offset, length, "Data (%d bytes)", length);
3925 * 0x2065 Packets: Context State
3928 dissect_iphc_crtp_cs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
3930 proto_tree *cs_tree;
3931 proto_item *ti = NULL;
3933 guint length, cid_size;
3934 guint offset = 2, hf;
3936 col_set_str(pinfo->cinfo,COL_PROTOCOL, "CRTP");
3938 col_set_str(pinfo->cinfo, COL_INFO, "Context State");
3942 ti = proto_tree_add_protocol_format(tree, proto_iphc_crtp, tvb, 0, -1,
3943 "%s", val_to_str(PPP_RTP_CS, ppp_vals, "Unknown"));
3945 cs_tree = proto_item_add_subtree(ti, ett_iphc_crtp);
3947 ti = proto_tree_add_item(cs_tree, hf_iphc_crtp_cs_flags, tvb, 0, 1, FALSE);
3948 ti = proto_tree_add_item(cs_tree, hf_iphc_crtp_cs_cnt, tvb, 1, 1, FALSE);
3950 /* calculate required length */
3951 flags = tvb_get_guint8(tvb, 0);
3952 cnt = tvb_get_guint8(tvb, 1);
3954 if (flags == IPHC_CRTP_CS_CID8) {
3955 hf = hf_iphc_crtp_cid8;
3959 hf = hf_iphc_crtp_cid16;
3964 tvb_ensure_bytes_exist(tvb, offset, length);
3966 while (offset < length) {
3967 ti = proto_tree_add_item(cs_tree, hf, tvb, offset, cid_size, FALSE);
3969 ti = proto_tree_add_item(cs_tree, hf_iphc_crtp_cs_invalid, tvb, offset, 1, FALSE);
3970 ti = proto_tree_add_item(cs_tree, hf_iphc_crtp_seq, tvb, offset, 1, FALSE);
3972 ti = proto_tree_add_item(cs_tree, hf_iphc_crtp_gen, tvb, offset, 1, FALSE);
3983 dissect_mplscp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
3985 dissect_cp(tvb, proto_mplscp, ett_mplscp, cp_vals, ett_mplscp_options,
3986 NULL, 0, pinfo, tree);
3990 * Cisco Discovery Protocol Control Protocol.
3991 * XXX - where is this documented?
3994 dissect_cdpcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
3996 dissect_cp(tvb, proto_cdpcp, ett_cdpcp, cp_vals, ett_cdpcp_options,
3997 NULL, 0, pinfo, tree);
4000 static gboolean mp_short_seqno = FALSE; /* Default to long sequence numbers */
4002 #define MP_FRAG_MASK 0xC0
4003 #define MP_FRAG(bits) ((bits) & MP_FRAG_MASK)
4004 #define MP_FRAG_FIRST 0x80
4005 #define MP_FRAG_LAST 0x40
4006 #define MP_FRAG_RESERVED 0x3f
4007 #define MP_FRAG_RESERVED_SHORT 0x30
4009 /* According to RFC 1990, the length the MP header isn't indicated anywhere
4010 in the header itself. It starts out at four bytes and can be
4011 negotiated down to two using LCP. We currently have a preference
4012 to select short headers. - gcc & gh
4015 dissect_mp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
4017 proto_tree *mp_tree = NULL, *hdr_tree;
4018 proto_item *ti = NULL;
4020 const gchar *flag_str;
4024 col_set_str(pinfo->cinfo, COL_PROTOCOL, "PPP MP");
4026 col_set_str(pinfo->cinfo, COL_INFO, "PPP Multilink");
4029 ti = proto_tree_add_item(tree, proto_mp, tvb, 0, mp_short_seqno ? 2 : 4, FALSE);
4030 mp_tree = proto_item_add_subtree(ti, ett_mp);
4033 flags = tvb_get_guint8(tvb, 0);
4036 switch (MP_FRAG(flags)) {
4043 case MP_FRAG_FIRST|MP_FRAG_LAST:
4044 flag_str = "First, Last";
4047 flag_str = "Unknown";
4050 ti = proto_tree_add_text(mp_tree, tvb, 0, 1, "Fragment: 0x%2X (%s)",
4051 MP_FRAG(flags), flag_str);
4052 hdr_tree = proto_item_add_subtree(ti, ett_mp_flags);
4053 proto_tree_add_boolean(hdr_tree, hf_mp_frag_first, tvb, 0, 1, flags);
4054 proto_tree_add_boolean(hdr_tree, hf_mp_frag_last, tvb, 0, 1, flags);
4055 if (mp_short_seqno) {
4056 proto_tree_add_text(hdr_tree, tvb, 0, 1, "%s",
4057 decode_boolean_bitfield(flags, MP_FRAG_RESERVED_SHORT, sizeof(flags) * 8,
4058 "reserved", "reserved"));
4059 proto_tree_add_item(mp_tree, hf_mp_short_sequence_num, tvb, 0, 2, FALSE);
4061 proto_tree_add_text(hdr_tree, tvb, 0, 1, "%s",
4062 decode_boolean_bitfield(flags, MP_FRAG_RESERVED, sizeof(flags) * 8,
4063 "reserved", "reserved"));
4064 proto_tree_add_item(mp_tree, hf_mp_sequence_num, tvb, 1, 3, FALSE);
4068 hdrlen = mp_short_seqno ? 2 : 4;
4069 if (tvb_reported_length_remaining(tvb, hdrlen) > 0) {
4070 next_tvb = tvb_new_subset_remaining(tvb, hdrlen);
4071 dissect_ppp(next_tvb, pinfo, tree);
4076 * Handles PPP without HDLC framing, just a protocol field (RFC 1661).
4079 dissect_ppp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) {
4080 proto_item *ti = NULL;
4081 proto_tree *fh_tree = NULL;
4084 ti = proto_tree_add_item(tree, proto_ppp, tvb, 0, -1, FALSE);
4085 fh_tree = proto_item_add_subtree(ti, ett_ppp);
4088 dissect_ppp_common(tvb, pinfo, tree, fh_tree, ti, 0);
4092 dissect_ppp_hdlc_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
4094 proto_item *ti = NULL;
4095 proto_tree *fh_tree = NULL;
4100 byte0 = tvb_get_guint8(tvb, 0);
4102 /* PPP HDLC encapsulation */
4106 /* address and control are compressed (NULL) */
4110 /* load the top pane info. This should be overwritten by
4111 the next protocol in the stack */
4113 ti = proto_tree_add_item(tree, proto_ppp, tvb, 0, -1, FALSE);
4114 fh_tree = proto_item_add_subtree(ti, ett_ppp);
4115 if (byte0 == 0xff) {
4116 proto_tree_add_item(fh_tree, hf_ppp_address, tvb, 0, 1, FALSE);
4117 proto_tree_add_item(fh_tree, hf_ppp_control, tvb, 1, 1, FALSE);
4121 next_tvb = decode_fcs(tvb, fh_tree, ppp_fcs_decode, proto_offset);
4123 dissect_ppp_common(next_tvb, pinfo, tree, fh_tree, ti, proto_offset);
4127 * Handles link-layer encapsulations where the frame might be
4128 * a PPP in HDLC-like Framing frame (RFC 1662) or a Cisco HDLC frame.
4131 dissect_ppp_hdlc( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
4135 byte0 = tvb_get_guint8(tvb, 0);
4136 if (byte0 == CHDLC_ADDR_UNICAST || byte0 == CHDLC_ADDR_MULTICAST) {
4137 /* Cisco HDLC encapsulation */
4138 call_dissector(chdlc_handle, tvb, pinfo, tree);
4143 * XXX - should we have an exported dissector that always dissects PPP,
4144 * for use when we know the packets are PPP, not CHDLC?
4146 col_set_str(pinfo->cinfo, COL_PROTOCOL, "PPP");
4147 switch (pinfo->p2p_dir) {
4150 col_set_str(pinfo->cinfo, COL_RES_DL_SRC, "DTE");
4151 col_set_str(pinfo->cinfo, COL_RES_DL_DST, "DCE");
4155 col_set_str(pinfo->cinfo, COL_RES_DL_SRC, "DCE");
4156 col_set_str(pinfo->cinfo, COL_RES_DL_DST, "DTE");
4160 col_set_str(pinfo->cinfo, COL_RES_DL_SRC, "N/A");
4161 col_set_str(pinfo->cinfo, COL_RES_DL_DST, "N/A");
4165 dissect_ppp_hdlc_common(tvb, pinfo, tree);
4169 remove_escape_chars(tvbuff_t *tvb, int offset, int length)
4173 int scanned_len = 0;
4177 buff = g_malloc(length);
4179 while ( scanned_len < length ){
4180 octet = tvb_get_guint8(tvb,offset);
4184 if (scanned_len >= length)
4186 octet = tvb_get_guint8(tvb,offset);
4187 buff[i] = octet ^ 0x20;
4199 next_tvb = tvb_new_child_real_data(tvb, buff,i,i);
4201 /* Arrange that the allocated packet data copy be freed when the
4204 tvb_set_free_cb( next_tvb, g_free );
4211 * Handles link-layer encapsulations where we have a raw RFC 1662
4212 * HDLC-like asynchronous framing byte stream, and have to
4213 * break the byte stream into frames and remove escapes.
4216 dissect_ppp_raw_hdlc( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
4219 proto_tree *bs_tree = NULL;
4220 gint offset, end_offset, data_offset;
4221 int length, data_length;
4223 gboolean first = TRUE;
4225 col_set_str(pinfo->cinfo, COL_PROTOCOL, "PPP");
4228 ti = proto_tree_add_item(tree, proto_ppp_hdlc, tvb, 0, -1, FALSE);
4229 bs_tree = proto_item_add_subtree(ti, ett_ppp_hdlc_data);
4233 * XXX - this needs to handle a PPP frame split over multiple higher-level
4238 * Look for a frame delimiter.
4240 offset = tvb_find_guint8(tvb, 0, -1, 0x7e);
4243 * None found - this is presumably continued from an earlier
4244 * packet and continued in a later packet.
4246 col_set_str(pinfo->cinfo, COL_INFO, "PPP Fragment");
4248 proto_tree_add_text(bs_tree, tvb, offset, -1, "PPP Fragment");
4250 length = tvb_length_remaining(tvb,offset);
4251 ppp_tvb = remove_escape_chars(tvb, offset,length);
4252 if (ppp_tvb != NULL) {
4253 add_new_data_source(pinfo, ppp_tvb, "PPP Fragment");
4254 call_dissector(data_handle, ppp_tvb, pinfo, tree);
4260 * We have some data preceding the first PPP packet;
4261 * mark it as a PPP fragment.
4263 col_set_str(pinfo->cinfo, COL_INFO, "PPP Fragment");
4266 proto_tree_add_text(bs_tree, tvb, 0, length, "PPP Fragment");
4268 ppp_tvb = remove_escape_chars(tvb, 0, length - 1);
4269 if (ppp_tvb != NULL) {
4270 add_new_data_source(pinfo, ppp_tvb, "PPP Fragment");
4271 call_dissector(data_handle, ppp_tvb, pinfo, tree);
4275 while ( tvb_reported_length_remaining(tvb, offset) > 0 ){
4277 * Look for the next frame delimiter.
4279 end_offset = tvb_find_guint8(tvb, offset+1, -1, 0x7e);
4280 if ( end_offset == -1 ){
4282 * We didn't find one. This is probably continued in
4286 col_set_str(pinfo->cinfo, COL_INFO, "PPP Fragment");
4289 proto_tree_add_text(bs_tree, tvb, offset, -1, "PPP Fragment");
4291 length = tvb_length_remaining(tvb, offset);
4292 ppp_tvb = remove_escape_chars(tvb, offset,length);
4293 if (ppp_tvb != NULL) {
4294 add_new_data_source(pinfo, ppp_tvb, "PPP Fragment");
4295 call_dissector(data_handle, ppp_tvb, pinfo, tree);
4300 data_offset = offset+1; /* skip starting frame delimiter */
4301 data_length = end_offset - data_offset;
4304 * Is that frame delimiter immediately followed by another one?
4305 * Some PPP implementations put a frame delimiter at the
4306 * beginning and the end of each frame, although RFC 1662
4307 * appears only to require that there be one frame delimiter
4308 * between adjacent frames:
4310 * Each frame begins and ends with a Flag Sequence, which is the
4311 * binary sequence 01111110 (hexadecimal 0x7e). All implementations
4312 * continuously check for this flag, which is used for frame
4315 * Only one Flag Sequence is required between two frames. Two
4316 * consecutive Flag Sequences constitute an empty frame, which is
4317 * silently discarded, and not counted as a FCS error.
4319 * If the delimiter at the end of this frame is followed by
4320 * another delimiter, we consider the first delimiter part
4323 if (tvb_offset_exists(tvb, end_offset+1) &&
4324 tvb_get_guint8(tvb, end_offset+1) == 0x7e)
4326 length = end_offset - offset;
4328 proto_tree_add_text(bs_tree, tvb, offset, length, "PPP Data");
4330 ppp_tvb = remove_escape_chars(tvb, data_offset, data_length);
4331 if (ppp_tvb != NULL) {
4332 add_new_data_source(pinfo, ppp_tvb, "PPP Message");
4333 dissect_ppp_hdlc_common(ppp_tvb, pinfo, tree);
4337 offset = end_offset;
4342 * At least for the PPP/USB captures I've seen, the data either starts with
4343 * 0x7eff03 or 0x7eff7d23 or 0xff03, so this function performs that heuristic
4344 * matching first before calling dissect_ppp_raw_hdlc(). Otherwise, if we call
4345 * it directly for USB captures, some captures like the following will not be
4346 * dissected correctly:
4347 * http://wiki.wireshark.org/SampleCaptures#head-886e340c31ca977f321c921f81cbec4c21bb7738
4349 * NOTE: I don't know if these heuristics are sufficient. Time will tell ...
4352 dissect_ppp_usb( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
4354 /* In some cases, the 0x03 normally in byte 3 is escaped so we must look for
4355 * the 2 byte sequence of 0x7d23 instead of 0x03. The 0x23 is generated by
4356 * 0x20^0x03 per section 4.2 of: http://tools.ietf.org/html/rfc1662.html. */
4357 const guchar buf1[3] = {0x7e, 0xff, 0x03};
4358 const guchar buf2[4] = {0x7e, 0xff, 0x7d, 0x23};
4361 if ((tvb_memeql(tvb, 0, buf2, sizeof(buf2)) == 0) ||
4362 (tvb_memeql(tvb, 0, buf1, sizeof(buf1)) == 0)) {
4363 dissect_ppp_raw_hdlc(tvb, pinfo, tree);
4365 else if ((tvb_memeql(tvb, 0, &buf1[1], sizeof(buf1) - 1) == 0) ||
4366 (tvb_memeql(tvb, 0, &buf2[1], sizeof(buf2) - 1) == 0)) {
4367 /* It's missing the 0x7e framing character. What TODO?
4368 * Should we try faking it by sticking 0x7e in front? Or try telling
4369 * dissect_ppp_raw_hdlc() NOT to look for the 0x7e frame deliminator?
4370 * Or is this a bug in libpcap (used 1.1.0)?
4371 * Or a bug in the Linux kernel (tested with 2.6.24.4) Or a bug in
4372 * usbmon? Or is the data we're looking at really just part of the
4373 * payload and not control data? Well, at least in my case it's
4374 * definitely not, but not sure if this is always the case. Is this
4375 * issue applicable only to PPP/USB or PPP/XYZ, in which case a more
4376 * general solution should be found?
4378 /* For now, just try skipping the framing I guess??? */
4379 if ( tvb_get_guint8(tvb, 1) == 0x03)
4380 next_tvb = tvb_new_subset_remaining(tvb, 2);
4382 next_tvb = tvb_new_subset_remaining(tvb, 3);
4383 dissect_ppp(next_tvb, pinfo, tree);
4385 else if (tvb_get_guint8(tvb, 0) == 0x7e) {
4386 /* Well, let's guess that since the 1st byte is 0x7e that it really is
4387 * a PPP frame, and the address and control bytes are compressed (NULL)
4388 * per http://tools.ietf.org/html/rfc1662, section 3.2. */
4389 next_tvb = tvb_new_subset_remaining(tvb, 1);
4390 dissect_ppp_hdlc_common(next_tvb, pinfo, tree);
4395 proto_register_ppp_raw_hdlc(void)
4397 static gint *ett[] = {
4401 proto_ppp_hdlc = proto_register_protocol("PPP In HDLC-Like Framing", "PPP-HDLC", "ppp_hdlc");
4402 proto_register_subtree_array(ett, array_length(ett));
4406 proto_reg_handoff_ppp_raw_hdlc(void)
4408 dissector_handle_t ppp_raw_hdlc_handle;
4409 dissector_handle_t ppp_usb_handle;
4411 ppp_raw_hdlc_handle = create_dissector_handle(dissect_ppp_raw_hdlc, proto_ppp);
4412 dissector_add("gre.proto", ETHERTYPE_CDMA2000_A10_UBS, ppp_raw_hdlc_handle);
4413 dissector_add("gre.proto", ETHERTYPE_3GPP2, ppp_raw_hdlc_handle);
4415 ppp_usb_handle = create_dissector_handle(dissect_ppp_usb, proto_ppp);
4416 dissector_add("usb.bulk", IF_CLASS_UNKNOWN, ppp_usb_handle);
4417 dissector_add("usb.bulk", IF_CLASS_VENDOR_SPECIFIC, ppp_usb_handle);
4418 dissector_add("usb.bulk", IF_CLASS_CDC_DATA, ppp_usb_handle);
4422 * Handles PAP just as a protocol field
4425 dissect_pap( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) {
4427 proto_tree *fh_tree = NULL;
4429 proto_tree *field_tree;
4431 proto_tree *message_tree;
4433 proto_tree *peer_id_tree;
4435 proto_tree *passwd_tree;
4438 guint8 id, peer_id_length, password_length, msg_length;
4441 code = tvb_get_guint8(tvb, 0);
4442 id = tvb_get_guint8(tvb, 1);
4443 length = tvb_get_ntohs(tvb, 2);
4445 col_set_str(pinfo->cinfo, COL_PROTOCOL, "PPP PAP");
4447 if(check_col(pinfo->cinfo, COL_INFO))
4448 col_add_str(pinfo->cinfo, COL_INFO,
4449 val_to_str(code, pap_vals, "Unknown"));
4452 ti = proto_tree_add_item(tree, proto_pap, tvb, 0, length, FALSE);
4453 fh_tree = proto_item_add_subtree(ti, ett_pap);
4454 proto_tree_add_text(fh_tree, tvb, 0, 1, "Code: %s (0x%02x)",
4455 val_to_str(code, pap_vals, "Unknown"), code);
4456 proto_tree_add_text(fh_tree, tvb, 1, 1, "Identifier: 0x%02x",
4458 proto_tree_add_text(fh_tree, tvb, 2, 2, "Length: %u",
4468 tf = proto_tree_add_text(fh_tree, tvb, offset, length,
4469 "Data (%d byte%s)", length, plurality(length, "", "s"));
4470 field_tree = proto_item_add_subtree(tf, ett_pap_data);
4471 peer_id_length = tvb_get_guint8(tvb, offset);
4472 tp = proto_tree_add_text(field_tree, tvb, offset, 1,
4473 "Peer ID length: %d byte%s", peer_id_length, plurality(peer_id_length, "", "s"));
4475 peer_id_tree = proto_item_add_subtree(tp, ett_pap_peer_id);
4476 proto_tree_add_text(peer_id_tree, tvb, ++offset, ppp_min(peer_id_length, length),
4477 "Peer-ID (%d byte%s)", peer_id_length, plurality(peer_id_length, "", "s"));
4478 offset+=peer_id_length;
4479 length-=peer_id_length;
4481 password_length = tvb_get_guint8(tvb, offset);
4483 tpw = proto_tree_add_text(field_tree, tvb, offset, 1,
4484 "Password length: %d byte%s", password_length, plurality(password_length, "", "s"));
4485 passwd_tree = proto_item_add_subtree(tpw, ett_pap_password);
4486 proto_tree_add_text(passwd_tree, tvb, ++offset, ppp_min(password_length, length),
4487 "Password (%d byte%s)", password_length, plurality(password_length, "", "s"));
4499 tf = proto_tree_add_text(fh_tree, tvb, offset, length,
4500 "Data (%d byte%s)", length, plurality(length, "", "s"));
4501 field_tree = proto_item_add_subtree(tf, ett_pap_data);
4502 msg_length = tvb_get_guint8(tvb, offset);
4503 tm = proto_tree_add_text(field_tree, tvb, offset, 1,
4504 "Message length: %d byte%s", msg_length, plurality(msg_length, "", "s"));
4506 message_tree = proto_item_add_subtree(tm, ett_pap_message);
4507 proto_tree_add_text(message_tree, tvb, ++offset, ppp_min(msg_length, length),
4508 "Message (%d byte%s)", msg_length, plurality(msg_length, "", "s"));
4515 proto_tree_add_text(fh_tree, tvb, offset, length, "Stuff (%d byte%s)",
4516 length, plurality(length, "", "s"));
4523 * Handles CHAP just as a protocol field
4526 dissect_chap( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) {
4527 proto_item *ti = NULL;
4528 proto_tree *fh_tree = NULL;
4530 proto_tree *field_tree;
4532 guint8 code, value_size;
4536 code = tvb_get_guint8(tvb, 0);
4537 col_set_str(pinfo->cinfo, COL_PROTOCOL, "PPP CHAP");
4539 if(check_col(pinfo->cinfo, COL_INFO))
4540 col_add_str(pinfo->cinfo, COL_INFO,
4541 val_to_str(code, chap_vals, "Unknown"));
4544 /* Create CHAP protocol tree */
4545 ti = proto_tree_add_item(tree, proto_chap, tvb, 0, -1, FALSE);
4546 fh_tree = proto_item_add_subtree(ti, ett_chap);
4549 proto_tree_add_item(fh_tree, hf_chap_code, tvb, 0, 1, FALSE);
4552 proto_tree_add_item(fh_tree, hf_chap_identifier, tvb, 1, 1, FALSE);
4555 /* Length - make sure it's valid */
4556 length = tvb_get_ntohs(tvb, 2);
4559 proto_tree_add_uint_format(fh_tree, hf_chap_length, tvb, 2, 2, length,
4560 "Length: %u (invalid, must be >= 4)",
4565 proto_item_set_len(ti, length);
4567 proto_tree_add_item(fh_tree, hf_chap_length, tvb, 2, 2, FALSE);
4570 /* Offset moved to after length field */
4572 /* Length includes previous 4 bytes, subtract */
4576 /* Challenge or Response data */
4581 guint value_offset=0;
4582 guint name_offset=0, name_size = 0;
4584 /* Create data subtree */
4585 tf = proto_tree_add_text(fh_tree, tvb, offset, length,
4586 "Data (%d byte%s)", length,
4587 plurality(length, "", "s"));
4588 field_tree = proto_item_add_subtree(tf, ett_chap_data);
4592 value_size = tvb_get_guint8(tvb, offset);
4593 if (value_size > length) {
4594 proto_tree_add_text(field_tree, tvb, offset, 1,
4595 "Value Size: %d byte%s (invalid, must be <= %u)",
4596 value_size, plurality(value_size, "", "s"),
4600 proto_tree_add_item(field_tree, hf_chap_value_size, tvb, offset, 1, FALSE);
4605 value_offset = offset;
4606 proto_tree_add_item(field_tree, hf_chap_value, tvb, offset, value_size, FALSE);
4608 /* Move along value_size bytes */
4612 /* Find name in remaining bytes */
4614 tvb_ensure_bytes_exist(tvb, offset, length);
4615 proto_tree_add_item(field_tree, hf_chap_name, tvb, offset, length, FALSE);
4616 name_offset = offset;
4620 /* Show name and value in info column */
4621 if(check_col(pinfo->cinfo, COL_INFO)){
4622 col_append_fstr(pinfo->cinfo, COL_INFO, " (NAME='%s%s', VALUE=0x%s)",
4623 tvb_format_text(tvb, name_offset,
4624 (name_size > 20) ? 20 : name_size),
4625 (name_size > 20) ? "..." : "",
4626 tvb_bytes_to_str(tvb, value_offset, value_size));
4633 /* Success or Failure data */
4638 proto_tree_add_item(fh_tree, hf_chap_message, tvb, offset, length, FALSE);
4642 /* Show message in info column */
4643 if(check_col(pinfo->cinfo, COL_INFO)){
4644 col_append_fstr(pinfo->cinfo, COL_INFO, " (MESSAGE='%s')",
4645 tvb_format_text(tvb, offset, length));
4649 /* Code from unknown code type... */
4652 proto_tree_add_text(fh_tree, tvb, offset, length, "Stuff (%u byte%s)",
4653 length, plurality(length, "", "s"));
4662 dissect_ipv6cp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
4664 dissect_cp(tvb, proto_ipv6cp, ett_ipv6cp, cp_vals, ett_ipv6cp_options,
4665 ipv6cp_opts, N_IPV6CP_OPTS, pinfo, tree);
4668 static void dissect_ipv6cp_if_id_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
4669 int offset, guint length, packet_info *pinfo _U_,
4672 proto_tree_add_text(tree, tvb, offset, length, "%s: %02x%02x:%02x%02x:%02x%x:%02x%02x",
4674 tvb_get_guint8(tvb, offset + 2),
4675 tvb_get_guint8(tvb, offset + 3),
4676 tvb_get_guint8(tvb, offset + 4),
4677 tvb_get_guint8(tvb, offset + 5),
4678 tvb_get_guint8(tvb, offset + 6),
4679 tvb_get_guint8(tvb, offset + 7),
4680 tvb_get_guint8(tvb, offset + 8),
4681 tvb_get_guint8(tvb, offset + 9)
4686 proto_register_ppp(void)
4688 static hf_register_info hf[] = {
4689 { &hf_ppp_direction,
4690 { "Direction", "ppp.direction", FT_UINT8, BASE_DEC,
4691 VALS(ppp_direction_vals), 0x0, "PPP direction", HFILL }},
4694 { "Address", "ppp.address", FT_UINT8, BASE_HEX,
4695 NULL, 0x0, NULL, HFILL }},
4698 { "Control", "ppp.control", FT_UINT8, BASE_HEX,
4699 NULL, 0x0, NULL, HFILL }},
4702 { "Protocol", "ppp.protocol", FT_UINT16, BASE_HEX,
4703 VALS(ppp_vals), 0x0, NULL, HFILL }},
4705 static gint *ett[] = {
4709 module_t *ppp_module;
4711 proto_ppp = proto_register_protocol("Point-to-Point Protocol", "PPP", "ppp");
4712 proto_register_field_array(proto_ppp, hf, array_length(hf));
4713 proto_register_subtree_array(ett, array_length(ett));
4715 /* subdissector code */
4716 ppp_subdissector_table = register_dissector_table("ppp.protocol",
4717 "PPP protocol", FT_UINT16, BASE_HEX);
4719 register_dissector("ppp_hdlc", dissect_ppp_hdlc, proto_ppp);
4720 register_dissector("ppp_lcp_options", dissect_lcp_options, proto_ppp);
4721 register_dissector("ppp", dissect_ppp, proto_ppp);
4723 /* Register the preferences for the ppp protocol */
4724 ppp_module = prefs_register_protocol(proto_ppp, NULL);
4726 prefs_register_enum_preference(ppp_module,
4728 "PPP Frame Checksum Type",
4729 "The type of PPP frame checksum (none, 16-bit, 32-bit)",
4731 fcs_options, FALSE);
4732 prefs_register_bool_preference(ppp_module,
4734 "Decompress Van Jacobson-compressed frames",
4735 "Whether Van Jacobson-compressed PPP frames should be decompressed",
4737 prefs_register_uint_preference(ppp_module,
4739 "PPPMuxCP Default PID (in hex)",
4740 "Default Protocol ID to be used for PPPMuxCP",
4741 16, &pppmux_def_prot_id);
4745 proto_reg_handoff_ppp(void)
4747 dissector_handle_t ppp_hdlc_handle, ppp_handle;
4750 * Get a handle for the CHDLC dissector.
4752 chdlc_handle = find_dissector("chdlc");
4753 data_handle = find_dissector("data");
4755 ppp_handle = find_dissector("ppp");
4756 dissector_add("fr.ietf", NLPID_PPP, ppp_handle);
4758 ppp_hdlc_handle = find_dissector("ppp_hdlc");
4759 dissector_add("wtap_encap", WTAP_ENCAP_PPP, ppp_hdlc_handle);
4760 dissector_add("wtap_encap", WTAP_ENCAP_PPP_WITH_PHDR, ppp_hdlc_handle);
4761 dissector_add("sll.ltype", LINUX_SLL_P_PPPHDLC, ppp_hdlc_handle);
4762 dissector_add("osinl.excl", NLPID_PPP, ppp_handle);
4763 dissector_add("gre.proto", ETHERTYPE_PPP, ppp_hdlc_handle);
4767 proto_register_mp(void)
4769 static hf_register_info hf[] = {
4770 { &hf_mp_frag_first,
4771 { "First fragment", "mp.first", FT_BOOLEAN, 8,
4772 TFS(&tfs_yes_no), MP_FRAG_FIRST, NULL, HFILL }},
4775 { "Last fragment", "mp.last", FT_BOOLEAN, 8,
4776 TFS(&tfs_yes_no), MP_FRAG_LAST, NULL, HFILL }},
4778 { &hf_mp_sequence_num,
4779 { "Sequence number", "mp.seq", FT_UINT24, BASE_DEC, NULL, 0x0,
4782 { &hf_mp_short_sequence_num,
4783 { "Sequence number", "mp.seq", FT_UINT16, BASE_DEC, NULL, 0x0FFF,
4786 static gint *ett[] = {
4791 module_t *mp_module;
4793 proto_mp = proto_register_protocol("PPP Multilink Protocol", "PPP MP", "mp");
4794 proto_register_field_array(proto_mp, hf, array_length(hf));
4795 proto_register_subtree_array(ett, array_length(ett));
4797 /* Register the preferences for the PPP multilink protocol */
4798 mp_module = prefs_register_protocol(proto_mp, NULL);
4800 prefs_register_bool_preference(mp_module,
4802 "Short sequence numbers",
4803 "Whether PPP Multilink frames use 12-bit sequence numbers",
4808 proto_reg_handoff_mp(void)
4810 dissector_handle_t mp_handle;
4812 mp_handle = create_dissector_handle(dissect_mp, proto_mp);
4813 dissector_add("ppp.protocol", PPP_MP, mp_handle);
4817 proto_register_lcp(void)
4819 static gint *ett[] = {
4822 &ett_lcp_authprot_opt,
4823 &ett_lcp_qualprot_opt,
4824 &ett_lcp_fcs_alternatives_opt,
4825 &ett_lcp_numbered_mode_opt,
4826 &ett_lcp_callback_opt,
4827 &ett_lcp_multilink_ep_disc_opt,
4828 &ett_lcp_internationalization_opt,
4831 proto_lcp = proto_register_protocol("PPP Link Control Protocol", "PPP LCP",
4833 proto_register_subtree_array(ett, array_length(ett));
4837 proto_reg_handoff_lcp(void)
4839 dissector_handle_t lcp_handle;
4841 lcp_handle = create_dissector_handle(dissect_lcp, proto_lcp);
4842 dissector_add("ppp.protocol", PPP_LCP, lcp_handle);
4845 * NDISWAN on Windows translates Ethernet frames from higher-level
4846 * protocols into PPP frames to hand to the PPP driver, and translates
4847 * PPP frames from the PPP driver to hand to the higher-level protocols.
4849 * Apparently the PPP driver, on at least some versions of Windows,
4850 * passes frames for internal-to-PPP protocols up through NDISWAN;
4851 * the protocol type field appears to be passed through unchanged
4852 * (unlike what's done with, for example, the protocol type field
4853 * for IP, which is mapped from its PPP value to its Ethernet value).
4855 * This means that we may see, on Ethernet captures, frames for
4856 * protocols internal to PPP, so we register PPP_LCP with the
4857 * "ethertype" dissector table as well as the PPP protocol dissector
4860 dissector_add("ethertype", PPP_LCP, lcp_handle);
4863 * for GSM-A / MobileL3 / GPRS SM / PCO
4865 dissector_add("sm_pco.protocol", PPP_LCP, lcp_handle);
4870 proto_register_vsncp(void)
4872 static gint *ett[] = {
4877 proto_vsncp = proto_register_protocol("Vendor Specific Control Protocol", "VSNCP",
4879 proto_register_subtree_array(ett, array_length(ett));
4883 proto_reg_handoff_vsncp(void)
4885 dissector_handle_t vsncp_handle;
4887 vsncp_handle = create_dissector_handle(dissect_vsncp, proto_vsncp);
4888 dissector_add("ppp.protocol", PPP_VSNCP, vsncp_handle);
4892 proto_register_vsnp(void)
4894 static gint *ett[] = {
4899 static hf_register_info hf[] = {
4901 { "Data", "vsnp.data", FT_NONE, BASE_NONE, NULL, 0x0,
4902 "VSNP PDU", HFILL }},
4904 { "Header", "vsnp.header", FT_NONE, BASE_NONE, NULL, 0x0,
4905 "VSNP Header", HFILL }},
4907 { "PDN ID", "vsnp.pdnid", FT_UINT8, BASE_DEC, NULL, 0x0,
4910 { "Data", "vsnp.data", FT_STRING, BASE_NONE, NULL, 0x0,
4914 proto_vsnp = proto_register_protocol("Vendor Specific Network Protocol", "PPP VSNP",
4916 proto_register_subtree_array(ett, array_length(ett));
4917 proto_register_field_array(proto_vsnp, hf, array_length(hf));
4921 proto_reg_handoff_vsnp(void)
4923 dissector_handle_t vsnp_handle;
4925 vsnp_handle = create_dissector_handle(dissect_vsnp, proto_vsnp);
4926 dissector_add("ppp.protocol", PPP_VSNP, vsnp_handle);
4930 proto_register_ipcp(void)
4932 static gint *ett[] = {
4935 &ett_ipcp_ipaddrs_opt,
4936 &ett_ipcp_compress_opt,
4939 proto_ipcp = proto_register_protocol("PPP IP Control Protocol", "PPP IPCP",
4941 proto_register_subtree_array(ett, array_length(ett));
4945 proto_reg_handoff_ipcp(void)
4947 dissector_handle_t ipcp_handle;
4949 ipcp_handle = create_dissector_handle(dissect_ipcp, proto_ipcp);
4950 dissector_add("ppp.protocol", PPP_IPCP, ipcp_handle);
4953 * See above comment about NDISWAN for an explanation of why we're
4954 * registering with the "ethertype" dissector table.
4956 dissector_add("ethertype", PPP_IPCP, ipcp_handle);
4959 * for GSM-A / MobileL3 / GPRS SM / PCO
4961 dissector_add("sm_pco.protocol", PPP_IPCP, ipcp_handle);
4966 proto_register_bcp(void)
4968 static hf_register_info hf[] = {
4970 { "Flags", "bcp.flags", FT_UINT8, BASE_HEX,
4971 NULL, 0x0, NULL, HFILL }},
4973 { &hf_bcp_fcs_present,
4974 { "LAN FCS present", "bcp.flags.fcs_present", FT_BOOLEAN, 8,
4975 TFS(&tfs_yes_no), BCP_FCS_PRESENT, NULL, HFILL }},
4978 { "802.3 pad zero-filled", "bcp.flags.zeropad", FT_BOOLEAN, 8,
4979 TFS(&tfs_yes_no), BCP_ZEROPAD, NULL, HFILL }},
4982 { "Bridge control", "bcp.flags.bcontrol", FT_BOOLEAN, 8,
4983 TFS(&tfs_yes_no), BCP_IS_BCONTROL, NULL, HFILL }},
4986 { "Pads", "bcp.pads", FT_UINT8, BASE_DEC,
4987 NULL, BCP_PADS_MASK, NULL, HFILL }},
4990 { "MAC Type", "bcp.mac_type", FT_UINT8, BASE_DEC,
4991 VALS(bcp_mac_type_vals), 0x0, NULL, HFILL }},
4994 static gint *ett[] = {
4999 proto_bcp = proto_register_protocol("PPP Bridging Control Protocol", "PPP BCP", "bcp");
5000 proto_register_field_array(proto_bcp, hf, array_length(hf));
5001 proto_register_subtree_array(ett, array_length(ett));
5005 proto_register_osicp(void)
5007 static gint *ett[] = {
5010 &ett_osicp_align_npdu_opt,
5013 proto_osicp = proto_register_protocol("PPP OSI Control Protocol", "PPP OSICP",
5015 proto_register_subtree_array(ett, array_length(ett));
5019 proto_reg_handoff_bcp(void)
5021 dissector_handle_t bcp_handle;
5022 eth_withfcs_handle = find_dissector("eth_withfcs");
5023 eth_withoutfcs_handle = find_dissector("eth_withoutfcs");
5025 bcp_handle = create_dissector_handle(dissect_bcp, proto_bcp);
5026 dissector_add("ppp.protocol", PPP_BCP, bcp_handle);
5030 proto_reg_handoff_osicp(void)
5032 dissector_handle_t osicp_handle;
5034 osicp_handle = create_dissector_handle(dissect_osicp, proto_osicp);
5035 dissector_add("ppp.protocol", PPP_OSICP, osicp_handle);
5038 * See above comment about NDISWAN for an explanation of why we're
5039 * registering with the "ethertype" dissector table.
5041 dissector_add("ethertype", PPP_OSICP, osicp_handle);
5045 proto_register_ccp(void)
5047 static gint *ett[] = {
5052 &ett_ccp_bsdcomp_opt,
5053 &ett_ccp_lzsdcp_opt,
5055 &ett_ccp_deflate_opt,
5058 proto_ccp = proto_register_protocol("PPP Compression Control Protocol",
5060 proto_register_subtree_array(ett, array_length(ett));
5064 proto_reg_handoff_ccp(void)
5066 dissector_handle_t ccp_handle;
5068 ccp_handle = create_dissector_handle(dissect_ccp, proto_ccp);
5069 dissector_add("ppp.protocol", PPP_CCP, ccp_handle);
5072 * See above comment about NDISWAN for an explanation of why we're
5073 * registering with the "ethertype" dissector table.
5075 dissector_add("ethertype", PPP_CCP, ccp_handle);
5079 proto_register_cbcp(void)
5081 static gint *ett[] = {
5084 &ett_cbcp_callback_opt,
5085 &ett_cbcp_callback_opt_addr
5088 proto_cbcp = proto_register_protocol("PPP Callback Control Protocol",
5089 "PPP CBCP", "cbcp");
5090 proto_register_subtree_array(ett, array_length(ett));
5094 proto_reg_handoff_cbcp(void)
5096 dissector_handle_t cbcp_handle;
5098 cbcp_handle = create_dissector_handle(dissect_cbcp, proto_cbcp);
5099 dissector_add("ppp.protocol", PPP_CBCP, cbcp_handle);
5102 * See above comment about NDISWAN for an explanation of why we're
5103 * registering with the "ethertype" dissector table.
5105 dissector_add("ethertype", PPP_CBCP, cbcp_handle);
5109 proto_register_bacp(void)
5111 static gint *ett[] = {
5114 &ett_bacp_favored_peer_opt
5117 proto_bacp = proto_register_protocol("PPP Bandwidth Allocation Control Protocol",
5118 "PPP BACP", "bacp");
5119 proto_register_subtree_array(ett, array_length(ett));
5123 proto_reg_handoff_bacp(void)
5125 dissector_handle_t bacp_handle;
5127 bacp_handle = create_dissector_handle(dissect_bacp, proto_bacp);
5128 dissector_add("ppp.protocol", PPP_BACP, bacp_handle);
5131 * See above comment about NDISWAN for an explanation of why we're
5132 * registering with the "ethertype" dissector table.
5134 dissector_add("ethertype", PPP_BACP, bacp_handle);
5138 proto_register_bap(void)
5140 static gint *ett[] = {
5143 &ett_bap_link_type_opt,
5144 &ett_bap_phone_delta_opt,
5145 &ett_bap_phone_delta_subopt,
5146 &ett_bap_call_status_opt
5149 proto_bap = proto_register_protocol("PPP Bandwidth Allocation Protocol",
5151 proto_register_subtree_array(ett, array_length(ett));
5155 proto_reg_handoff_bap(void)
5157 dissector_handle_t bap_handle;
5159 bap_handle = create_dissector_handle(dissect_bap, proto_bap);
5160 dissector_add("ppp.protocol", PPP_BAP, bap_handle);
5163 * See above comment about NDISWAN for an explanation of why we're
5164 * registering with the "ethertype" dissector table.
5166 dissector_add("ethertype", PPP_BAP, bap_handle);
5170 proto_register_comp_data(void)
5172 static gint *ett[] = {
5176 proto_comp_data = proto_register_protocol("PPP Compressed Datagram",
5177 "PPP Comp", "comp_data");
5178 proto_register_subtree_array(ett, array_length(ett));
5182 proto_reg_handoff_comp_data(void)
5184 dissector_handle_t comp_data_handle;
5186 comp_data_handle = create_dissector_handle(dissect_comp_data,
5188 dissector_add("ppp.protocol", PPP_COMP, comp_data_handle);
5191 * See above comment about NDISWAN for an explanation of why we're
5192 * registering with the "ethertype" dissector table.
5194 dissector_add("ethertype", PPP_COMP, comp_data_handle);
5198 proto_register_pap(void)
5200 static gint *ett[] = {
5208 proto_pap = proto_register_protocol("PPP Password Authentication Protocol", "PPP PAP",
5210 proto_register_subtree_array(ett, array_length(ett));
5214 proto_reg_handoff_pap(void)
5216 dissector_handle_t pap_handle;
5218 pap_handle = create_dissector_handle(dissect_pap, proto_pap);
5219 dissector_add("ppp.protocol", PPP_PAP, pap_handle);
5222 * See above comment about NDISWAN for an explanation of why we're
5223 * registering with the "ethertype" dissector table.
5225 dissector_add("ethertype", PPP_PAP, pap_handle);
5228 * for GSM-A / MobileL3 / GPRS SM / PCO
5230 dissector_add("sm_pco.protocol", PPP_PAP, pap_handle);
5234 proto_register_chap(void)
5236 static gint *ett[] = {
5244 static hf_register_info hf[] =
5249 "Code", "chap.code",
5251 VALS(chap_vals), 0x0,
5256 &hf_chap_identifier,
5258 "Identifier", "chap.identifier",
5261 "CHAP identifier", HFILL
5267 "Length", "chap.length",
5268 FT_UINT16, BASE_DEC,
5270 "CHAP length", HFILL
5274 &hf_chap_value_size,
5276 "Value Size", "chap.value_size",
5279 "CHAP value size", HFILL
5285 "Value", "chap.value",
5286 FT_BYTES, BASE_NONE,
5288 "CHAP value data", HFILL
5294 "Name", "chap.name",
5295 FT_STRING, BASE_NONE,
5303 "Message", "chap.message",
5304 FT_STRING, BASE_NONE,
5306 "CHAP message", HFILL
5312 proto_chap = proto_register_protocol("PPP Challenge Handshake Authentication Protocol", "PPP CHAP",
5314 proto_register_field_array(proto_chap, hf, array_length(hf));
5315 proto_register_subtree_array(ett, array_length(ett));
5319 proto_reg_handoff_chap(void)
5321 dissector_handle_t chap_handle = create_dissector_handle(dissect_chap, proto_chap);
5322 dissector_add("ppp.protocol", PPP_CHAP, chap_handle);
5325 * See above comment about NDISWAN for an explanation of why we're
5326 * registering with the "ethertype" dissector table.
5328 dissector_add("ethertype", PPP_CHAP, chap_handle);
5331 * for GSM-A / MobileL3 / GPRS SM / PCO
5333 dissector_add("sm_pco.protocol", PPP_CHAP, chap_handle);
5337 proto_register_pppmuxcp(void)
5339 static gint *ett[] = {
5341 &ett_pppmuxcp_options,
5344 proto_pppmuxcp = proto_register_protocol("PPPMux Control Protocol",
5347 proto_register_subtree_array(ett, array_length(ett));
5352 proto_reg_handoff_pppmuxcp(void)
5354 dissector_handle_t muxcp_handle;
5356 muxcp_handle = create_dissector_handle(dissect_pppmuxcp, proto_pppmuxcp);
5357 dissector_add("ppp.protocol", PPP_MUXCP, muxcp_handle);
5360 * See above comment about NDISWAN for an explanation of why we're
5361 * registering with the "ethertype" dissector table.
5363 dissector_add("ethertype", PPP_MUXCP, muxcp_handle);
5368 proto_register_pppmux(void)
5370 static hf_register_info hf[] =
5372 { &hf_pppmux_protocol,
5373 { "Protocol", "ppp.protocol", FT_UINT16, BASE_HEX,
5374 VALS(ppp_vals), 0x0,
5375 "The protocol of the sub-frame.", HFILL }},
5378 static gint *ett[] = {
5380 &ett_pppmux_subframe,
5381 &ett_pppmux_subframe_hdr,
5382 &ett_pppmux_subframe_flags,
5383 &ett_pppmux_subframe_info,
5386 proto_pppmux = proto_register_protocol("PPP Multiplexing",
5389 proto_register_field_array(proto_pppmux, hf, array_length(hf));
5390 proto_register_subtree_array(ett, array_length(ett));
5394 proto_reg_handoff_pppmux(void)
5396 dissector_handle_t pppmux_handle;
5398 pppmux_handle = create_dissector_handle(dissect_pppmux, proto_pppmux);
5399 dissector_add("ppp.protocol", PPP_MUX, pppmux_handle);
5402 * See above comment about NDISWAN for an explanation of why we're
5403 * registering with the "ethertype" dissector table.
5405 dissector_add("ethertype", PPP_MUX, pppmux_handle);
5409 proto_register_mplscp(void)
5411 static gint *ett[] = {
5413 &ett_mplscp_options,
5416 proto_mplscp = proto_register_protocol("PPP MPLS Control Protocol",
5417 "PPP MPLSCP", "mplscp");
5418 proto_register_subtree_array(ett, array_length(ett));
5422 proto_reg_handoff_mplscp(void)
5424 dissector_handle_t mplscp_handle;
5426 mplscp_handle = create_dissector_handle(dissect_mplscp, proto_mplscp);
5427 dissector_add("ppp.protocol", PPP_MPLSCP, mplscp_handle);
5430 * See above comment about NDISWAN for an explanation of why we're
5431 * registering with the "ethertype" dissector table.
5433 dissector_add("ethertype", PPP_MPLSCP, mplscp_handle);
5437 proto_register_cdpcp(void)
5439 static gint *ett[] = {
5444 proto_cdpcp = proto_register_protocol("PPP CDP Control Protocol",
5445 "PPP CDPCP", "cdpcp");
5446 proto_register_subtree_array(ett, array_length(ett));
5450 proto_reg_handoff_cdpcp(void)
5452 dissector_handle_t cdpcp_handle;
5454 cdpcp_handle = create_dissector_handle(dissect_cdpcp, proto_cdpcp);
5455 dissector_add("ppp.protocol", PPP_CDPCP, cdpcp_handle);
5458 * See above comment about NDISWAN for an explanation of why we're
5459 * registering with the "ethertype" dissector table.
5461 dissector_add("ethertype", PPP_CDPCP, cdpcp_handle);
5465 proto_register_ipv6cp(void)
5467 static gint *ett[] = {
5469 &ett_ipv6cp_options,
5470 &ett_ipv6cp_if_id_opt,
5471 &ett_ipv6cp_compress_opt,
5474 proto_ipv6cp = proto_register_protocol("PPP IPv6 Control Protocol",
5475 "PPP IPV6CP", "ipv6cp");
5476 proto_register_subtree_array(ett, array_length(ett));
5480 proto_reg_handoff_ipv6cp(void)
5482 dissector_handle_t ipv6cp_handle;
5484 ipv6cp_handle = create_dissector_handle(dissect_ipv6cp, proto_ipv6cp);
5485 dissector_add("ppp.protocol", PPP_IPV6CP, ipv6cp_handle);
5488 * See above comment about NDISWAN for an explanation of why we're
5489 * registering with the "ethertype" dissector table.
5491 dissector_add("ethertype", PPP_IPV6CP, ipv6cp_handle);
5495 proto_register_iphc_crtp(void)
5497 static hf_register_info hf[] =
5500 &hf_iphc_crtp_cid16,
5502 "Context Id", "crtp.cid",
5503 FT_UINT16, BASE_DEC,
5505 "The context identifier of the compressed packet.", HFILL
5511 "Context Id", "crtp.cid",
5514 "The context identifier of the compressed packet.", HFILL
5520 "Generation", "crtp.gen",
5523 "The generation of the compressed packet.", HFILL
5529 "Sequence", "crtp.seq",
5532 "The sequence of the compressed packet.", HFILL
5536 &hf_iphc_crtp_fh_flags,
5538 "Flags", "crtp.flags",
5540 iphc_crtp_fh_flags, 0xc0,
5541 "The flags of the full header packet.", HFILL
5545 &hf_iphc_crtp_cs_flags,
5547 "Flags", "crtp.flags",
5549 iphc_crtp_cs_flags, 0x0,
5550 "The flags of the context state packet.", HFILL
5554 &hf_iphc_crtp_cs_cnt,
5556 "Count", "crtp.cnt",
5559 "The count of the context state packet.", HFILL
5563 &hf_iphc_crtp_cs_invalid,
5565 "Invalid", "crtp.invalid",
5568 "The invalid bit of the context state packet.", HFILL
5573 static gint *ett[] = {
5576 &ett_iphc_crtp_info,
5579 proto_iphc_crtp = proto_register_protocol("CRTP", "CRTP", "crtp");
5580 proto_register_field_array(proto_iphc_crtp, hf, array_length(hf));
5581 proto_register_subtree_array(ett, array_length(ett));
5585 proto_reg_handoff_iphc_crtp(void)
5587 dissector_handle_t fh_handle;
5588 dissector_handle_t cudp16_handle;
5589 dissector_handle_t cudp8_handle;
5590 dissector_handle_t cs_handle;
5592 fh_handle = create_dissector_handle(dissect_iphc_crtp_fh, proto_iphc_crtp);
5593 dissector_add("ppp.protocol", PPP_RTP_FH, fh_handle);
5595 cudp16_handle = create_dissector_handle(dissect_iphc_crtp_cudp16, proto_iphc_crtp);
5596 dissector_add("ppp.protocol", PPP_RTP_CUDP16, cudp16_handle);
5598 cudp8_handle = create_dissector_handle(dissect_iphc_crtp_cudp8, proto_iphc_crtp);
5599 dissector_add("ppp.protocol", PPP_RTP_CUDP8, cudp16_handle);
5601 cs_handle = create_dissector_handle(dissect_iphc_crtp_cs, proto_iphc_crtp);
5602 dissector_add("ppp.protocol", PPP_RTP_CS, cs_handle);
5605 * See above comment about NDISWAN for an explanation of why we're
5606 * registering with the "ethertype" dissector table.
5608 dissector_add("ethertype", PPP_RTP_FH, fh_handle);
5609 dissector_add("ethertype", PPP_RTP_CUDP16, cudp16_handle);
5610 dissector_add("ethertype", PPP_RTP_CUDP8, cudp16_handle);
5611 dissector_add("ethertype", PPP_RTP_CS, cs_handle);