@@ -89,6 +89,46 @@ impl Sock {
89
89
unsafe { & mut * ( bindings:: tcp_sk ( self . sk . get ( ) ) as * mut TcpSock ) }
90
90
}
91
91
92
+ /// Returns the [private data] of the instance of the CCA used by this
93
+ /// socket.
94
+ ///
95
+ /// [private data]: tcp::cong::Algorithm::Data
96
+ ///
97
+ /// # Safety
98
+ ///
99
+ /// - `sk` must be valid for `inet_csk_ca`,
100
+ /// - `sk` must use the CCA `T`, the `init` CB of the CCA must have been
101
+ /// called, the `release` CB of the CCA must not have been called.
102
+ #[ inline]
103
+ #[ cfg( CONFIG_RUST_TCP_ABSTRACTIONS ) ]
104
+ pub ( crate ) unsafe fn inet_csk_ca < ' a , T : tcp:: cong:: Algorithm + ?Sized > (
105
+ & ' a self ,
106
+ ) -> & ' a T :: Data {
107
+ // SAFETY: By the function's preconditions, calling `inet_csk_ca` is OK
108
+ // and the returned pointer points to a valid instance of `T::Data`.
109
+ unsafe { & * ( bindings:: inet_csk_ca ( self . sk . get ( ) ) as * const T :: Data ) }
110
+ }
111
+
112
+ /// Returns the [private data] of the instance of the CCA used by this
113
+ /// socket.
114
+ ///
115
+ /// [private data]: tcp::cong::Algorithm::Data
116
+ ///
117
+ /// # Safety
118
+ ///
119
+ /// - `sk` must be valid for `inet_csk_ca`,
120
+ /// - `sk` must use the CCA `T`, the `init` CB of the CCA must have been
121
+ /// called, the `release` CB of the CCA must not have been called.
122
+ #[ inline]
123
+ #[ cfg( CONFIG_RUST_TCP_ABSTRACTIONS ) ]
124
+ pub ( crate ) unsafe fn inet_csk_ca_mut < ' a , T : tcp:: cong:: Algorithm + ?Sized > (
125
+ & ' a mut self ,
126
+ ) -> & ' a mut T :: Data {
127
+ // SAFETY: By the function's preconditions, calling `inet_csk_ca` is OK
128
+ // and the returned pointer points to a valid instance of `T::Data`.
129
+ unsafe { & mut * ( bindings:: inet_csk_ca ( self . sk . get ( ) ) as * mut T :: Data ) }
130
+ }
131
+
92
132
/// Returns the [`InetConnectionSock`] view of this socket.
93
133
///
94
134
/// # Safety
0 commit comments