2014-08-21 18:02:43 -04:00
|
|
|
/*
|
|
|
|
This file is part of tgl-library
|
2013-10-23 10:26:17 -04:00
|
|
|
|
2014-08-21 18:02:43 -04:00
|
|
|
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.
|
2013-10-23 10:26:17 -04:00
|
|
|
|
2014-08-21 18:02:43 -04:00
|
|
|
This library is distributed in the hope that it will be useful,
|
2013-10-23 10:26:17 -04:00
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2014-08-21 18:02:43 -04:00
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
2013-10-23 10:26:17 -04:00
|
|
|
|
2014-08-21 18:02:43 -04:00
|
|
|
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
|
2013-10-23 10:26:17 -04:00
|
|
|
|
|
|
|
Copyright Nikolay Durov, Andrey Lopatin 2012-2013
|
2014-08-21 18:02:43 -04:00
|
|
|
Vitaly Valtman 2013-2014
|
2013-10-23 10:26:17 -04:00
|
|
|
*/
|
2013-10-11 16:52:20 -04:00
|
|
|
#ifndef __MTPROTO_CLIENT_H__
|
|
|
|
#define __MTPROTO_CLIENT_H__
|
2014-08-14 14:03:33 -04:00
|
|
|
//#include "net.h"
|
2013-12-23 06:10:53 -05:00
|
|
|
#include <openssl/bn.h>
|
2014-08-14 14:03:33 -04:00
|
|
|
//void on_start (void);
|
|
|
|
//..long long encrypt_send_message (struct connection *c, int *msg, int msg_ints, int useful);
|
2014-08-20 23:24:52 -04:00
|
|
|
//void dc_authorize (struct tgl_dc *DC);
|
2014-08-14 14:03:33 -04:00
|
|
|
//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);
|
|
|
|
|
2014-08-20 23:24:52 -04:00
|
|
|
#include "tgl.h"
|
|
|
|
|
2014-08-14 14:03:33 -04:00
|
|
|
struct connection;
|
2014-08-20 23:24:52 -04:00
|
|
|
struct tgl_dc;
|
2014-08-14 14:03:33 -04:00
|
|
|
//#include "queries.h"
|
|
|
|
#define TG_APP_HASH "36722c72256a24c1225de00eb6a1ca74"
|
|
|
|
#define TG_APP_ID 2899
|
|
|
|
|
|
|
|
#define ACK_TIMEOUT 1
|
|
|
|
#define MAX_DC_ID 10
|
|
|
|
|
|
|
|
struct connection;
|
|
|
|
|
2014-08-29 09:33:15 -04:00
|
|
|
long long tglmp_encrypt_send_message (struct connection *c, int *msg, int msg_ints, int flags);
|
2014-08-20 23:24:52 -04:00
|
|
|
void tglmp_dc_create_session (struct tgl_dc *DC);
|
2014-08-14 14:03:33 -04:00
|
|
|
int tglmp_check_g (unsigned char p[256], BIGNUM *g);
|
|
|
|
int tglmp_check_DH_params (BIGNUM *p, int g);
|
2014-08-20 23:24:52 -04:00
|
|
|
struct tgl_dc *tglmp_alloc_dc (int id, char *ip, int port);
|
2014-08-29 09:33:15 -04:00
|
|
|
void tglmp_regenerate_temp_auth_key (struct tgl_dc *D);
|
2014-08-14 14:03:33 -04:00
|
|
|
|
2014-08-20 23:24:52 -04:00
|
|
|
void tgln_insert_msg_id (struct tgl_session *S, long long id);
|
2014-08-21 18:02:43 -04:00
|
|
|
void tglmp_on_start (void);
|
2014-08-20 23:24:52 -04:00
|
|
|
void tgl_dc_authorize (struct tgl_dc *DC);
|
2014-09-23 08:58:49 -04:00
|
|
|
void tgls_free_dc (struct tgl_dc *DC);
|
2014-09-23 09:18:42 -04:00
|
|
|
void tgls_free_pubkey (void);
|
2013-10-11 16:52:20 -04:00
|
|
|
#endif
|