]>
git.proxmox.com Git - mirror_frr.git/blob - pceplib/pcep_pcc_api.h
2 * This file is part of the PCEPlib, a PCEP protocol library.
4 * Copyright (C) 2020 Volta Networks https://voltanet.io/
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.
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.
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/>.
19 * Author : Brady Johnson <brady@voltanet.io>
25 * Public PCEPlib PCC API
28 #ifndef PCEPPCC_INCLUDE_PCEPPCCAPI_H_
29 #define PCEPPCC_INCLUDE_PCEPPCCAPI_H_
33 #include "pcep_session_logic.h"
34 #include "pcep_timers.h"
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
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
52 * PCEP PCC library initialization/teardown functions
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);
65 * PCEP session functions
68 pcep_configuration
*create_default_pcep_configuration(void);
69 void destroy_pcep_configuration(pcep_configuration
*config
);
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
);
81 void dump_pcep_session_counters(pcep_session
*session
);
82 void reset_pcep_session_counters(pcep_session
*session
);
85 * Event Queue functions
88 /* Returns true if the queue is empty, false otherwise */
89 bool event_queue_is_empty(void);
91 /* Return the number of events on the queue, 0 if empty */
92 uint32_t event_queue_num_events_available(void);
94 /* Return the next event on the queue, NULL if empty */
95 struct pcep_event
*event_queue_get_event(void);
97 /* Free the PCEP Event resources, including the PCEP message */
98 void destroy_pcep_event(struct pcep_event
*event
);
100 const char *get_event_type_str(int event_type
);
103 #endif /* PCEPPCC_INCLUDE_PCEPPCCAPI_H_ */