]> git.proxmox.com Git - mirror_frr.git/blobdiff - zebra/kernel_netlink.h
Merge pull request #5789 from donaldsharp/bgp_ebgp_reason
[mirror_frr.git] / zebra / kernel_netlink.h
index adbcf71f636fa7c3607de14c66c33cb652792a4f..076ca5c5c7579253eb07859d42ee15046cc99568 100644 (file)
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with GNU Zebra; see the file COPYING.  If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.  
+ * You should have received a copy of the GNU General Public License along
+ * with this program; see the file COPYING; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #ifndef _ZEBRA_KERNEL_NETLINK_H
 #define _ZEBRA_KERNEL_NETLINK_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #ifdef HAVE_NETLINK
 
+#define NL_RCV_PKT_BUF_SIZE     32768
 #define NL_PKT_BUF_SIZE         8192
 
-extern void netlink_parse_rtattr (struct rtattr **tb, int max,
-                                  struct rtattr *rta, int len);
-extern int addattr_l (struct nlmsghdr *n, unsigned int maxlen,
-                      int type, void *data, unsigned int alen);
-extern int rta_addattr_l (struct rtattr *rta, unsigned int maxlen,
-                          int type, void *data, unsigned int alen);
-extern int addattr32 (struct nlmsghdr *n, unsigned int maxlen,
-                      int type, int data);
+extern void netlink_parse_rtattr(struct rtattr **tb, int max,
+                                struct rtattr *rta, int len);
+extern void netlink_parse_rtattr_nested(struct rtattr **tb, int max,
+                                       struct rtattr *rta);
+extern int addattr_l(struct nlmsghdr *n, unsigned int maxlen, int type,
+                    const void *data, unsigned int alen);
+extern int rta_addattr_l(struct rtattr *rta, unsigned int maxlen, int type,
+                        const void *data, unsigned int alen);
+extern int addattr16(struct nlmsghdr *n, unsigned int maxlen, int type,
+                    uint16_t data);
+extern int addattr32(struct nlmsghdr *n, unsigned int maxlen, int type,
+                    int data);
 extern struct rtattr *addattr_nest(struct nlmsghdr *n, int maxlen, int type);
 extern int addattr_nest_end(struct nlmsghdr *n, struct rtattr *nest);
-extern struct rtattr * rta_nest(struct rtattr *rta, int maxlen, int type);
+extern struct rtattr *rta_nest(struct rtattr *rta, int maxlen, int type);
 extern int rta_nest_end(struct rtattr *rta, struct rtattr *nest);
-extern const char * nl_msg_type_to_str (uint16_t msg_type);
-extern const char * nl_rtproto_to_str (u_char rtproto);
-extern const char * nl_family_to_str (u_char family);
-extern const char * nl_rttype_to_str (u_char rttype);
-
-extern int netlink_parse_info (int (*filter) (struct sockaddr_nl *,
-                                              struct nlmsghdr *, ns_id_t, int),
-                               struct nlsock *nl, struct zebra_ns *zns,
-                               int count, int startup);
-extern int netlink_talk_filter (struct sockaddr_nl *, struct nlmsghdr *,
-                               ns_id_t, int startup);
-extern int netlink_talk (int (*filter) (struct sockaddr_nl *, struct nlmsghdr *,
-                                       ns_id_t, int startup),
-                        struct nlmsghdr *n, struct nlsock *nl,
-                         struct zebra_ns *zns, int startup);
-extern int netlink_request (int family, int type, struct nlsock *nl);
+extern const char *nl_msg_type_to_str(uint16_t msg_type);
+extern const char *nl_rtproto_to_str(uint8_t rtproto);
+extern const char *nl_family_to_str(uint8_t family);
+extern const char *nl_rttype_to_str(uint8_t rttype);
+
+#if defined(HANDLE_NETLINK_FUZZING)
+extern bool netlink_read;
+extern void netlink_read_init(const char *fname);
+#endif /* HANDLE_NETLINK_FUZZING */
+extern int netlink_parse_info(int (*filter)(struct nlmsghdr *, ns_id_t, int),
+                             const struct nlsock *nl,
+                             const struct zebra_dplane_info *dp_info,
+                             int count, int startup);
+extern int netlink_talk_filter(struct nlmsghdr *h, ns_id_t ns, int startup);
+extern int netlink_talk(int (*filter)(struct nlmsghdr *, ns_id_t, int startup),
+                       struct nlmsghdr *n, struct nlsock *nl,
+                       struct zebra_ns *zns, int startup);
+/* Version with 'info' struct only */
+int netlink_talk_info(int (*filter)(struct nlmsghdr *, ns_id_t, int startup),
+                     struct nlmsghdr *n,
+                     const struct zebra_dplane_info *dp_info, int startup);
+
+extern int netlink_request(struct nlsock *nl, struct nlmsghdr *n);
 
 #endif /* HAVE_NETLINK */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _ZEBRA_KERNEL_NETLINK_H */