HEX
Server: LiteSpeed
System: Linux us-phx-web1284.main-hosting.eu 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: u300739242 (300739242)
PHP: 8.2.30
Disabled: system, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Upload Files
File: //opt/alt/python37/lib/python3.7/site-packages/exabgp/protocol/ip/tcp/flag.py
# encoding: utf-8
"""
tcpflags.py

Created by Thomas Mangin on 2010-02-04.
Copyright (c) 2009-2017 Exa Networks. All rights reserved.
License: 3-clause BSD. (See the COPYRIGHT file)
"""

from exabgp.protocol.resource import BitResource


# ====================================================================== TCPFlag
# https://www.iana.org/assignments/tcp-header-flags


class TCPFlag(BitResource):
    NAME = 'tcp flag'

    FIN = 0x01
    SYN = 0x02
    RST = 0x04
    PUSH = 0x08
    ACK = 0x10
    URGENT = 0x20

    codes = dict(
        (k.lower().replace('_', '-'), v)
        for (k, v) in {'FIN': FIN, 'SYN': SYN, 'RST': RST, 'PUSH': PUSH, 'ACK': ACK, 'URGENT': URGENT,}.items()
    )

    names = dict([(r, l) for (l, r) in codes.items()])