diff options
author | Arnaldo Carvalho de Melo <acme@mandriva.com> | 2005-09-18 03:19:32 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-09-18 03:19:32 -0400 |
commit | 88f964db6ef728982734356bf4c406270ea29c1d (patch) | |
tree | 7fb9ba2fb646f4917911fed4a0a37cd52a12eae4 /net/dccp/ccids | |
parent | 561713cf475de1f671cc89c437927ec008a20209 (diff) |
[DCCP]: Introduce CCID getsockopt for the CCIDs
Allocation for the optnames is similar to the DCCP options, with a
range for rx and tx half connection CCIDs.
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dccp/ccids')
-rw-r--r-- | net/dccp/ccids/ccid3.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c index 38aa84986118..aa68e0ab274d 100644 --- a/net/dccp/ccids/ccid3.c +++ b/net/dccp/ccids/ccid3.c | |||
@@ -1120,6 +1120,60 @@ static void ccid3_hc_tx_get_info(struct sock *sk, struct tcp_info *info) | |||
1120 | info->tcpi_rtt = hctx->ccid3hctx_rtt; | 1120 | info->tcpi_rtt = hctx->ccid3hctx_rtt; |
1121 | } | 1121 | } |
1122 | 1122 | ||
1123 | static int ccid3_hc_rx_getsockopt(struct sock *sk, const int optname, int len, | ||
1124 | u32 __user *optval, int __user *optlen) | ||
1125 | { | ||
1126 | const struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk); | ||
1127 | const void *val; | ||
1128 | |||
1129 | /* Listen socks doesn't have a private CCID block */ | ||
1130 | if (sk->sk_state == DCCP_LISTEN) | ||
1131 | return -EINVAL; | ||
1132 | |||
1133 | switch (optname) { | ||
1134 | case DCCP_SOCKOPT_CCID_RX_INFO: | ||
1135 | if (len < sizeof(hcrx->ccid3hcrx_tfrc)) | ||
1136 | return -EINVAL; | ||
1137 | len = sizeof(hcrx->ccid3hcrx_tfrc); | ||
1138 | val = &hcrx->ccid3hcrx_tfrc; | ||
1139 | break; | ||
1140 | default: | ||
1141 | return -ENOPROTOOPT; | ||
1142 | } | ||
1143 | |||
1144 | if (put_user(len, optlen) || copy_to_user(optval, val, len)) | ||
1145 | return -EFAULT; | ||
1146 | |||
1147 | return 0; | ||
1148 | } | ||
1149 | |||
1150 | static int ccid3_hc_tx_getsockopt(struct sock *sk, const int optname, int len, | ||
1151 | u32 __user *optval, int __user *optlen) | ||
1152 | { | ||
1153 | const struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk); | ||
1154 | const void *val; | ||
1155 | |||
1156 | /* Listen socks doesn't have a private CCID block */ | ||
1157 | if (sk->sk_state == DCCP_LISTEN) | ||
1158 | return -EINVAL; | ||
1159 | |||
1160 | switch (optname) { | ||
1161 | case DCCP_SOCKOPT_CCID_TX_INFO: | ||
1162 | if (len < sizeof(hctx->ccid3hctx_tfrc)) | ||
1163 | return -EINVAL; | ||
1164 | len = sizeof(hctx->ccid3hctx_tfrc); | ||
1165 | val = &hctx->ccid3hctx_tfrc; | ||
1166 | break; | ||
1167 | default: | ||
1168 | return -ENOPROTOOPT; | ||
1169 | } | ||
1170 | |||
1171 | if (put_user(len, optlen) || copy_to_user(optval, val, len)) | ||
1172 | return -EFAULT; | ||
1173 | |||
1174 | return 0; | ||
1175 | } | ||
1176 | |||
1123 | static struct ccid ccid3 = { | 1177 | static struct ccid ccid3 = { |
1124 | .ccid_id = 3, | 1178 | .ccid_id = 3, |
1125 | .ccid_name = "ccid3", | 1179 | .ccid_name = "ccid3", |
@@ -1139,6 +1193,8 @@ static struct ccid ccid3 = { | |||
1139 | .ccid_hc_rx_packet_recv = ccid3_hc_rx_packet_recv, | 1193 | .ccid_hc_rx_packet_recv = ccid3_hc_rx_packet_recv, |
1140 | .ccid_hc_rx_get_info = ccid3_hc_rx_get_info, | 1194 | .ccid_hc_rx_get_info = ccid3_hc_rx_get_info, |
1141 | .ccid_hc_tx_get_info = ccid3_hc_tx_get_info, | 1195 | .ccid_hc_tx_get_info = ccid3_hc_tx_get_info, |
1196 | .ccid_hc_rx_getsockopt = ccid3_hc_rx_getsockopt, | ||
1197 | .ccid_hc_tx_getsockopt = ccid3_hc_tx_getsockopt, | ||
1142 | }; | 1198 | }; |
1143 | 1199 | ||
1144 | module_param(ccid3_debug, int, 0444); | 1200 | module_param(ccid3_debug, int, 0444); |