]>
Commit | Line | Data |
---|---|---|
68cae740 MB |
1 | /* |
2 | * This file is part of the nqptp distribution (https://github.com/mikebrady/nqptp). | |
1c610279 | 3 | * Copyright (c) 2021-2022 Mike Brady. |
68cae740 MB |
4 | * |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, version 2. | |
8 | * | |
9 | * This program is distributed in the hope that it will be useful, but | |
10 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | * General Public License for more details. | |
13 | * | |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | * | |
17 | * Commercial licensing is also available. | |
18 | */ | |
19 | ||
20 | #ifndef NQPTP_UTILITIES_H | |
21 | #define NQPTP_UTILITIES_H | |
01fa06a8 | 22 | |
4d699581 | 23 | #include "nqptp.h" |
01fa06a8 MB |
24 | #include <inttypes.h> |
25 | #include <pthread.h> | |
26 | ||
68cae740 MB |
27 | // functions that are specific to NQPTP |
28 | // general stuff should go in the general-utilities | |
29 | ||
82e5414e | 30 | typedef struct { |
4d699581 MB |
31 | int number; |
32 | uint16_t port; | |
65fea24b | 33 | int family; // AF_INET or AF_INET6 |
4d699581 MB |
34 | } socket_info; |
35 | ||
36 | typedef struct { | |
37 | unsigned int sockets_open; // also doubles as where to put next one, as sockets are never closed. | |
38 | socket_info sockets[MAX_OPEN_SOCKETS]; | |
39 | } sockets_open_bundle; | |
40 | ||
090ca128 | 41 | void open_sockets_at_port(const char *node, uint16_t port, sockets_open_bundle *sockets_open_stuff); |
68cae740 | 42 | void debug_print_buffer(int level, char *buf, size_t buf_len); |
03de7ac0 | 43 | uint64_t get_self_clock_id(); // a clock ID based on a MAC address |
68cae740 | 44 | #endif |