• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * lib/idiag/idiagnl_vegasinfo_obj.c Inet Diag TCP Vegas Info Object
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) 2013 Sassano Systems LLC <joe@sassanosystems.com>
10  */
11 
12 #include <netlink-private/netlink.h>
13 #include <netlink/idiag/vegasinfo.h>
14 
15 /**
16  * @ingroup idiag
17  * @defgroup idiagnl_vegasinfo Inet Diag TCP Vegas Info
18  *
19  * @details
20  * @idiagnl_doc{idiagnl_vegasinfo, Inet Diag TCP Vegas Info Documentation}
21  * @{
22  */
idiagnl_vegasinfo_alloc(void)23 struct idiagnl_vegasinfo *idiagnl_vegasinfo_alloc(void)
24 {
25 	return (struct idiagnl_vegasinfo *) nl_object_alloc(&idiagnl_vegasinfo_obj_ops);
26 }
27 
idiagnl_vegasinfo_get(struct idiagnl_vegasinfo * vinfo)28 void idiagnl_vegasinfo_get(struct idiagnl_vegasinfo *vinfo)
29 {
30 	nl_object_get((struct nl_object *) vinfo);
31 }
32 
idiagnl_vegasinfo_put(struct idiagnl_vegasinfo * vinfo)33 void idiagnl_vegasinfo_put(struct idiagnl_vegasinfo *vinfo)
34 {
35 	nl_object_put((struct nl_object *) vinfo);
36 }
37 
38 /**
39  * @name Attributes
40  * @{
41  */
idiagnl_vegasinfo_get_enabled(const struct idiagnl_vegasinfo * vinfo)42 uint32_t idiagnl_vegasinfo_get_enabled(const struct idiagnl_vegasinfo *vinfo)
43 {
44 	return vinfo->tcpv_enabled;
45 }
46 
idiagnl_vegasinfo_set_enabled(struct idiagnl_vegasinfo * vinfo,uint32_t enabled)47 void idiagnl_vegasinfo_set_enabled(struct idiagnl_vegasinfo *vinfo, uint32_t
48 		enabled)
49 {
50 	vinfo->tcpv_enabled = enabled;
51 }
52 
idiagnl_vegasinfo_get_rttcnt(const struct idiagnl_vegasinfo * vinfo)53 uint32_t idiagnl_vegasinfo_get_rttcnt(const struct idiagnl_vegasinfo *vinfo)
54 {
55 	return vinfo->tcpv_rttcnt;
56 }
57 
idiagnl_vegasinfo_set_rttcnt(struct idiagnl_vegasinfo * vinfo,uint32_t rttcnt)58 void idiagnl_vegasinfo_set_rttcnt(struct idiagnl_vegasinfo *vinfo, uint32_t
59 		rttcnt)
60 {
61 	vinfo->tcpv_rttcnt = rttcnt;
62 }
63 
idiagnl_vegasinfo_get_rtt(const struct idiagnl_vegasinfo * vinfo)64 uint32_t idiagnl_vegasinfo_get_rtt(const struct idiagnl_vegasinfo *vinfo)
65 {
66 	return vinfo->tcpv_rtt;
67 }
68 
idiagnl_vegasinfo_set_rtt(struct idiagnl_vegasinfo * vinfo,uint32_t rtt)69 void idiagnl_vegasinfo_set_rtt(struct idiagnl_vegasinfo *vinfo, uint32_t rtt)
70 {
71 	vinfo->tcpv_rtt = rtt;
72 }
73 
idiagnl_vegasinfo_get_minrtt(const struct idiagnl_vegasinfo * vinfo)74 uint32_t idiagnl_vegasinfo_get_minrtt(const struct idiagnl_vegasinfo *vinfo)
75 {
76 	return vinfo->tcpv_minrtt;
77 }
78 
idiagnl_vegasinfo_set_minrtt(struct idiagnl_vegasinfo * vinfo,uint32_t minrtt)79 void idiagnl_vegasinfo_set_minrtt(struct idiagnl_vegasinfo *vinfo, uint32_t
80 		minrtt)
81 {
82 	vinfo->tcpv_minrtt = minrtt;
83 }
84 /** @} */
85 
idiagnl_vegasinfo_clone(struct nl_object * _dst,struct nl_object * _src)86 static int idiagnl_vegasinfo_clone(struct nl_object *_dst,
87                                    struct nl_object *_src)
88 {
89 	struct idiagnl_vegasinfo *dst = (struct idiagnl_vegasinfo *) _dst;
90 	struct idiagnl_vegasinfo *src = (struct idiagnl_vegasinfo *) _src;
91 
92 	memcpy(dst, src, sizeof(struct idiagnl_vegasinfo));
93 
94 	return 0;
95 }
96 
97 /** @cond SKIP */
98 struct nl_object_ops idiagnl_vegasinfo_obj_ops = {
99 	.oo_name	= "idiag/idiag_vegasinfo",
100 	.oo_size	= sizeof(struct idiagnl_vegasinfo),
101 	.oo_clone	= idiagnl_vegasinfo_clone,
102 };
103 /** @endcond */
104 /** @} */
105