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