| #include <string> |
| 6 |
| 7 | #define TGVOIP_PEER_CAP_GROUP_CALLS (1 << 0) |
| 8 | #define TGVOIP_PEER_CAP_VIDEO_CAPTURE (1 << 1) |
| 9 | #define TGVOIP_PEER_CAP_VIDEO_DISPLAY (1 << 2) |
| 10 |
| 11 | /* flags:# voice_call_id:flags.2?int128 in_seq_no:flags.4?int out_seq_no:flags.4?int |
| 12 | * recent_received_mask:flags.5?int proto:flags.3?int extra:flags.1?string raw_data:flags.0?string |
| 13 | */ |
| 14 |
| 15 | #define PFLAG_HAS_DATA std::uint32_t{1 << 0} |
| 16 | #define PFLAG_HAS_EXTRA std::uint32_t{1 << 1} |
| 17 | #define PFLAG_HAS_CALL_ID std::uint32_t{1 << 2} |
| 18 | #define PFLAG_HAS_PROTO std::uint32_t{1 << 3} |
| 19 | #define PFLAG_HAS_SEQ std::uint32_t{1 << 4} |
| 20 | #define PFLAG_HAS_RECENT_RECV std::uint32_t{1 << 5} |
| 21 | #define PFLAG_HAS_SENDER_TAG_HASH std::uint32_t{1 << 6} |
| 22 |
| 23 | #define XPFLAG_HAS_EXTRA std::uint8_t{1 << 0} |
| 24 | #define XPFLAG_HAS_RECV_TS std::uint8_t{1 << 1} |
| 25 |
| 26 | #define STREAM_FLAG_ENABLED std::uint8_t{1 << 0} |
| 27 | #define STREAM_FLAG_DTX std::uint8_t{1 << 1} |
| 28 | #define STREAM_FLAG_EXTRA_EC std::uint8_t{1 << 2} |
| 29 | #define STREAM_FLAG_PAUSED std::uint8_t{1 << 3} |
| 30 |
| 31 | #define STREAM_RFLAG_SUPPORTED 1 |
| 32 |
| 33 | #define INIT_FLAG_DATA_SAVING_ENABLED std::uint8_t{1 << 0} |
| 34 | #define INIT_FLAG_GROUP_CALLS_SUPPORTED std::uint8_t{1 << 1} |
| 35 | #define INIT_FLAG_VIDEO_SEND_SUPPORTED std::uint8_t{1 << 2} |
| 36 | #define INIT_FLAG_VIDEO_RECV_SUPPORTED std::uint8_t{1 << 3} |
| 37 |
| 38 | #define TLID_DECRYPTED_AUDIO_BLOCK std::uint32_t{0xDBF948C1} |
| 39 | #define TLID_SIMPLE_AUDIO_BLOCK std::uint32_t{0xCC0D0E76} |
| 40 | #define TLID_UDP_REFLECTOR_PEER_INFO std::uint32_t{0x27D9371C} |
| 41 | #define TLID_UDP_REFLECTOR_PEER_INFO_IPV6 std::uint32_t{0x83fc73b1} |
| 42 | #define TLID_UDP_REFLECTOR_SELF_INFO std::uint32_t{0xc01572c7} |
| 43 | #define TLID_UDP_REFLECTOR_REQUEST_PACKETS_INFO std::uint32_t{0x1a06fc96} |
| 44 | #define TLID_UDP_REFLECTOR_LAST_PACKETS_INFO std::uint32_t{0x0e107305} |
| 45 | #define TLID_VECTOR std::uint32_t{0x1cb5c415} |
| 46 |
| 47 | #define NEED_RATE_FLAG_SHITTY_INTERNET_MODE std::uint8_t{1 << 0} |
| 48 | #define NEED_RATE_FLAG_UDP_NA std::uint8_t{1 << 1} |
| 49 | #define NEED_RATE_FLAG_UDP_BAD std::uint8_t{1 << 2} |
| 50 | #define NEED_RATE_FLAG_RECONNECTING std::uint8_t{1 << 3} |
| 51 |
| 52 | namespace tgvoip |
| 53 | { |
| 54 |
| 55 | enum class Proxy |
| 56 | { |
| 57 | NONE = 0, |
| 58 | SOCKS5, |
| 59 | //HTTP, |
| 60 | }; |
| 61 |
| 62 | enum class State |
| 63 | { |
| 64 | WAIT_INIT = 1, |
| 65 | WAIT_INIT_ACK, |
| 66 | ESTABLISHED, |
| 67 | FAILED, |
| 68 | RECONNECTING, |
| 69 | }; |
| 70 |
| 71 | enum class Error |
| 72 | { |
| 73 | UNKNOWN = 0, |
| 74 | INCOMPATIBLE, |
| 75 | TIMEOUT, |
| 76 | AUDIO_IO, |
| 77 | PROXY, |
| 78 | }; |
| 79 |
| 80 | enum class PktType : std::uint8_t |
| 81 | { |
| 82 | INIT = 1, |
| 83 | INIT_ACK, |
| 84 | STREAM_STATE, |
| 85 | STREAM_DATA, |
| 86 | UPDATE_STREAMS, |
| 87 | PING, |
| 88 | PONG, |
| 89 | STREAM_DATA_X2, |
| 90 | STREAM_DATA_X3, |
| 91 | LAN_ENDPOINT, |
| 92 | NETWORK_CHANGED, |
| 93 | SWITCH_PREF_RELAY, |
| 94 | SWITCH_TO_P2P, |
| 95 | NOP, |
| 96 | // GROUP_CALL_KEY, // replaced with 'extra' in 2.1 (protocol v6) |
| 97 | // REQUEST_GROUP, |
| 98 | STREAM_EC, |
| 99 | }; |
| 100 |
| 101 | enum class ExtraType : std::uint8_t |
| 102 | { |
| 103 | STREAM_FLAGS = 1, |
| 104 | STREAM_CSD, |
| 105 | LAN_ENDPOINT, |
| 106 | NETWORK_CHANGED, |
| 107 | GROUP_CALL_KEY, |
| 108 | REQUEST_GROUP, |
| 109 | IPV6_ENDPOINT, |
| 110 | }; |
| 111 |
| 112 | enum class StreamType : std::uint8_t |
| 113 | { |
| 114 | AUDIO = 1, |
| 115 | VIDEO, |
| 116 | }; |
| 117 |
| 118 | enum class NetType |
| 119 | { |
| 120 | UNKNOWN = 0, |
| 121 | GPRS, |
| 122 | EDGE, |
| 123 | THREE_G, |
| 124 | HSPA, |
| 125 | LTE, |
| 126 | WIFI, |
| 127 | ETHERNET, |
| 128 | OTHER_HIGH_SPEED, |
| 129 | OTHER_LOW_SPEED, |
| 130 | DIALUP, |
| 131 | OTHER_MOBILE, |
| 132 | }; |
| 133 |
| 134 | enum class DataSaving |
| 135 | { |
| 136 | NEVER = 0, |
| 137 | MOBILE, |
| 138 | ALWAYS, |
| 139 | }; |
| 140 |
| 141 | enum class InitVideoRes : std::uint8_t |
| 142 | { |
| 143 | NONE = 0, |
| 144 | _240, |
| 145 | _360, |
| 146 | _480, |
| 147 | _720, |
| 148 | _1080, |
| 149 | _1440, |
| 150 | _4K, |
| 151 | }; |
| 152 |
| 153 | enum class VideoRotation : std::uint8_t |
| 154 | { |
| 155 | _0 = 0, |
| 156 | _90, |
| 157 | _180, |
| 158 | _270, |
| 159 | }; |
| 160 | #define VIDEO_ROTATION_MASK 3 |
| 161 |
| 162 | struct CryptoFunctions |
| 163 | { |
| 164 | void (*rand_bytes)(std::uint8_t* buffer, std::size_t length); |
| 165 | void (*sha1)(const std::uint8_t* msg, std::size_t length, std::uint8_t* output); |
| 166 | void (*sha256)(const std::uint8_t* msg, std::size_t length, std::uint8_t* output); |
| 167 | void (*aes_ige_encrypt)(const std::uint8_t* in, std::uint8_t* out, std::size_t length, const std::uint8_t* key, std::uint8_t* iv); |
| 168 | void (*aes_ige_decrypt)(const std::uint8_t* in, std::uint8_t* out, std::size_t length, const std::uint8_t* key, std::uint8_t* iv); |
| 169 | void (*aes_ctr_encrypt)(std::uint8_t* inout, std::size_t length, const std::uint8_t* key, std::uint8_t* iv, std::uint8_t* ecount, std::uint32_t* num); |
| 170 | void (*aes_cbc_encrypt)(const std::uint8_t* in, std::uint8_t* out, std::size_t length, const std::uint8_t* key, std::uint8_t* iv); |
| 171 | void (*aes_cbc_decrypt)(const std::uint8_t* in, std::uint8_t* out, std::size_t length, const std::uint8_t* key, std::uint8_t* iv); |
| 172 | }; |
| 173 |
| 174 | struct CellularCarrierInfo |
| 175 | { |
| 176 | std::string name; |
| 177 | std::string mcc; |
| 178 | std::string mnc; |
| 179 | std::string countryCode; |
| 180 | }; |
| 181 |
| 182 | class PacketSender; |
| 183 |
| 184 | namespace video |
| 185 | { |
| 186 |
| 187 | class VideoPacketSender; |
| 188 |
| 189 | } // namespace video |
| 190 |
| 191 | } // namespace tgvoip |
| 192 |
| 193 | #endif // VOIPCONTROLLERDECLARATIONS_H |
| 194 |