]>
Commit | Line | Data |
---|---|---|
2d33f157 | 1 | /* |
2 | * Client side of OSPF API. | |
3 | * Copyright (C) 2001, 2002, 2003 Ralph Keller | |
4 | * | |
5 | * This file is part of GNU Zebra. | |
896014f4 | 6 | * |
2d33f157 | 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. | |
11 | * | |
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. | |
16 | * | |
896014f4 DL |
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 | |
2d33f157 | 20 | */ |
21 | ||
22 | #ifndef _OSPF_APICLIENT_H | |
23 | #define _OSPF_APICLIENT_H | |
24 | ||
2d33f157 | 25 | /* Structure for the OSPF API client */ |
d62a17ae | 26 | struct ospf_apiclient { |
27 | ||
28 | /* Sockets for sync requests and async notifications */ | |
29 | int fd_sync; | |
30 | int fd_async; | |
31 | ||
32 | /* Pointer to callback functions */ | |
d7c0a89a | 33 | void (*ready_notify)(uint8_t lsa_type, uint8_t opaque_type, |
d62a17ae | 34 | struct in_addr addr); |
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, | |
d7c0a89a | 38 | uint8_t status); |
d62a17ae | 39 | void (*nsm_change)(struct in_addr ifaddr, struct in_addr nbraddr, |
d7c0a89a | 40 | struct in_addr router_id, uint8_t status); |
d62a17ae | 41 | void (*update_notify)(struct in_addr ifaddr, struct in_addr area_id, |
d7c0a89a | 42 | uint8_t self_origin, struct lsa_header *lsa); |
d62a17ae | 43 | void (*delete_notify)(struct in_addr ifaddr, struct in_addr area_id, |
d7c0a89a | 44 | uint8_t self_origin, struct lsa_header *lsa); |
2d33f157 | 45 | }; |
46 | ||
47 | ||
48 | /* --------------------------------------------------------- | |
49 | * API function prototypes. | |
50 | * --------------------------------------------------------- */ | |
51 | ||
52 | /* Open connection to OSPF daemon. Two ports will be allocated on | |
53 | client, sync channel at syncport and reverse channel at syncport+1 */ | |
d62a17ae | 54 | struct ospf_apiclient *ospf_apiclient_connect(char *host, int syncport); |
2d33f157 | 55 | |
56 | /* Shutdown connection to OSPF daemon. */ | |
d62a17ae | 57 | int ospf_apiclient_close(struct ospf_apiclient *oclient); |
2d33f157 | 58 | |
59 | /* Synchronous request to register opaque type. */ | |
d62a17ae | 60 | int ospf_apiclient_register_opaque_type(struct ospf_apiclient *oclient, |
d7c0a89a | 61 | uint8_t ltype, uint8_t otype); |
2d33f157 | 62 | |
63 | /* Synchronous request to register event mask. */ | |
d62a17ae | 64 | int ospf_apiclient_register_events(struct ospf_apiclient *oclient, |
d7c0a89a | 65 | uint32_t mask); |
2d33f157 | 66 | |
67 | /* Register callback functions.*/ | |
d62a17ae | 68 | void ospf_apiclient_register_callback( |
69 | struct ospf_apiclient *oclient, | |
d7c0a89a | 70 | void (*ready_notify)(uint8_t lsa_type, uint8_t opaque_type, |
d62a17ae | 71 | struct in_addr addr), |
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, | |
d7c0a89a | 75 | uint8_t status), |
d62a17ae | 76 | void (*nsm_change)(struct in_addr ifaddr, struct in_addr nbraddr, |
d7c0a89a | 77 | struct in_addr router_id, uint8_t status), |
d62a17ae | 78 | void (*update_notify)(struct in_addr ifaddr, struct in_addr area_id, |
d7c0a89a | 79 | uint8_t selforig, struct lsa_header *lsa), |
d62a17ae | 80 | void (*delete_notify)(struct in_addr ifaddr, struct in_addr area_id, |
d7c0a89a | 81 | uint8_t selforig, struct lsa_header *lsa)); |
2d33f157 | 82 | |
83 | /* Synchronous request to synchronize LSDB. */ | |
d62a17ae | 84 | int ospf_apiclient_sync_lsdb(struct ospf_apiclient *oclient); |
2d33f157 | 85 | |
86 | /* Synchronous request to originate or update opaque LSA. */ | |
d62a17ae | 87 | int ospf_apiclient_lsa_originate(struct ospf_apiclient *oclient, |
88 | struct in_addr ifaddr, struct in_addr area_id, | |
d7c0a89a QY |
89 | uint8_t lsa_type, uint8_t opaque_type, |
90 | uint32_t opaque_id, void *opaquedata, | |
d62a17ae | 91 | int opaquelen); |
2d33f157 | 92 | |
93 | ||
94 | /* Synchronous request to delete opaque LSA. Parameter opaque_id is in | |
95 | host byte order */ | |
d62a17ae | 96 | int ospf_apiclient_lsa_delete(struct ospf_apiclient *oclient, |
08172828 | 97 | struct in_addr addr, uint8_t lsa_type, |
2f30cb25 LB |
98 | uint8_t opaque_type, uint32_t opaque_id, |
99 | uint8_t flags); | |
2d33f157 | 100 | |
101 | /* Fetch async message and handle it */ | |
d62a17ae | 102 | int ospf_apiclient_handle_async(struct ospf_apiclient *oclient); |
2d33f157 | 103 | |
104 | #endif /* _OSPF_APICLIENT_H */ |