github.com/google/syzkaller@v0.0.0-20251211124644-a066d2bc4b02/tools/syz-declextract/testdata/include/netlink.h (about) 1 // Copyright 2024 syzkaller project authors. All rights reserved. 2 // Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. 3 4 #include "types.h" 5 6 enum { 7 NLA_UNSPEC, 8 NLA_U8, 9 NLA_U16, 10 NLA_U32, 11 NLA_U64, 12 NLA_STRING, 13 NLA_FLAG, 14 NLA_MSECS, 15 NLA_NESTED, 16 NLA_NESTED_ARRAY, 17 NLA_NUL_STRING, 18 NLA_BINARY, 19 NLA_S8, 20 NLA_S16, 21 NLA_S32, 22 NLA_S64, 23 NLA_BITFIELD32, 24 NLA_REJECT, 25 NLA_BE16, 26 NLA_BE32, 27 NLA_SINT, 28 NLA_UINT, 29 __NLA_TYPE_MAX, 30 }; 31 32 struct nla_policy { 33 u8 type; 34 u8 validation_type; 35 u16 len; 36 union { 37 const u32 bitfield32_valid; 38 const u32 mask; 39 const struct nla_policy *nested_policy; 40 struct { s16 min, max; }; 41 }; 42 }; 43 44 #define NLA_POLICY_NESTED(policy) { .type = NLA_NESTED, .nested_policy = policy, .len = sizeof(policy)/sizeof(policy[0]) } 45 46 #define GENL_ADMIN_PERM 0x01 47 #define GENL_UNS_ADMIN_PERM 0x10 48 49 struct genl_ops { 50 u8 cmd; 51 u8 flags; 52 const struct nla_policy* policy; 53 void (*doit)(void); 54 void (*dumpit)(void); 55 }; 56 57 struct genl_split_ops { 58 u8 cmd; 59 u8 flags; 60 const struct nla_policy *policy; 61 union { 62 struct { 63 void (*pre_doit)(void); 64 void (*doit)(void); 65 void (*post_doit)(void); 66 }; 67 struct { 68 void (*start)(void); 69 void (*dumpit)(void); 70 void (*done)(void); 71 }; 72 }; 73 }; 74 75 struct genl_small_ops {}; 76 77 struct genl_family { 78 char name[64]; 79 u8 n_ops; 80 u8 n_small_ops; 81 u8 n_split_ops; 82 const struct nla_policy* policy; 83 const struct genl_ops* ops; 84 const struct genl_small_ops* mall_ops; 85 const struct genl_split_ops* split_ops; 86 };