]>
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 */ |
26 | struct ospf_apiclient | |
27 | { | |
28 | ||
29 | /* Sockets for sync requests and async notifications */ | |
30 | int fd_sync; | |
31 | int fd_async; | |
32 | ||
33 | /* Pointer to callback functions */ | |
34 | void (*ready_notify) (u_char lsa_type, u_char opaque_type, | |
35 | struct in_addr addr); | |
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, | |
39 | u_char status); | |
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, | |
44 | struct lsa_header * lsa); | |
45 | void (*delete_notify) (struct in_addr ifaddr, struct in_addr area_id, | |
46 | u_char self_origin, | |
47 | struct lsa_header * lsa); | |
48 | }; | |
49 | ||
50 | ||
51 | /* --------------------------------------------------------- | |
52 | * API function prototypes. | |
53 | * --------------------------------------------------------- */ | |
54 | ||
55 | /* Open connection to OSPF daemon. Two ports will be allocated on | |
56 | client, sync channel at syncport and reverse channel at syncport+1 */ | |
57 | struct ospf_apiclient *ospf_apiclient_connect (char *host, int syncport); | |
58 | ||
59 | /* Shutdown connection to OSPF daemon. */ | |
60 | int ospf_apiclient_close (struct ospf_apiclient *oclient); | |
61 | ||
62 | /* Synchronous request to register opaque type. */ | |
63 | int ospf_apiclient_register_opaque_type (struct ospf_apiclient *oclient, | |
64 | u_char ltype, u_char otype); | |
65 | ||
66 | /* Synchronous request to register event mask. */ | |
67 | int ospf_apiclient_register_events (struct ospf_apiclient *oclient, | |
68 | u_int32_t mask); | |
69 | ||
70 | /* Register callback functions.*/ | |
71 | void ospf_apiclient_register_callback (struct ospf_apiclient *oclient, | |
72 | void (*ready_notify) (u_char lsa_type, | |
73 | u_char | |
74 | opaque_type, | |
75 | struct in_addr | |
76 | addr), | |
77 | void (*new_if) (struct in_addr ifaddr, | |
78 | struct in_addr | |
79 | area_id), | |
80 | void (*del_if) (struct in_addr ifaddr), | |
81 | void (*ism_change) (struct in_addr | |
82 | ifaddr, | |
83 | struct in_addr | |
84 | area_id, | |
85 | u_char status), | |
86 | void (*nsm_change) (struct in_addr | |
87 | ifaddr, | |
88 | struct in_addr | |
89 | nbraddr, | |
90 | struct in_addr | |
91 | router_id, | |
92 | u_char status), | |
93 | void (*update_notify) (struct in_addr | |
94 | ifaddr, | |
95 | struct in_addr | |
96 | area_id, | |
97 | u_char selforig, | |
98 | struct | |
99 | lsa_header * | |
100 | lsa), | |
101 | void (*delete_notify) (struct in_addr | |
102 | ifaddr, | |
103 | struct in_addr | |
104 | area_id, | |
105 | u_char selforig, | |
106 | struct | |
107 | lsa_header * | |
108 | lsa)); | |
109 | ||
110 | /* Synchronous request to synchronize LSDB. */ | |
111 | int ospf_apiclient_sync_lsdb (struct ospf_apiclient *oclient); | |
112 | ||
113 | /* Synchronous request to originate or update opaque LSA. */ | |
114 | int | |
115 | ospf_apiclient_lsa_originate(struct ospf_apiclient *oclient, | |
116 | struct in_addr ifaddr, | |
117 | struct in_addr area_id, | |
118 | u_char lsa_type, | |
119 | u_char opaque_type, u_int32_t opaque_id, | |
120 | void *opaquedata, int opaquelen); | |
121 | ||
122 | ||
123 | /* Synchronous request to delete opaque LSA. Parameter opaque_id is in | |
124 | host byte order */ | |
125 | int ospf_apiclient_lsa_delete (struct ospf_apiclient *oclient, | |
126 | struct in_addr area_id, u_char lsa_type, | |
127 | u_char opaque_type, u_int32_t opaque_id); | |
128 | ||
129 | /* Fetch async message and handle it */ | |
130 | int ospf_apiclient_handle_async (struct ospf_apiclient *oclient); | |
131 | ||
132 | #endif /* _OSPF_APICLIENT_H */ |