]>
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
18 * along with GNU Zebra; see the file COPYING. If not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
23 #ifndef _OSPF_APICLIENT_H
24 #define _OSPF_APICLIENT_H
26 /* Structure for the OSPF API client */
27 struct ospf_apiclient
{
29 /* Sockets for sync requests and async notifications */
33 /* Pointer to callback functions */
34 void (*ready_notify
)(u_char lsa_type
, u_char opaque_type
,
36 void (*new_if
)(struct in_addr ifaddr
, struct in_addr area_id
);
37 void (*del_if
)(struct in_addr ifaddr
);
38 void (*ism_change
)(struct in_addr ifaddr
, struct in_addr area_id
,
40 void (*nsm_change
)(struct in_addr ifaddr
, struct in_addr nbraddr
,
41 struct in_addr router_id
, u_char status
);
42 void (*update_notify
)(struct in_addr ifaddr
, struct in_addr area_id
,
43 u_char self_origin
, struct lsa_header
*lsa
);
44 void (*delete_notify
)(struct in_addr ifaddr
, struct in_addr area_id
,
45 u_char self_origin
, struct lsa_header
*lsa
);
49 /* ---------------------------------------------------------
50 * API function prototypes.
51 * --------------------------------------------------------- */
53 /* Open connection to OSPF daemon. Two ports will be allocated on
54 client, sync channel at syncport and reverse channel at syncport+1 */
55 struct ospf_apiclient
*ospf_apiclient_connect(char *host
, int syncport
);
57 /* Shutdown connection to OSPF daemon. */
58 int ospf_apiclient_close(struct ospf_apiclient
*oclient
);
60 /* Synchronous request to register opaque type. */
61 int ospf_apiclient_register_opaque_type(struct ospf_apiclient
*oclient
,
62 u_char ltype
, u_char otype
);
64 /* Synchronous request to register event mask. */
65 int ospf_apiclient_register_events(struct ospf_apiclient
*oclient
,
68 /* Register callback functions.*/
69 void ospf_apiclient_register_callback(
70 struct ospf_apiclient
*oclient
,
71 void (*ready_notify
)(u_char lsa_type
, u_char opaque_type
,
73 void (*new_if
)(struct in_addr ifaddr
, struct in_addr area_id
),
74 void (*del_if
)(struct in_addr ifaddr
),
75 void (*ism_change
)(struct in_addr ifaddr
, struct in_addr area_id
,
77 void (*nsm_change
)(struct in_addr ifaddr
, struct in_addr nbraddr
,
78 struct in_addr router_id
, u_char status
),
79 void (*update_notify
)(struct in_addr ifaddr
, struct in_addr area_id
,
80 u_char selforig
, struct lsa_header
*lsa
),
81 void (*delete_notify
)(struct in_addr ifaddr
, struct in_addr area_id
,
82 u_char selforig
, struct lsa_header
*lsa
));
84 /* Synchronous request to synchronize LSDB. */
85 int ospf_apiclient_sync_lsdb(struct ospf_apiclient
*oclient
);
87 /* Synchronous request to originate or update opaque LSA. */
88 int ospf_apiclient_lsa_originate(struct ospf_apiclient
*oclient
,
89 struct in_addr ifaddr
, struct in_addr area_id
,
90 u_char lsa_type
, u_char opaque_type
,
91 u_int32_t opaque_id
, void *opaquedata
,
95 /* Synchronous request to delete opaque LSA. Parameter opaque_id is in
97 int ospf_apiclient_lsa_delete(struct ospf_apiclient
*oclient
,
98 struct in_addr area_id
, u_char lsa_type
,
99 u_char opaque_type
, u_int32_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 */