<commit_before># Copyright 2015 Cisco Systems, Inc.
# All rights reserved.
#
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

""" All BGP constant values """

# some handy things to know
BGP_MAX_PACKET_SIZE = 4096
BGP_MARKER_SIZE = 16  # size of BGP marker
BGP_HEADER_SIZE = 19  # size of BGP header, including marker
BGP_MIN_OPEN_MSG_SIZE = 29
BGP_MIN_UPDATE_MSG_SIZE = 23
BGP_MIN_NOTIFICATION_MSG_SIZE = 21
BGP_MIN_KEEPALVE_MSG_SIZE = BGP_HEADER_SIZE
BGP_TCP_PORT = 179
BGP_ROUTE_DISTINGUISHER_SIZE = 8

# BGP message types
BGP_OPEN = 1
BGP_UPDATE = 2
BGP_NOTIFICATION = 3
BGP_KEEPALIVE = 4
BGP_ROUTE_REFRESH = 5
BGP_CAPABILITY = 6
BGP_ROUTE_REFRESH_CISCO = 0x80

BGP_SIZE_OF_PATH_ATTRIBUTE = 2

# attribute flags, from RFC1771
BGP_ATTR_FLAG_OPTIONAL = 0x80
BGP_ATTR_FLAG_TRANSITIVE = 0x40
BGP_ATTR_FLAG_PARTIAL = 0x20
BGP_ATTR_FLAG_EXTENDED_LENGTH = 0x10


# SSA flags
BGP_SSA_TRANSITIVE = 0x8000
BGP_SSA_TYPE = 0x7FFF

# SSA Types
BGP_SSA_L2TPv3 = 1
BGP_SSA_mGRE = 2
BGP_SSA_IPSec = 3
BGP_SSA_MPLS = 4
BGP_SSA_L2TPv3_IN_IPSec = 5
BGP_SSA_mGRE_IN_IPSec = 6

# AS_PATH segment types
AS_SET = 1  # RFC1771
AS_SEQUENCE = 2  # RFC1771
AS_CONFED_SET = 4  # RFC1965 has the wrong values, corrected in
AS_CONFED_SEQUENCE = 3  # draft-ietf-idr-bgp-confed-rfc1965bis-01.txt

# OPEN message Optional Parameter types
BGP_OPTION_AUTHENTICATION = 1  # RFC1771
BGP_OPTION_CAPABILITY = 2  # RFC2842

# attribute types
BGPTYPE_ORIGIN = 1  # RFC1771
BGPTYPE_AS_PATH = 2  # RFC1771
BGPTYPE_NEXT_HOP = 3  # RFC1771
BGPTYPE_MULTI_EXIT_DISC = 4  # RFC1771
BGPTYPE_LOCAL_PREF = 5  # RFC1771
BGPTYPE_ATOMIC_AGGREGATE = 6  # RFC1771
BGPTYPE_AGGREGATOR = 7  # RFC1771
BGPTYPE_COMMUNITIES = 8  # RFC1997
BGPTYPE_ORIGINATOR_ID = 9  # RFC2796
BGPTYPE_CLUSTER_LIST = 10  # RFC2796
BGPTYPE_DPA = 11  # work in progress
BGPTYPE_ADVERTISER = 12  # RFC1863
BGPTYPE_RCID_PATH = 13  # RFC1863
BGPTYPE_MP_REACH_NLRI = 14  # RFC2858
BGPTYPE_MP_UNREACH_NLRI = 15  # RFC2858
BGPTYPE_EXTENDED_COMMUNITY = 16  # Draft Ramachandra
BGPTYPE_NEW_AS_PATH = 17  # draft-ietf-idr-as4bytes
BGPTYPE_NEW_AGGREGATOR = 18  # draft-ietf-idr-as4bytes
BGPTYPE_SAFI_SPECIFIC_ATTR = 19  # draft-kapoor-nalawade-idr-bgp-ssa-00.txt
BGPTYPE_TUNNEL_ENCAPS_ATTR = 23  # RFC5512
BGPTYPE_LINK_STATE = 99
BGPTYPE_ATTRIBUTE_SET = 128

