]> git.proxmox.com Git - mirror_frr.git/blame - ospfclient/ospf_apiclient.h
Merge pull request #12751 from Pdoijode/pdoijode/ospf-vrf-neighbor-detail-1
[mirror_frr.git] / ospfclient / ospf_apiclient.h
CommitLineData
acddc0ed 1// SPDX-License-Identifier: GPL-2.0-or-later
2d33f157 2/*
3 * Client side of OSPF API.
4 * Copyright (C) 2001, 2002, 2003 Ralph Keller
2d33f157 5 */
6
7#ifndef _OSPF_APICLIENT_H
8#define _OSPF_APICLIENT_H
9
2d33f157 10/* Structure for the OSPF API client */
d62a17ae 11struct ospf_apiclient {
12
13 /* Sockets for sync requests and async notifications */
14 int fd_sync;
15 int fd_async;
16
17 /* Pointer to callback functions */
d7c0a89a 18 void (*ready_notify)(uint8_t lsa_type, uint8_t opaque_type,
d62a17ae 19 struct in_addr addr);
20 void (*new_if)(struct in_addr ifaddr, struct in_addr area_id);
21 void (*del_if)(struct in_addr ifaddr);
22 void (*ism_change)(struct in_addr ifaddr, struct in_addr area_id,
d7c0a89a 23 uint8_t status);
d62a17ae 24 void (*nsm_change)(struct in_addr ifaddr, struct in_addr nbraddr,
d7c0a89a 25 struct in_addr router_id, uint8_t status);
d62a17ae 26 void (*update_notify)(struct in_addr ifaddr, struct in_addr area_id,
d7c0a89a 27 uint8_t self_origin, struct lsa_header *lsa);
d62a17ae 28 void (*delete_notify)(struct in_addr ifaddr, struct in_addr area_id,
d7c0a89a 29 uint8_t self_origin, struct lsa_header *lsa);
2d33f157 30};
31
32
33/* ---------------------------------------------------------
34 * API function prototypes.
35 * --------------------------------------------------------- */
36
37/* Open connection to OSPF daemon. Two ports will be allocated on
38 client, sync channel at syncport and reverse channel at syncport+1 */
d62a17ae 39struct ospf_apiclient *ospf_apiclient_connect(char *host, int syncport);
2d33f157 40
41/* Shutdown connection to OSPF daemon. */
d62a17ae 42int ospf_apiclient_close(struct ospf_apiclient *oclient);
2d33f157 43
44/* Synchronous request to register opaque type. */
d62a17ae 45int ospf_apiclient_register_opaque_type(struct ospf_apiclient *oclient,
d7c0a89a 46 uint8_t ltype, uint8_t otype);
2d33f157 47
48/* Synchronous request to register event mask. */
d62a17ae 49int ospf_apiclient_register_events(struct ospf_apiclient *oclient,
d7c0a89a 50 uint32_t mask);
2d33f157 51
52/* Register callback functions.*/
d62a17ae 53void ospf_apiclient_register_callback(
54 struct ospf_apiclient *oclient,
d7c0a89a 55 void (*ready_notify)(uint8_t lsa_type, uint8_t opaque_type,
d62a17ae 56 struct in_addr addr),
57 void (*new_if)(struct in_addr ifaddr, struct in_addr area_id),
58 void (*del_if)(struct in_addr ifaddr),
59 void (*ism_change)(struct in_addr ifaddr, struct in_addr area_id,
d7c0a89a 60 uint8_t status),
d62a17ae 61 void (*nsm_change)(struct in_addr ifaddr, struct in_addr nbraddr,
d7c0a89a 62 struct in_addr router_id, uint8_t status),
d62a17ae 63 void (*update_notify)(struct in_addr ifaddr, struct in_addr area_id,
d7c0a89a 64 uint8_t selforig, struct lsa_header *lsa),
d62a17ae 65 void (*delete_notify)(struct in_addr ifaddr, struct in_addr area_id,
d7c0a89a 66 uint8_t selforig, struct lsa_header *lsa));
2d33f157 67
68/* Synchronous request to synchronize LSDB. */
d62a17ae 69int ospf_apiclient_sync_lsdb(struct ospf_apiclient *oclient);
2d33f157 70
71/* Synchronous request to originate or update opaque LSA. */
d62a17ae 72int ospf_apiclient_lsa_originate(struct ospf_apiclient *oclient,
73 struct in_addr ifaddr, struct in_addr area_id,
d7c0a89a
QY
74 uint8_t lsa_type, uint8_t opaque_type,
75 uint32_t opaque_id, void *opaquedata,
d62a17ae 76 int opaquelen);
2d33f157 77
78
79/* Synchronous request to delete opaque LSA. Parameter opaque_id is in
80 host byte order */
d62a17ae 81int ospf_apiclient_lsa_delete(struct ospf_apiclient *oclient,
08172828 82 struct in_addr addr, uint8_t lsa_type,
2f30cb25
LB
83 uint8_t opaque_type, uint32_t opaque_id,
84 uint8_t flags);
2d33f157 85
86/* Fetch async message and handle it */
d62a17ae 87int ospf_apiclient_handle_async(struct ospf_apiclient *oclient);
2d33f157 88
89#endif /* _OSPF_APICLIENT_H */