]>
git.proxmox.com Git - mirror_frr.git/blob - ospfclient/ospf_apiclient.h
2 * Client side of OSPF API.
3 * Copyright (C) 2001, 2002, 2003 Ralph Keller
5 * This file is part of GNU Zebra.
7 * GNU Zebra is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published
9 * by the Free Software Foundation; either version 2, or (at your
10 * option) any later version.
12 * GNU Zebra is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; see the file COPYING; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #ifndef _OSPF_APICLIENT_H
23 #define _OSPF_APICLIENT_H
25 /* Structure for the OSPF API client */
26 struct ospf_apiclient
{
28 /* Sockets for sync requests and async notifications */
32 /* Pointer to callback functions */
33 void (*ready_notify
)(uint8_t lsa_type
, uint8_t opaque_type
,
35 void (*new_if
)(struct in_addr ifaddr
, struct in_addr area_id
);
36 void (*del_if
)(struct in_addr ifaddr
);
37 void (*ism_change
)(struct in_addr ifaddr
, struct in_addr area_id
,
39 void (*nsm_change
)(struct in_addr ifaddr
, struct in_addr nbraddr
,
40 struct in_addr router_id
, uint8_t status
);
41 void (*update_notify
)(struct in_addr ifaddr
, struct in_addr area_id
,
42 uint8_t self_origin
, struct lsa_header
*lsa
);
43 void (*delete_notify
)(struct in_addr ifaddr
, struct in_addr area_id
,
44 uint8_t self_origin
, struct lsa_header
*lsa
);
48 /* ---------------------------------------------------------
49 * API function prototypes.
50 * --------------------------------------------------------- */
52 /* Open connection to OSPF daemon. Two ports will be allocated on
53 client, sync channel at syncport and reverse channel at syncport+1 */
54 struct ospf_apiclient
*ospf_apiclient_connect(char *host
, int syncport
);
56 /* Shutdown connection to OSPF daemon. */
57 int ospf_apiclient_close(struct ospf_apiclient
*oclient
);
59 /* Synchronous request to register opaque type. */
60 int ospf_apiclient_register_opaque_type(struct ospf_apiclient
*oclient
,
61 uint8_t ltype
, uint8_t otype
);
63 /* Synchronous request to register event mask. */
64 int ospf_apiclient_register_events(struct ospf_apiclient
*oclient
,
67 /* Register callback functions.*/
68 void ospf_apiclient_register_callback(
69 struct ospf_apiclient
*oclient
,
70 void (*ready_notify
)(uint8_t lsa_type
, uint8_t opaque_type
,
72 void (*new_if
)(struct in_addr ifaddr
, struct in_addr area_id
),
73 void (*del_if
)(struct in_addr ifaddr
),
74 void (*ism_change
)(struct in_addr ifaddr
, struct in_addr area_id
,
76 void (*nsm_change
)(struct in_addr ifaddr
, struct in_addr nbraddr
,
77 struct in_addr router_id
, uint8_t status
),
78 void (*update_notify
)(struct in_addr ifaddr
, struct in_addr area_id
,
79 uint8_t selforig
, struct lsa_header
*lsa
),
80 void (*delete_notify
)(struct in_addr ifaddr
, struct in_addr area_id
,
81 uint8_t selforig
, struct lsa_header
*lsa
));
83 /* Synchronous request to synchronize LSDB. */
84 int ospf_apiclient_sync_lsdb(struct ospf_apiclient
*oclient
);
86 /* Synchronous request to originate or update opaque LSA. */
87 int ospf_apiclient_lsa_originate(struct ospf_apiclient
*oclient
,
88 struct in_addr ifaddr
, struct in_addr area_id
,
89 uint8_t lsa_type
, uint8_t opaque_type
,
90 uint32_t opaque_id
, void *opaquedata
,
94 /* Synchronous request to delete opaque LSA. Parameter opaque_id is in
96 int ospf_apiclient_lsa_delete(struct ospf_apiclient
*oclient
,
97 struct in_addr addr
, uint8_t lsa_type
,
98 uint8_t opaque_type
, uint32_t opaque_id
,
101 /* Fetch async message and handle it */
102 int ospf_apiclient_handle_async(struct ospf_apiclient
*oclient
);
104 #endif /* _OSPF_APICLIENT_H */