mtproto-client.h 2.09 KB
Newer Older
1 2
/* 
    This file is part of tgl-library
3

4 5 6 7
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
8

9
    This library is distributed in the hope that it will be useful,
10
    but WITHOUT ANY WARRANTY; without even the implied warranty of
11 12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.
13

14 15 16
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
17 18

    Copyright Nikolay Durov, Andrey Lopatin 2012-2013
19
              Vitaly Valtman 2013-2014
20
*/
Vysheng's avatar
Vysheng committed
21 22
#ifndef __MTPROTO_CLIENT_H__
#define __MTPROTO_CLIENT_H__
Vysheng's avatar
Vysheng committed
23
//#include "net.h"
Vysheng's avatar
Vysheng committed
24
#include <openssl/bn.h>
Vysheng's avatar
Vysheng committed
25 26
//void on_start (void);
//..long long encrypt_send_message (struct connection *c, int *msg, int msg_ints, int useful);
vvaltman's avatar
vvaltman committed
27
//void dc_authorize (struct tgl_dc *DC);
Vysheng's avatar
Vysheng committed
28 29 30 31 32 33 34
//void work_update (struct connection *c, long long msg_id);
//void work_update_binlog (void);
//int check_g (unsigned char p[256], BIGNUM *g);
//int check_g_bn (BIGNUM *p, BIGNUM *g);
//int check_DH_params (BIGNUM *p, int g);
//void secure_random (void *s, int l);

vvaltman's avatar
vvaltman committed
35 36
#include "tgl.h"

Vysheng's avatar
Vysheng committed
37
struct connection;
vvaltman's avatar
vvaltman committed
38
struct tgl_dc;
Vysheng's avatar
Vysheng committed
39 40 41 42 43 44 45 46 47
//#include "queries.h"
#define TG_APP_HASH "36722c72256a24c1225de00eb6a1ca74"
#define TG_APP_ID 2899

#define ACK_TIMEOUT 1
#define MAX_DC_ID 10

struct connection;

48
long long tglmp_encrypt_send_message (struct connection *c, int *msg, int msg_ints, int flags);
vvaltman's avatar
vvaltman committed
49
void tglmp_dc_create_session (struct tgl_dc *DC);
Vysheng's avatar
Vysheng committed
50 51
int tglmp_check_g (unsigned char p[256], BIGNUM *g);
int tglmp_check_DH_params (BIGNUM *p, int g);
vvaltman's avatar
vvaltman committed
52
struct tgl_dc *tglmp_alloc_dc (int id, char *ip, int port);
53
void tglmp_regenerate_temp_auth_key (struct tgl_dc *D);
Vysheng's avatar
Vysheng committed
54

vvaltman's avatar
vvaltman committed
55
void tgln_insert_msg_id (struct tgl_session *S, long long id);
56
void tglmp_on_start (void);
vvaltman's avatar
vvaltman committed
57
void tgl_dc_authorize (struct tgl_dc *DC);
Vysheng's avatar
Vysheng committed
58
#endif