c066742b65dacf2defaa3852ca3c7f1d3338a5a1
[openwrt/svn-archive/archive.git] / package / lqtapi / src / tapi / tapi-nl.c
1
2 static struct tapi_attr default_port[] = {
3 [PORTS] = {
4 .type = TAPI_TYPE_PORTS,
5 .name = "ports",
6 .description = "foobar",
7 .set = tapi_set_ports,
8 .get = tapi_get_ports,
9 },
10 };
11
12 static const struct nla_policy tapi_policy[] = {
13 [TAPI_ATTR_ID] = { .type = NLA_U32 },
14 [TAPI_ATTR_PORT] = { .type = NLA_U32 },
15 [TAPI_ATTR_ENDPOINT] = { .type = NLA_U32 },
16 [TAPI_ATTR_STREAM] = { .type = NLA_U32 }
17 };
18
19 static const struct nla_policy tapi_port_policy[] = {
20 [TAPI_PORT_ID] = { .type = NLA_U32 },
21 };
22
23 static const struct nla_policy tapi_endpoint_policy[] = {
24 [TAPI_ENDPOINT_ID] = { .type = NLA_U32 },
25 };
26
27 static const struct nla_policy tapi_stream_policy[] = {
28 [TAPI_STREAM_ID] = { .type = NLA_U32 },
29 };
30
31 static struct genl_family tapi_nl_family = {
32 .id = GENL_ID_GENERATE,
33 .name = "tapi",
34 .hdrsize = 0,
35 .version = 1,
36 .maxattr = ARRAY_SIZE(tapi_policy),
37 };
38
39
40
41 static struct genl_ops tapi_nl_ops[] = {
42 TAPI_NL_OP(TAPI_CMD_LIST, list_attr),
43
44 };
45
46 static int __init tapi_nl_init(void)
47 {
48 ret = genl_unregister_family(&tapi_nl_family);
49 if (ret)
50 return ret;
51
52 genl_register_ops(&tapi_nl_family, tapi_nl_ops);
53
54 return 0;
55 }
56 module_init(tapi_nl_init);
57
58 static void __exit tapi_nl_exit(void)
59 {
60 genl_unregister_family(&tapi_nl_family);
61 }
62