| 1 | /* |
| 2 | This file is part of Mtproto-proxy Library. |
| 3 | |
| 4 | Mtproto-proxy Library is free software: you can redistribute it and/or modify |
| 5 | it under the terms of the GNU Lesser General Public License as published by |
| 6 | the Free Software Foundation, either version 2 of the License, or |
| 7 | (at your option) any later version. |
| 8 | |
| 9 | Mtproto-proxy Library is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | GNU Lesser General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU Lesser General Public License |
| 15 | along with Mtproto-proxy Library. If not, see <http://www.gnu.org/licenses/>. |
| 16 | |
| 17 | Copyright 2012-2013 Vkontakte Ltd |
| 18 | 2012-2013 Nikolai Durov |
| 19 | 2012-2013 Andrey Lopatin |
| 20 | 2012-2013 Vitaliy Valtman |
| 21 | |
| 22 | Copyright 2014 Telegram Messenger Inc |
| 23 | 2014 Vitaly Valtman |
| 24 | */ |
| 25 | |
| 26 | #pragma once |
| 27 | |
| 28 | #define TL_STAT 0x9d56e6b2 |
| 29 | |
| 30 | |
| 31 | #define RPC_INVOKE_REQ 0x2374df3d |
| 32 | #define RPC_INVOKE_KPHP_REQ 0x99a37fda |
| 33 | #define RPC_REQ_RUNNING 0x346d5efa |
| 34 | #define RPC_REQ_ERROR 0x7ae432f5 |
| 35 | #define RPC_REQ_RESULT 0x63aeda4e |
| 36 | #define RPC_READY 0x6a34cac7 |
| 37 | #define RPC_STOP_READY 0x59d86654 |
| 38 | #define RPC_SEND_SESSION_MSG 0x1ed5a3cc |
| 39 | #define RPC_RESPONSE_INDIRECT 0x2194f56e |
| 40 | #define RPC_PING 0x5730a2df |
| 41 | #define RPC_PONG 0x8430eaa7 |
| 42 | |
| 43 | |
| 44 | #define RPC_DEST_ACTOR 0x7568aabd |
| 45 | #define RPC_DEST_ACTOR_FLAGS 0xf0a5acf7 |
| 46 | #define RPC_DEST_FLAGS 0xe352035e |
| 47 | #define RPC_REQ_RESULT_FLAGS 0x8cc84ce1 |
| 48 | |
| 49 | #define MAX_TL_STRING_LENGTH 0xffffff |
| 50 | |
| 51 | #define TL_ERROR_RETRY 503 |
| 52 | |
| 53 | #define TL_BOOL_TRUE 0x997275b5 |
| 54 | #define TL_BOOL_FALSE 0xbc799737 |
| 55 | |
| 56 | #define TL_BOOL_STAT 0x92cbcbfa |
| 57 | |
| 58 | #define TL_TRUE 0x3fedd339 |
| 59 | |
| 60 | #define TL_INT 0xa8509bda |
| 61 | #define TL_LONG 0x22076cba |
| 62 | #define TL_DOUBLE 0x2210c154 |
| 63 | #define TL_STRING 0xb5286e24 |
| 64 | |
| 65 | #define TL_MAYBE_TRUE 0x3f9c8ef8 |
| 66 | #define TL_MAYBE_FALSE 0x27930a7b |
| 67 | |
| 68 | #define TL_VECTOR 0x1cb5c415 |
| 69 | #define TL_VECTOR_TOTAL 0x10133f47 |
| 70 | #define TL_TUPLE 0x9770768a |
| 71 | |
| 72 | #define TL_DICTIONARY 0x1f4c618f |
| 73 | |
| 74 | // |
| 75 | // Error codes |
| 76 | // |
| 77 | |
| 78 | // |
| 79 | // Query syntax errors -1000...-1999 |
| 80 | // |
| 81 | |
| 82 | #define TL_ERROR_SYNTAX -1000 |
| 83 | #define -1001 |
| 84 | #define -1002 |
| 85 | #define TL_ERROR_WRONG_QUERY_ID -1003 |
| 86 | #define TL_ERROR_NOT_ENOUGH_DATA -1004 |
| 87 | |
| 88 | // |
| 89 | // Syntax ok, bad can not start query. -2000...-2999 |
| 90 | // |
| 91 | #define TL_ERROR_UNKNOWN_FUNCTION_ID -2000 |
| 92 | #define TL_ERROR_PROXY_NO_TARGET -2001 |
| 93 | #define TL_ERROR_WRONG_ACTOR_ID -2002 |
| 94 | #define TL_ERROR_TOO_LONG_STRING -2003 |
| 95 | #define TL_ERROR_VALUE_NOT_IN_RANGE -2004 |
| 96 | #define TL_ERROR_QUERY_INCORRECT -2005 |
| 97 | #define TL_ERROR_BAD_VALUE -2006 |
| 98 | #define TL_ERROR_BINLOG_DISABLED -2007 |
| 99 | #define TL_ERROR_FEATURE_DISABLED -2008 |
| 100 | #define TL_ERROR_QUERY_IS_EMPTY -2009 |
| 101 | #define TL_ERROR_INVALID_CONNECTION_ID -2010 |
| 102 | #define TL_ERROR_WRONG_SPLIT -2011 |
| 103 | #define TL_ERROR_TOO_BIG_OFFSET -2012 |
| 104 | |
| 105 | // |
| 106 | // Error processing query -3000...-3999 |
| 107 | // |
| 108 | #define TL_ERROR_QUERY_TIMEOUT -3000 |
| 109 | #define TL_ERROR_PROXY_INVALID_RESPONSE -3001 |
| 110 | #define TL_ERROR_NO_CONNECTIONS -3002 |
| 111 | #define TL_ERROR_INTERNAL -3003 |
| 112 | #define TL_ERROR_AIO_FAIL -3004 |
| 113 | #define TL_ERROR_AIO_TIMEOUT -3005 |
| 114 | #define TL_ERROR_BINLOG_WAIT_TIMEOUT -3006 |
| 115 | #define TL_ERROR_AIO_MAX_RETRY_EXCEEDED -3007 |
| 116 | #define TL_ERROR_TTL -3008 |
| 117 | #define TL_ERROR_BAD_METAFILE -3009 |
| 118 | #define TL_ERROR_NOT_READY -3010 |
| 119 | |
| 120 | #define TL_ERROR_STORAGE_CACHE_MISS -3500 |
| 121 | #define TL_ERROR_STORAGE_CACHE_NO_MTPROTO_CONN -3501 |
| 122 | |
| 123 | // |
| 124 | // Different errors -4000...-4999 |
| 125 | // |
| 126 | #define TL_ERROR_UNKNOWN -4000 |
| 127 | |
| 128 | #define TL_IS_USER_ERROR(x) ((x) <= -1000 && (x) > -3000) |
| 129 | |
| 130 | #define TL_NAMESPACE TL_ |
| 131 | |
| 132 | #define CONCAT(a,b) a ## b |
| 133 | #define TLN(nspc,name) CONCAT (nspc, name) |
| 134 | #define TLG(name) TL_ ## name |
| 135 | #define TL(x) TLN (TL_NAMESPACE, x) |
| 136 | |