]> git.proxmox.com Git - mirror_frr.git/blob - pceplib/pcep_pcc_api.h
doc: Add `show ipv6 rpf X:X::X:X` command to docs
[mirror_frr.git] / pceplib / pcep_pcc_api.h
1 /*
2 * This file is part of the PCEPlib, a PCEP protocol library.
3 *
4 * Copyright (C) 2020 Volta Networks https://voltanet.io/
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library 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 GNU
14 * Lesser 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 * Author : Brady Johnson <brady@voltanet.io>
20 *
21 */
22
23
24 /*
25 * Public PCEPlib PCC API
26 */
27
28 #ifndef PCEPPCC_INCLUDE_PCEPPCCAPI_H_
29 #define PCEPPCC_INCLUDE_PCEPPCCAPI_H_
30
31 #include <stdbool.h>
32
33 #include "pcep_session_logic.h"
34 #include "pcep_timers.h"
35
36 #define DEFAULT_PCEP_TCP_PORT 4189
37 #define DEFAULT_CONFIG_KEEP_ALIVE 30
38 #define DEFAULT_CONFIG_DEAD_TIMER DEFAULT_CONFIG_KEEP_ALIVE * 4
39 #define DEFAULT_CONFIG_REQUEST_TIME 30
40 #define DEFAULT_CONFIG_MAX_UNKNOWN_REQUESTS 5
41 #define DEFAULT_CONFIG_MAX_UNKNOWN_MESSAGES 5
42 #define DEFAULT_TCP_CONNECT_TIMEOUT_MILLIS 250
43
44 /* Acceptable MIN and MAX values used in deciding if the PCEP
45 * Open received from a PCE should be accepted or rejected. */
46 #define DEFAULT_MIN_CONFIG_KEEP_ALIVE 5
47 #define DEFAULT_MAX_CONFIG_KEEP_ALIVE 120
48 #define DEFAULT_MIN_CONFIG_DEAD_TIMER DEFAULT_MIN_CONFIG_KEEP_ALIVE * 4
49 #define DEFAULT_MAX_CONFIG_DEAD_TIMER DEFAULT_MAX_CONFIG_KEEP_ALIVE * 4
50
51 /*
52 * PCEP PCC library initialization/teardown functions
53 */
54
55 /* Later when this is integrated with FRR pathd, it will be changed
56 * to just initialize_pcc(struct pceplib_infra_config *infra_config) */
57 bool initialize_pcc(void);
58 bool initialize_pcc_infra(struct pceplib_infra_config *infra_config);
59 /* this function is blocking */
60 bool initialize_pcc_wait_for_completion(void);
61 bool destroy_pcc(void);
62
63
64 /*
65 * PCEP session functions
66 */
67
68 pcep_configuration *create_default_pcep_configuration(void);
69 void destroy_pcep_configuration(pcep_configuration *config);
70
71 /* Uses the standard PCEP TCP src and dest port = 4189.
72 * To use a specific dest or src port, set them other than 0 in the
73 * pcep_configuration. If src_ip is not set, INADDR_ANY will be used. */
74 pcep_session *connect_pce(pcep_configuration *config, struct in_addr *pce_ip);
75 pcep_session *connect_pce_ipv6(pcep_configuration *config,
76 struct in6_addr *pce_ip);
77 void disconnect_pce(pcep_session *session);
78 void send_message(pcep_session *session, struct pcep_message *msg,
79 bool free_after_send);
80
81 void dump_pcep_session_counters(pcep_session *session);
82 void reset_pcep_session_counters(pcep_session *session);
83
84 /*
85 * Event Queue functions
86 */
87
88 /* Returns true if the queue is empty, false otherwise */
89 bool event_queue_is_empty(void);
90
91 /* Return the number of events on the queue, 0 if empty */
92 uint32_t event_queue_num_events_available(void);
93
94 /* Return the next event on the queue, NULL if empty */
95 struct pcep_event *event_queue_get_event(void);
96
97 /* Free the PCEP Event resources, including the PCEP message */
98 void destroy_pcep_event(struct pcep_event *event);
99
100 const char *get_event_type_str(int event_type);
101
102
103 #endif /* PCEPPCC_INCLUDE_PCEPPCCAPI_H_ */