#  VPN Route Target  #
BGP_EXT_COM_RT_0 = 0x0002  # Route Target,Format AS(2bytes):AN(4bytes)
BGP_EXT_COM_RT_1 = 0x0102  # Route Target,Format IPv4 address(4bytes):AN(2bytes)
BGP_EXT_COM_RT_2 = 0x0202  # Route Target,Format AS(4bytes):AN(2bytes)

# Route Origin (SOO site of Origin)
BGP_EXT_COM_RO_0 = 0x0003  # Route Origin,Format AS(2bytes):AN(4bytes)
BGP_EXT_COM_RO_1 = 0x0103  # Route Origin,Format IP address:AN(2bytes)
BGP_EXT_COM_RO_2 = 0x0203  # Route Origin,Format AS(2bytes):AN(4bytes)

# BGP Flow Spec
BGP_EXT_REDIRECT_NH = 0x0800  # redirect to ipv4/v6 nexthop
BGP_EXT_TRA_RATE = 0x8006  # traffic-rate 2-byte as#, 4-byte float
BGP_EXT_TRA_ACTION = 0x8007  # traffic-action bitmask
BGP_EXT_REDIRECT_VRF = 0x8008  # redirect 6-byte Route Target
BGP_EXT_TRA_MARK = 0x8009  # traffic-marking DSCP value

# BGP cost cummunity
BGP_EXT_COM_COST = 0x4301

# BGP link bandwith
BGP_EXT_COM_LINK_BW = 0x4004

# Unkonw
BGP_EXT_COM_UNKNOW = 0x0000

# route distinguisher type
BGP_ROUTE_DISTINGUISHER_TYPE_0 = 0x0000
BGP_ROUTE_DISTINGUISHER_TYPE_1 = 0x0001
BGP_ROUTE_DISTINGUISHER_TYPE_2 = 0x0002

# NLRI type as define in BGP flow spec RFC
BGPNLRI_FSPEC_DST_PFIX = 1  # RFC 5575
BGPNLRI_FSPEC_SRC_PFIX = 2  # RFC 5575
BGPNLRI_FSPEC_IP_PROTO = 3  # RFC 5575
BGPNLRI_FSPEC_PORT = 4  # RFC 5575
BGPNLRI_FSPEC_DST_PORT = 5  # RFC 5575
BGPNLRI_FSPEC_SRC_PORT = 6  # RFC 5575
BGPNLRI_FSPEC_ICMP_TP = 7  # RFC 5575
BGPNLRI_FSPEC_ICMP_CD = 8  # RFC 5575
BGPNLRI_FSPEC_TCP_FLAGS = 9  # RFC 5575<commit_msg>add some BGP extended community type values<commit_after># Copyright 2015 Cisco Systems, Inc.
# All rights reserved.
#
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

""" All BGP constant values """

# some handy things to know
BGP_MAX_PACKET_SIZE = 4096
BGP_MARKER_SIZE = 16  # size of BGP marker
BGP_HEADER_SIZE = 19  # size of BGP header, including marker
BGP_MIN_OPEN_MSG_SIZE = 29
BGP_MIN_UPDATE_MSG_SIZE = 23
BGP_MIN_NOTIFICATION_MSG_SIZE = 21
BGP_MIN_KEEPALVE_MSG_SIZE = BGP_HEADER_SIZE
BGP_TCP_PORT = 179
BGP_ROUTE_DISTINGUISHER_SIZE = 8

# BGP message types
BGP_OPEN = 1
BGP_UPDATE = 2
BGP_NOTIFICATION = 3
BGP_KEEPALIVE = 4
BGP_ROUTE_REFRESH = 5
BGP_CAPABILITY = 6
BGP_ROUTE_REFRESH_CISCO = 0x80

BGP_SIZE_OF_PATH_ATTRIBUTE = 2

