]>
git.proxmox.com Git - mirror_frr.git/blob - ospfclient/ospf_apiclient.h
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Client side of OSPF API.
4 * Copyright (C) 2001, 2002, 2003 Ralph Keller
7 #ifndef _OSPF_APICLIENT_H
8 #define _OSPF_APICLIENT_H
10 /* Structure for the OSPF API client */
11 struct ospf_apiclient
{
13 /* Sockets for sync requests and async notifications */
17 /* Pointer to callback functions */
18 void (*ready_notify
)(uint8_t lsa_type
, uint8_t opaque_type
,
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
,
24 void (*nsm_change
)(struct in_addr ifaddr
, struct in_addr nbraddr
,
25 struct in_addr router_id
, uint8_t status
);
26 void (*update_notify
)(struct in_addr ifaddr
, struct in_addr area_id
,
27 uint8_t self_origin
, struct lsa_header
*lsa
);
28 void (*delete_notify
)(struct in_addr ifaddr
, struct in_addr area_id
,
29 uint8_t self_origin
, struct lsa_header
*lsa
);
33 /* ---------------------------------------------------------
34 * API function prototypes.
35 * --------------------------------------------------------- */
37 /* Open connection to OSPF daemon. Two ports will be allocated on
38 client, sync channel at syncport and reverse channel at syncport+1 */
39 struct ospf_apiclient
*ospf_apiclient_connect(char *host
, int syncport
);
41 /* Shutdown connection to OSPF daemon. */
42 int ospf_apiclient_close(struct ospf_apiclient
*oclient
);
44 /* Synchronous request to register opaque type. */
45 int ospf_apiclient_register_opaque_type(struct ospf_apiclient
*oclient
,
46 uint8_t ltype
, uint8_t otype
);
48 /* Synchronous request to register event mask. */
49 int ospf_apiclient_register_events(struct ospf_apiclient
*oclient
,
52 /* Register callback functions.*/
53 void ospf_apiclient_register_callback(
54 struct ospf_apiclient
*oclient
,
55 void (*ready_notify
)(uint8_t lsa_type
, uint8_t opaque_type
,
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
,
61 void (*nsm_change
)(struct in_addr ifaddr
, struct in_addr nbraddr
,
62 struct in_addr router_id
, uint8_t status
),
63 void (*update_notify
)(struct in_addr ifaddr
, struct in_addr area_id
,
64 uint8_t selforig
, struct lsa_header
*lsa
),
65 void (*delete_notify
)(struct in_addr ifaddr
, struct in_addr area_id
,
66 uint8_t selforig
, struct lsa_header
*lsa
));
68 /* Synchronous request to synchronize LSDB. */
69 int ospf_apiclient_sync_lsdb(struct ospf_apiclient
*oclient
);
71 /* Synchronous request to originate or update opaque LSA. */
72 int ospf_apiclient_lsa_originate(struct ospf_apiclient
*oclient
,
73 struct in_addr ifaddr
, struct in_addr area_id
,
74 uint8_t lsa_type
, uint8_t opaque_type
,
75 uint32_t opaque_id
, void *opaquedata
,
79 /* Synchronous request to delete opaque LSA. Parameter opaque_id is in
81 int ospf_apiclient_lsa_delete(struct ospf_apiclient
*oclient
,
82 struct in_addr addr
, uint8_t lsa_type
,
83 uint8_t opaque_type
, uint32_t opaque_id
,
86 /* Fetch async message and handle it */
87 int ospf_apiclient_handle_async(struct ospf_apiclient
*oclient
);
89 #endif /* _OSPF_APICLIENT_H */