Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2015 Cisco and/or its affiliates. |
| 3 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | * you may not use this file except in compliance with the License. |
| 5 | * You may obtain a copy of the License at: |
| 6 | * |
| 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | * |
| 9 | * Unless required by applicable law or agreed to in writing, software |
| 10 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | * See the License for the specific language governing permissions and |
| 13 | * limitations under the License. |
| 14 | */ |
| 15 | #ifndef included_vnet_ppp_packet_h |
| 16 | #define included_vnet_ppp_packet_h |
| 17 | |
| 18 | /* |
| 19 | * PPP packet format |
| 20 | * |
| 21 | * Copyright (c) 2009 Eliot Dresselhaus |
| 22 | * |
| 23 | * Permission is hereby granted, free of charge, to any person obtaining |
| 24 | * a copy of this software and associated documentation files (the |
| 25 | * "Software"), to deal in the Software without restriction, including |
| 26 | * without limitation the rights to use, copy, modify, merge, publish, |
| 27 | * distribute, sublicense, and/or sell copies of the Software, and to |
| 28 | * permit persons to whom the Software is furnished to do so, subject to |
| 29 | * the following conditions: |
| 30 | * |
| 31 | * The above copyright notice and this permission notice shall be |
| 32 | * included in all copies or substantial portions of the Software. |
| 33 | * |
| 34 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 35 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 36 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 37 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
| 38 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
| 39 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
| 40 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 41 | */ |
| 42 | |
| 43 | /* |
| 44 | See http://www.iana.org/assignments/ppp-numbers. |
| 45 | |
| 46 | The Point-to-Point Protocol (PPP) Data Link Layer [146,147,175] |
| 47 | contains a 16 bit Protocol field to identify the the encapsulated |
| 48 | protocol. The Protocol field is consistent with the ISO 3309 (HDLC) |
| 49 | extension mechanism for Address fields. All Protocols MUST be |
| 50 | assigned such that the least significant bit of the most significant |
| 51 | octet equals "0", and the least significant bit of the least |
| 52 | significant octet equals "1". |
| 53 | */ |
| 54 | |
| 55 | #define foreach_ppp_protocol \ |
| 56 | _ (0x0001, padding) \ |
| 57 | _ (0x0003, rohc_small_cid) \ |
| 58 | _ (0x0005, rohc_large_cid) \ |
| 59 | _ (0x0021, ip4) \ |
| 60 | _ (0x0023, osi) \ |
| 61 | _ (0x0025, xerox_ns_idp) \ |
| 62 | _ (0x0027, decnet) \ |
| 63 | _ (0x0029, appletalk) \ |
| 64 | _ (0x002b, ipx) \ |
| 65 | _ (0x002d, vj_compressed_tcp) \ |
| 66 | _ (0x002f, vj_uncompressed_tcp) \ |
| 67 | _ (0x0031, bpdu) \ |
| 68 | _ (0x0033, streams) \ |
| 69 | _ (0x0035, vines) \ |
| 70 | _ (0x0039, appletalk_eddp) \ |
| 71 | _ (0x003b, appletalk_smart_buffered) \ |
| 72 | _ (0x003d, multilink) \ |
| 73 | _ (0x003f, netbios_framing) \ |
| 74 | _ (0x0041, cisco) \ |
| 75 | _ (0x0043, timeplex) \ |
| 76 | _ (0x0045, fujitsu_lblb) \ |
| 77 | _ (0x0047, dca_remote_lan) \ |
| 78 | _ (0x0049, sdtp) \ |
| 79 | _ (0x004b, sna_over_802_2) \ |
| 80 | _ (0x004d, sna) \ |
| 81 | _ (0x004f, ip6_header_compression) \ |
| 82 | _ (0x0051, knx) \ |
| 83 | _ (0x0053, encryption) \ |
| 84 | _ (0x0055, link_encryption) \ |
| 85 | _ (0x0057, ip6) \ |
| 86 | _ (0x0059, ppp_mux) \ |
| 87 | _ (0x005b, vendor_specific_a) \ |
| 88 | _ (0x0061, rtp_iphc_full_header) \ |
| 89 | _ (0x0063, rtp_iphc_compressed_tcp) \ |
| 90 | _ (0x0065, rtp_iphc_compressed_non_tcp) \ |
| 91 | _ (0x0067, rtp_iphc_compressed_udp_8) \ |
| 92 | _ (0x0069, rtp_iphc_compressed_rtp_8) \ |
| 93 | _ (0x006f, stampede) \ |
| 94 | _ (0x0073, mp_plus) \ |
| 95 | _ (0x007d, control) \ |
| 96 | _ (0x00c1, ntcits_ipi) \ |
| 97 | _ (0x00cf, ppp_nlpid) \ |
| 98 | _ (0x00fb, multilink_compression) \ |
| 99 | _ (0x00fd, compressed_datagram) \ |
| 100 | _ (0x0201, 802_1d_hello) \ |
| 101 | _ (0x0203, ibm_source_routing) \ |
| 102 | _ (0x0205, dec_lanbridge) \ |
| 103 | _ (0x0207, cdp) \ |
| 104 | _ (0x0209, netcs) \ |
| 105 | _ (0x020b, stp) \ |
| 106 | _ (0x020d, edp) \ |
| 107 | _ (0x0211, oscp_a) \ |
| 108 | _ (0x0213, oscp_b) \ |
| 109 | _ (0x0231, luxcom) \ |
| 110 | _ (0x0233, sigma) \ |
| 111 | _ (0x0235, apple_client_server) \ |
| 112 | _ (0x0281, mpls_unicast) \ |
| 113 | _ (0x0283, mpls_multicast) \ |
| 114 | _ (0x0285, ieee_p1284_4) \ |
| 115 | _ (0x0287, tetra) \ |
| 116 | _ (0x0289, multichannel_flow_treatment) \ |
| 117 | _ (0x2063, rtp_iphc_compressed_tcp_no_delta) \ |
| 118 | _ (0x2065, rtp_iphc_context_state) \ |
| 119 | _ (0x2067, rtp_iphc_compressed_udp_16) \ |
| 120 | _ (0x2069, rtp_iphc_compressed_rtp_16) \ |
| 121 | _ (0x4001, cray) \ |
| 122 | _ (0x4003, cdpd) \ |
| 123 | _ (0x4005, expand) \ |
| 124 | _ (0x4007, odsicp) \ |
| 125 | _ (0x4009, docsis_dll) \ |
| 126 | _ (0x400B, cetacean) \ |
| 127 | _ (0x4021, lzs) \ |
| 128 | _ (0x4023, reftek) \ |
| 129 | _ (0x4025, fibre_channel) \ |
| 130 | _ (0x4027, emit) \ |
| 131 | _ (0x405b, vendor_specific_b) \ |
| 132 | _ (0xc021, lcp) \ |
| 133 | _ (0xc023, pap) \ |
| 134 | _ (0xc025, link_quality_report) \ |
| 135 | _ (0xc027, shiva_password) \ |
| 136 | _ (0xc029, cbcp) \ |
| 137 | _ (0xc02b, bacp) \ |
| 138 | _ (0xc02d, bap) \ |
| 139 | _ (0xc05b, vendor_specific_password) \ |
| 140 | _ (0xc081, container_control) \ |
| 141 | _ (0xc223, chap) \ |
| 142 | _ (0xc225, rsa) \ |
| 143 | _ (0xc227, extensible_authentication) \ |
| 144 | _ (0xc229, mitsubishi_security_info) \ |
| 145 | _ (0xc26f, stampede_authorization) \ |
| 146 | _ (0xc281, proprietary_authentication_a) \ |
| 147 | _ (0xc283, proprietary_authentication_b) \ |
| 148 | _ (0xc481, proprietary_node_id_authentication) |
| 149 | |
Calvin | aba0fe4 | 2016-08-19 13:43:59 -0400 | [diff] [blame] | 150 | typedef enum |
| 151 | { |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 152 | #define _(n,f) PPP_PROTOCOL_##f = n, |
| 153 | foreach_ppp_protocol |
| 154 | #undef _ |
| 155 | } ppp_protocol_t; |
| 156 | |
| 157 | /* PPP Link Control Protocol (LCP) and Internet Protocol Control Protocol (IPCP) Codes |
| 158 | |
| 159 | The Point-to-Point Protocol (PPP) Link Control Protocol (LCP), |
| 160 | the Compression Control Protocol (CCP), Internet Protocol Control |
| 161 | Protocol (IPCP), and other control protocols, contain an 8 bit |
| 162 | Code field which identifies the type of packet. */ |
| 163 | |
| 164 | #define foreach_ppp_lcp_code \ |
| 165 | _ (0, vendor_specific) \ |
| 166 | _ (1, configure_request) \ |
| 167 | _ (2, configure_ack) \ |
| 168 | _ (3, configure_nak) \ |
| 169 | _ (4, configure_reject) \ |
| 170 | _ (5, terminate_request) \ |
| 171 | _ (6, terminate_ack) \ |
| 172 | _ (7, code_reject) \ |
| 173 | _ (8, protocol_reject) \ |
| 174 | _ (9, echo_request) \ |
| 175 | _ (10, echo_reply) \ |
| 176 | _ (11, discard_request) \ |
| 177 | _ (12, identification) \ |
| 178 | _ (13, time_remaining) \ |
| 179 | _ (14, reset_request) \ |
| 180 | _ (15, reset_reply) |
| 181 | |
Calvin | aba0fe4 | 2016-08-19 13:43:59 -0400 | [diff] [blame] | 182 | typedef struct |
| 183 | { |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 184 | /* Set to 0xff 0x03 */ |
| 185 | u8 address, control; |
| 186 | |
| 187 | /* Layer 3 protocol for this packet. */ |
| 188 | u16 protocol; |
| 189 | } ppp_header_t; |
| 190 | |
| 191 | #endif /* included_vnet_ppp_packet_h */ |
Calvin | aba0fe4 | 2016-08-19 13:43:59 -0400 | [diff] [blame] | 192 | |
| 193 | /* |
| 194 | * fd.io coding-style-patch-verification: ON |
| 195 | * |
| 196 | * Local Variables: |
| 197 | * eval: (c-set-style "gnu") |
| 198 | * End: |
| 199 | */ |