ppp.h (6839B)
1 /* 2 * 3 * 4 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 5 * 6 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 7 * 8 */ 9 10 #ifndef __BCM_PPP_H__ 11 #define __BCM_PPP_H__ 12 13 #if defined(INCLUDE_L3) 14 15 #include <bcm/types.h> 16 #include <bcm/qos.h> 17 #include <bcm/l3.h> 18 19 /* PPP Tunnel flags. */ 20 #define BCM_PPP_TERM_WITH_ID 0x00000001 /* Create object with ID. */ 21 #define BCM_PPP_TERM_REPLACE 0x00000002 /* Update existing 22 object. */ 23 #define BCM_PPP_TERM_STAT_ENABLE 0x00000004 /* Enable statistics. */ 24 #define BCM_PPP_TERM_WIDE 0x00000008 /* Enable additional 25 user-data information. */ 26 #define BCM_PPP_TERM_SESSION_ANTI_SPOOFING 0x00000010 /* Enable Session 27 spoofing check */ 28 #define BCM_PPP_TERM_CROSS_CONNECT 0x00000020 /* PPP P2P mode */ 29 #define BCM_PPP_INIT_WITH_ID 0x00000001 /* Create object with ID. */ 30 #define BCM_PPP_INIT_REPLACE 0x00000002 /* Update existing 31 object. */ 32 #define BCM_PPP_INIT_STAT_ENABLE 0x00000004 /* Enable statistics. */ 33 34 /* PPP tunnel types. */ 35 typedef enum bcm_ppp_type_e { 36 bcmPPPTypePPPoE = 0, /* PPPoE tunnel. */ 37 bcmPPPTypeL2TPv2 = 1, /* L2TPv2 tunnel. */ 38 bcmPPPTypeCount = 2 /* Must be last */ 39 } bcm_ppp_type_t; 40 41 /* PPP tunnel termination spoofing check type. */ 42 typedef enum bcm_ppp_term_spoofing_check_type_e { 43 bcmPPPTermSpoofingCheckTypeVlanPort = 0, /* Spoofing check arrived from the 44 expected Incoming VLAN-Port. */ 45 bcmPPPTermSpoofingCheckTypeCount = 1 /* Must be last. */ 46 } bcm_ppp_term_spoofing_check_type_t; 47 48 /* PPP tunnel terminator. */ 49 typedef struct bcm_ppp_terminator_s { 50 uint32 flags; /* See BCM_PPP_TERM_xxx flag 51 definitions. */ 52 bcm_ppp_type_t type; /* PPP Terminator type */ 53 uint32 session_id; /* Session id in PPPoE/L2TP header. */ 54 uint32 l2tpv2_tunnel_id; /* Tunnel id in L2TP header. */ 55 bcm_mac_t src_mac; /* source MAC address. */ 56 uint32 network_domain; /* Network identifier. Used to 57 distinguish multiple networks. */ 58 bcm_qos_ingress_model_t ingress_qos_model; /* Ingress qos and ttl model. */ 59 bcm_gport_t ppp_terminator_id; /* Gport Tunnel id */ 60 } bcm_ppp_terminator_t; 61 62 /* PPP tunnel initiator. */ 63 typedef struct bcm_ppp_initiator_s { 64 uint32 flags; /* See BCM_PPP_INIT_xxx flag 65 definitions. */ 66 bcm_ppp_type_t type; /* PPP Initiator type. */ 67 uint32 session_id; /* Session ID. */ 68 uint32 l2tpv2_tunnel_id; /* Tunnel id in L2TP header. */ 69 bcm_if_t l3_intf_id; /* Next Intf pointing following tunnel. */ 70 bcm_encap_access_t encap_access; /* Encapsulation phase to be used */ 71 bcm_qos_egress_model_t egress_qos_model; /* Egress qos and ttl model */ 72 bcm_gport_t ppp_initiator_id; /* Gport Tunnel id */ 73 } bcm_ppp_initiator_t; 74 75 /* PPP tunnel termination spoofing check information. */ 76 typedef struct bcm_ppp_term_spoofing_check_s { 77 uint32 flags; /* See BCM_PPP_TERM_SPOOFING_CHECK_xxx 78 flag definitions. */ 79 bcm_ppp_term_spoofing_check_type_t type; /* Spoofing check type */ 80 bcm_gport_t ppp_terminator_id; /* PPP Terminator ID. */ 81 bcm_gport_t vlan_port_id; /* VLAN Gport ID. */ 82 } bcm_ppp_term_spoofing_check_t; 83 84 /* PPP Terminator Additional Info Structure. */ 85 typedef struct bcm_ppp_terminator_additional_info_s { 86 bcm_ppp_type_t type; /* PPP Terminator type */ 87 } bcm_ppp_terminator_additional_info_t; 88 89 /* PPP Initiator Additional Info Structure. */ 90 typedef struct bcm_ppp_initiator_additional_info_s { 91 bcm_ppp_type_t type; /* PPP Initiator type */ 92 } bcm_ppp_initiator_additional_info_t; 93 94 /* PPP Term Spoofing Check Additional Info Structure. */ 95 typedef struct bcm_ppp_term_spoofing_check_additional_info_s { 96 bcm_ppp_term_spoofing_check_type_t type; /* Spoofing check type */ 97 } bcm_ppp_term_spoofing_check_additional_info_t; 98 99 /* bcm_ppp_terminator_traverse_cb */ 100 typedef int (*bcm_ppp_terminator_traverse_cb)( 101 int unit, 102 bcm_ppp_terminator_t *info, 103 void *user_data); 104 105 /* bcm_ppp_initiator_traverse_cb */ 106 typedef int (*bcm_ppp_initiator_traverse_cb)( 107 int unit, 108 bcm_ppp_initiator_t *info, 109 void *user_data); 110 111 /* bcm_ppp_term_spoofing_check_traverse_cb */ 112 typedef int (*bcm_ppp_term_spoofing_check_traverse_cb)( 113 int unit, 114 bcm_ppp_term_spoofing_check_t *info, 115 void *user_data); 116 117 #ifndef BCM_HIDE_DISPATCHABLE 118 119 /* Create a new PPP initiator. */ 120 extern int bcm_ppp_initiator_create( 121 int unit, 122 bcm_ppp_initiator_t *info); 123 124 /* Get a PPP initiator. */ 125 extern int bcm_ppp_initiator_get( 126 int unit, 127 bcm_ppp_initiator_t *info); 128 129 /* Delete a PPP initiator. */ 130 extern int bcm_ppp_initiator_delete( 131 int unit, 132 bcm_ppp_initiator_t *info); 133 134 /* Traverse all PPP tunnel initiators */ 135 extern int bcm_ppp_initiator_traverse( 136 int unit, 137 bcm_ppp_initiator_additional_info_t *additional_info, 138 bcm_ppp_initiator_traverse_cb cb, 139 void *user_data); 140 141 /* Create a new PPP terminator. */ 142 extern int bcm_ppp_terminator_create( 143 int unit, 144 bcm_ppp_terminator_t *info); 145 146 /* Delete a PPP terminator. */ 147 extern int bcm_ppp_terminator_delete( 148 int unit, 149 bcm_ppp_terminator_t *info); 150 151 /* Get a PPP terminator. */ 152 extern int bcm_ppp_terminator_get( 153 int unit, 154 bcm_ppp_terminator_t *info); 155 156 /* Traverse PPP Tunnel Terminator Info */ 157 extern int bcm_ppp_terminator_traverse( 158 int unit, 159 bcm_ppp_terminator_additional_info_t *additional_info, 160 bcm_ppp_terminator_traverse_cb cb, 161 void *user_data); 162 163 /* Add a PPP Term spoofing check. */ 164 extern int bcm_ppp_term_spoofing_check_add( 165 int unit, 166 bcm_ppp_term_spoofing_check_t *info); 167 168 /* Delete a PPP Term spoofing check. */ 169 extern int bcm_ppp_term_spoofing_check_delete( 170 int unit, 171 bcm_ppp_term_spoofing_check_t *info); 172 173 /* Traverse PPP Term Spoofing Check Info */ 174 extern int bcm_ppp_term_spoofing_check_traverse( 175 int unit, 176 bcm_ppp_term_spoofing_check_additional_info_t *additional_info, 177 bcm_ppp_term_spoofing_check_traverse_cb cb, 178 void *user_data); 179 180 #endif /* defined(INCLUDE_L3) */ 181 182 #endif /* BCM_HIDE_DISPATCHABLE */ 183 184 #endif /* __BCM_PPP_H__ */