1 /* 2 * src/utils.h Utilities 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation version 2.1 7 * of the License. 8 * 9 * Copyright (c) 2003-2009 Thomas Graf <tgraf@suug.ch> 10 */ 11 12 #ifndef __NETLINK_CLI_UTILS_H_ 13 #define __NETLINK_CLI_UTILS_H_ 14 15 #include <stdio.h> 16 #include <string.h> 17 #include <stdlib.h> 18 #include <stdarg.h> 19 #include <limits.h> 20 #include <inttypes.h> 21 #include <errno.h> 22 #include <stdint.h> 23 #include <ctype.h> 24 #include <getopt.h> 25 #include <sys/types.h> 26 #include <sys/socket.h> 27 #include <sys/select.h> 28 29 #include <netlink/netlink.h> 30 #include <netlink/utils.h> 31 #include <netlink/addr.h> 32 #include <netlink/list.h> 33 #include <netlink/route/rtnl.h> 34 #include <netlink/route/link.h> 35 #include <netlink/route/addr.h> 36 #include <netlink/route/neighbour.h> 37 #include <netlink/route/neightbl.h> 38 #include <netlink/route/route.h> 39 #include <netlink/route/rule.h> 40 #include <netlink/route/qdisc.h> 41 #include <netlink/route/class.h> 42 #include <netlink/route/classifier.h> 43 #include <netlink/route/cls/ematch.h> 44 #include <netlink/fib_lookup/lookup.h> 45 #include <netlink/fib_lookup/request.h> 46 #include <netlink/genl/genl.h> 47 #include <netlink/genl/ctrl.h> 48 #include <netlink/genl/mngt.h> 49 #include <netlink/netfilter/ct.h> 50 51 #ifdef __cplusplus 52 extern "C" { 53 #endif 54 55 #ifndef __init 56 #define __init __attribute__((constructor)) 57 #endif 58 59 #ifndef __exit 60 #define __exit __attribute__((destructor)) 61 #endif 62 63 extern uint32_t nl_cli_parse_u32(const char *); 64 extern void nl_cli_print_version(void) 65 __attribute__((noreturn)); 66 extern void nl_cli_fatal(int, const char *, ...) 67 __attribute__((noreturn)); 68 extern struct nl_addr * nl_cli_addr_parse(const char *, int); 69 extern int nl_cli_connect(struct nl_sock *, int); 70 extern struct nl_sock * nl_cli_alloc_socket(void); 71 extern int nl_cli_parse_dumptype(const char *); 72 extern int nl_cli_confirm(struct nl_object *, 73 struct nl_dump_params *, int); 74 75 extern struct nl_cache *nl_cli_alloc_cache(struct nl_sock *, const char *, 76 int (*ac)(struct nl_sock *, struct nl_cache **)); 77 78 extern struct nl_cache *nl_cli_alloc_cache_flags(struct nl_sock *, const char *, 79 unsigned int flags, 80 int (*ac)(struct nl_sock *, struct nl_cache **, unsigned int)); 81 82 extern void nl_cli_load_module(const char *, const char *); 83 84 #ifdef __cplusplus 85 } 86 #endif 87 88 #endif 89