TRIP Routing Daemon
TRIP (RFC 3219) Location Server Implementation
Loading...
Searching...
No Matches
locator.h
Go to the documentation of this file.
1/*
2
3 trip: Modern TRIP LS implementation
4 Copyright (C) 2025 arf20 (Ángel Ruiz Fernandez)
5
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <https://www.gnu.org/licenses/>.
18
19*/
20
26
27#ifndef _LOCATOR_H
28#define _LOCATOR_H
29
30#include <protocol/protocol.h>
31
32#include <netinet/in.h>
33
34
36typedef struct {
37 struct sockaddr_in6 addr;
38
39 uint32_t itad;
40 capinfo_transmode_t transmode;
41
42 /* timers */
43 uint16_t hold;
44} peer_t;
45
47typedef struct {
48 peer_t *peers;
49 size_t peers_size, peers_capacity;
50} locator_t;
51
52
55
57const peer_t *locator_add(locator_t *locator, const struct sockaddr_in6 *addr,
58 uint32_t itad, uint16_t hold, capinfo_transmode_t transmode);
59
61const peer_t *locator_lookup(locator_t *locator,
62 const struct sockaddr_in6 *addr);
63
65void locator_destroy(locator_t *locator);
66
67
68#endif /* _LOCATOR_H */
69
const peer_t * locator_lookup(locator_t *locator, const struct sockaddr_in6 *addr)
Lookup peer by its address.
Definition locator.c:66
const peer_t * locator_add(locator_t *locator, const struct sockaddr_in6 *addr, uint32_t itad, uint16_t hold, capinfo_transmode_t transmode)
Add a known peer.
Definition locator.c:47
void locator_destroy(locator_t *locator)
Destroy locator object.
Definition locator.c:85
locator_t * locator_new()
Initialize singleton locator known peer list.
Definition locator.c:37
Protocol definition header.
uint32_t capinfo_transmode_t
Capability information transmission mode.
Definition protocol.h:124
Peer locator.
Definition locator.h:47
Known peer info object.
Definition locator.h:36