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