# attribute flags, from RFC1771
BGP_ATTR_FLAG_OPTIONAL = 0x80
BGP_ATTR_FLAG_TRANSITIVE = 0x40
BGP_ATTR_FLAG_PARTIAL = 0x20
BGP_ATTR_FLAG_EXTENDED_LENGTH = 0x10


# SSA flags
BGP_SSA_TRANSITIVE = 0x8000
BGP_SSA_TYPE = 0x7FFF

# SSA Types
BGP_SSA_L2TPv3 = 1
BGP_SSA_mGRE = 2
BGP_SSA_IPSec = 3
BGP_SSA_MPLS = 4
BGP_SSA_L2TPv3_IN_IPSec = 5
BGP_SSA_mGRE_IN_IPSec = 6

# AS_PATH segment types
AS_SET = 1  # RFC1771
AS_SEQUENCE = 2  # RFC1771
AS_CONFED_SET = 4  # RFC1965 has the wrong values, corrected in
AS_CONFED_SEQUENCE = 3  # draft-ietf-idr-bgp-confed-rfc1965bis-01.txt

# OPEN message Optional Parameter types
BGP_OPTION_AUTHENTICATION = 1  # RFC1771
BGP_OPTION_CAPABILITY = 2  # RFC2842

# attribute types
BGPTYPE_ORIGIN = 1  # RFC1771
BGPTYPE_AS_PATH = 2  # RFC1771
BGPTYPE_NEXT_HOP = 3  # RFC1771
BGPTYPE_MULTI_EXIT_DISC = 4  # RFC1771
BGPTYPE_LOCAL_PREF = 5  # RFC1771
BGPTYPE_ATOMIC_AGGREGATE = 6  # RFC1771
BGPTYPE_AGGREGATOR = 7  # RFC1771
BGPTYPE_COMMUNITIES = 8  # RFC1997
BGPTYPE_ORIGINATOR_ID = 9  # RFC2796
BGPTYPE_CLUSTER_LIST = 10  # RFC2796
BGPTYPE_DPA = 11  # work in progress
BGPTYPE_ADVERTISER = 12  # RFC1863
BGPTYPE_RCID_PATH = 13  # RFC1863
BGPTYPE_MP_REACH_NLRI = 14  # RFC2858
BGPTYPE_MP_UNREACH_NLRI = 15  # RFC2858
BGPTYPE_EXTENDED_COMMUNITY = 16  # Draft Ramachandra
BGPTYPE_NEW_AS_PATH = 17  # draft-ietf-idr-as4bytes
BGPTYPE_NEW_AGGREGATOR = 18  # draft-ietf-idr-as4bytes
BGPTYPE_SAFI_SPECIFIC_ATTR = 19  # draft-kapoor-nalawade-idr-bgp-ssa-00.txt
BGPTYPE_TUNNEL_ENCAPS_ATTR = 23  # RFC5512
BGPTYPE_LINK_STATE = 99
BGPTYPE_ATTRIBUTE_SET = 128

# BGP Tunnel Encapsulation Attribute Tunnel Types
BGP_TUNNEL_ENCAPS_RESERVED = 0
BGP_TUNNEL_ENCAPS_L2TPV3_OVER_IP = 1
BGP_TUNNEL_ENCAPS_GRE = 2
BGP_TUNNEL_ENCAPS_TRANSMIT_TUNNEL_ENDPOINT = 3
BGP_TUNNEL_ENCAPS_IPSEC_TUNNEL_MODE = 4
BGP_TUNNEL_ENCAPS_IP_IN_IP_TUNNEL_WITH_IPSEC = 5
BGP_TUNNEL_ENCAPS_MPLS_IN_IP_TUNNEL_WITH_IPSEC = 6
BGP_TUNNEL_ENCAPS_IP_IN_IP = 7
BGP_TUNNEL_ENCAPS_VXLAN = 8
BGP_TUNNEL_ENCAPS_NVGRE = 9
BGP_TUNNEL_ENCAPS_MPLS = 10
BGP_TUNNEL_ENCAPS_MPLS_IN_GRE = 11
BGP_TUNNEL_ENCAPS_VXLAN_GRE = 12
BGP_TUNNEL_ENCAPS_MPLS_IN_UDP = 13

