| 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 2011-2013 Vkontakte Ltd |
| 18 | 2011-2013 Nikolai Durov |
| 19 | 2011-2013 Andrey Lopatin |
| 20 | |
| 21 | Copyright 2014 Telegram Messenger Inc |
| 22 | 2014 Vitaly Valtman |
| 23 | */ |
| 24 | |
| 25 | #pragma once |
| 26 | |
| 27 | #pragma pack(push,4) |
| 28 | |
| 29 | struct process_id { |
| 30 | unsigned ip; |
| 31 | short port; |
| 32 | unsigned short pid; |
| 33 | int utime; |
| 34 | }; |
| 35 | |
| 36 | struct process_id_ext { |
| 37 | unsigned ip; |
| 38 | short port; |
| 39 | unsigned short pid; |
| 40 | int utime; |
| 41 | int actor_id; |
| 42 | }; |
| 43 | |
| 44 | #pragma pack(pop) |
| 45 | |
| 46 | typedef struct process_id npid_t; |
| 47 | typedef struct process_id_ext npidx_t; |
| 48 | |
| 49 | extern npid_t PID; |
| 50 | |
| 51 | void init_common_PID (void); |
| 52 | void init_client_PID (unsigned ip); |
| 53 | void init_server_PID (unsigned ip, int port); |
| 54 | |
| 55 | /* returns 1 if X is a special case of Y, 2 if they match completely */ |
| 56 | int matches_pid (struct process_id *X, struct process_id *Y); |
| 57 | |
| 58 | int process_id_is_newer (struct process_id *a, struct process_id *b); |
| 59 | |