File indexing completed on 2025-01-05 04:37:29
0001 /* 0002 SPDX-FileCopyrightText: 2005 Joris Guisson <joris.guisson@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 #ifndef BTCONSTANTS_H 0007 #define BTCONSTANTS_H 0008 0009 #include <QtGlobal> 0010 0011 namespace bt 0012 { 0013 typedef quint64 Uint64; 0014 typedef quint32 Uint32; 0015 typedef quint16 Uint16; 0016 typedef quint8 Uint8; 0017 0018 typedef qint64 Int64; 0019 typedef qint32 Int32; 0020 typedef qint16 Int16; 0021 typedef qint8 Int8; 0022 0023 typedef Uint64 TimeStamp; 0024 0025 typedef enum { 0026 // also leave some room if we want to add new priorities in the future 0027 FIRST_PREVIEW_PRIORITY = 55, 0028 FIRST_PRIORITY = 50, 0029 NORMAL_PREVIEW_PRIORITY = 45, 0030 NORMAL_PRIORITY = 40, 0031 LAST_PREVIEW_PRIORITY = 35, 0032 LAST_PRIORITY = 30, 0033 ONLY_SEED_PRIORITY = 20, 0034 EXCLUDED = 10, 0035 } Priority; 0036 0037 enum ConfirmationResult { 0038 KEEP_DATA, 0039 THROW_AWAY_DATA, 0040 CANCELED, 0041 }; 0042 0043 const Uint32 MAX_MSGLEN = 9 + 131072; 0044 const Uint16 MIN_PORT = 6881; 0045 const Uint16 MAX_PORT = 6889; 0046 const Uint32 MAX_PIECE_LEN = 16384; 0047 0048 const Uint8 CHOKE = 0; 0049 const Uint8 UNCHOKE = 1; 0050 const Uint8 INTERESTED = 2; 0051 const Uint8 NOT_INTERESTED = 3; 0052 const Uint8 HAVE = 4; 0053 const Uint8 BITFIELD = 5; 0054 const Uint8 REQUEST = 6; 0055 const Uint8 PIECE = 7; 0056 const Uint8 CANCEL = 8; 0057 const Uint8 PORT = 9; 0058 const Uint8 SUGGEST_PIECE = 13; 0059 const Uint8 HAVE_ALL = 14; 0060 const Uint8 HAVE_NONE = 15; 0061 const Uint8 REJECT_REQUEST = 16; 0062 const Uint8 ALLOWED_FAST = 17; 0063 const Uint8 EXTENDED = 20; // extension protocol message 0064 0065 // flags for things which a peer supports 0066 const Uint32 DHT_SUPPORT = 0x01; 0067 const Uint32 EXT_PROT_SUPPORT = 0x10; 0068 const Uint32 FAST_EXT_SUPPORT = 0x04; 0069 0070 enum TransportProtocol { TCP, UTP }; 0071 } 0072 0073 #endif