#  VPN Route Target  #
BGP_EXT_COM_RT_0 = 0x0002  # Route Target,Format AS(2bytes):AN(4bytes)
BGP_EXT_COM_RT_1 = 0x0102  # Route Target,Format IPv4 address(4bytes):AN(2bytes)
BGP_EXT_COM_RT_2 = 0x0202  # Route Target,Format AS(4bytes):AN(2bytes)

# Route Origin (SOO site of Origin)
BGP_EXT_COM_RO_0 = 0x0003  # Route Origin,Format AS(2bytes):AN(4bytes)
BGP_EXT_COM_RO_1 = 0x0103  # Route Origin,Format IP address:AN(2bytes)
BGP_EXT_COM_RO_2 = 0x0203  # Route Origin,Format AS(2bytes):AN(4bytes)

# BGP Flow Spec
BGP_EXT_REDIRECT_NH = 0x0800  # redirect to ipv4/v6 nexthop
BGP_EXT_TRA_RATE = 0x8006  # traffic-rate 2-byte as#, 4-byte float
BGP_EXT_TRA_ACTION = 0x8007  # traffic-action bitmask
BGP_EXT_REDIRECT_VRF = 0x8008  # redirect 6-byte Route Target
BGP_EXT_TRA_MARK = 0x8009  # traffic-marking DSCP value

# Transitive Opaque
BGP_EXT_COM_OSPF_ROUTE_TYPE = 0x0306  # OSPF Route Type
BGP_EXT_COM_COLOR = 0x030b  # Color
BGP_EXT_COM_ENCAP = 0x030c  # BGP_EXT_COM_ENCAP = 0x030c
BGP_EXT_COM_DEFAULT_GATEWAY = 0x030d  # Default Gateway

# BGP EVPN
BGP_EXT_COM_EVPN_MAC_MOBIL = 0x0600  # Mac Mobility
BGP_EXT_COM_EVPN_ESI_MPLS_LABEL = 0x0601  # ESI MPLS Label
BGP_EXT_COM_EVPN_ES_IMPORT = 0x0602  # ES Import


# BGP cost cummunity
BGP_EXT_COM_COST = 0x4301

# BGP link bandwith
BGP_EXT_COM_LINK_BW = 0x4004

# Unkonw
BGP_EXT_COM_UNKNOW = 0x0000

# route distinguisher type
BGP_ROUTE_DISTINGUISHER_TYPE_0 = 0x0000
BGP_ROUTE_DISTINGUISHER_TYPE_1 = 0x0001
BGP_ROUTE_DISTINGUISHER_TYPE_2 = 0x0002

# NLRI type as define in BGP flow spec RFC
BGPNLRI_FSPEC_DST_PFIX = 1  # RFC 5575
BGPNLRI_FSPEC_SRC_PFIX = 2  # RFC 5575
BGPNLRI_FSPEC_IP_PROTO = 3  # RFC 5575
BGPNLRI_FSPEC_PORT = 4  # RFC 5575
BGPNLRI_FSPEC_DST_PORT = 5  # RFC 5575
BGPNLRI_FSPEC_SRC_PORT = 6  # RFC 5575
BGPNLRI_FSPEC_ICMP_TP = 7  # RFC 5575
BGPNLRI_FSPEC_ICMP_CD = 8  # RFC 5575
BGPNLRI_FSPEC_TCP_FLAGS = 9  # RFC 5575
{'fraction_non_alphanumeric': 0.05897730837603263, 'fraction_numerical': 0.08051866569068283, 'mean_word_length': 5.15048231511254, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4480549', 'n_tokens_mistral': 4737, 'n_tokens_neox': 4153, 'n_words': 902}