aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerrit Renker <gerrit@erg.abdn.ac.uk>2007-03-20 12:11:24 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:26:48 -0400
commit9bf17475eb658a920125bd8f05edf9c57c2dd950 (patch)
tree2e3e66c47ad4326771118397ed52d0231b503595
parent353b13e10a3f1a18c6b33858fb3337bcd2692eb5 (diff)
[CCID3]: Re-order CCID 3 source file
No code change at all. This splits ccid3.c into a RX and a TX section, so that the file has an organisation similar to the other ones (e.g. packet_history.{h,c}). Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk> Acked-by: Ian McDonald <ian.mcdonald@jandi.co.nz> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/dccp/ccids/ccid3.c89
1 files changed, 45 insertions, 44 deletions
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c
index 4be62a965663..0009b399d146 100644
--- a/net/dccp/ccids/ccid3.c
+++ b/net/dccp/ccids/ccid3.c
@@ -33,7 +33,6 @@
33 * along with this program; if not, write to the Free Software 33 * along with this program; if not, write to the Free Software
34 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 34 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
35 */ 35 */
36
37#include "../ccid.h" 36#include "../ccid.h"
38#include "../dccp.h" 37#include "../dccp.h"
39#include "lib/packet_history.h" 38#include "lib/packet_history.h"
@@ -52,6 +51,9 @@ static struct dccp_tx_hist *ccid3_tx_hist;
52static struct dccp_rx_hist *ccid3_rx_hist; 51static struct dccp_rx_hist *ccid3_rx_hist;
53static struct dccp_li_hist *ccid3_li_hist; 52static struct dccp_li_hist *ccid3_li_hist;
54 53
54/*
55 * Transmitter Half-Connection Routines
56 */
55#ifdef CONFIG_IP_DCCP_CCID3_DEBUG 57#ifdef CONFIG_IP_DCCP_CCID3_DEBUG
56static const char *ccid3_tx_state_name(enum ccid3_hc_tx_states state) 58static const char *ccid3_tx_state_name(enum ccid3_hc_tx_states state)
57{ 59{
@@ -641,10 +643,50 @@ static void ccid3_hc_tx_exit(struct sock *sk)
641 dccp_tx_hist_purge(ccid3_tx_hist, &hctx->ccid3hctx_hist); 643 dccp_tx_hist_purge(ccid3_tx_hist, &hctx->ccid3hctx_hist);
642} 644}
643 645
646static void ccid3_hc_tx_get_info(struct sock *sk, struct tcp_info *info)
647{
648 const struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk);
649
650 /* Listen socks doesn't have a private CCID block */
651 if (sk->sk_state == DCCP_LISTEN)
652 return;
653
654 BUG_ON(hctx == NULL);
655
656 info->tcpi_rto = hctx->ccid3hctx_t_rto;
657 info->tcpi_rtt = hctx->ccid3hctx_rtt;
658}
659
660static int ccid3_hc_tx_getsockopt(struct sock *sk, const int optname, int len,
661 u32 __user *optval, int __user *optlen)
662{
663 const struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk);
664 const void *val;
665
666 /* Listen socks doesn't have a private CCID block */
667 if (sk->sk_state == DCCP_LISTEN)
668 return -EINVAL;
669
670 switch (optname) {
671 case DCCP_SOCKOPT_CCID_TX_INFO:
672 if (len < sizeof(hctx->ccid3hctx_tfrc))
673 return -EINVAL;
674 len = sizeof(hctx->ccid3hctx_tfrc);
675 val = &hctx->ccid3hctx_tfrc;
676 break;
677 default:
678 return -ENOPROTOOPT;
679 }
680
681 if (put_user(len, optlen) || copy_to_user(optval, val, len))
682 return -EFAULT;
683
684 return 0;
685}
686
644/* 687/*
645 * RX Half Connection methods 688 * Receiver Half-Connection Routines
646 */ 689 */
647
648#ifdef CONFIG_IP_DCCP_CCID3_DEBUG 690#ifdef CONFIG_IP_DCCP_CCID3_DEBUG
649static const char *ccid3_rx_state_name(enum ccid3_hc_rx_states state) 691static const char *ccid3_rx_state_name(enum ccid3_hc_rx_states state)
650{ 692{
@@ -1129,20 +1171,6 @@ static void ccid3_hc_rx_get_info(struct sock *sk, struct tcp_info *info)
1129 info->tcpi_rcv_rtt = hcrx->ccid3hcrx_rtt; 1171 info->tcpi_rcv_rtt = hcrx->ccid3hcrx_rtt;
1130} 1172}
1131 1173
1132static void ccid3_hc_tx_get_info(struct sock *sk, struct tcp_info *info)
1133{
1134 const struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk);
1135
1136 /* Listen socks doesn't have a private CCID block */
1137 if (sk->sk_state == DCCP_LISTEN)
1138 return;
1139
1140 BUG_ON(hctx == NULL);
1141
1142 info->tcpi_rto = hctx->ccid3hctx_t_rto;
1143 info->tcpi_rtt = hctx->ccid3hctx_rtt;
1144}
1145
1146static int ccid3_hc_rx_getsockopt(struct sock *sk, const int optname, int len, 1174static int ccid3_hc_rx_getsockopt(struct sock *sk, const int optname, int len,
1147 u32 __user *optval, int __user *optlen) 1175 u32 __user *optval, int __user *optlen)
1148{ 1176{
@@ -1170,33 +1198,6 @@ static int ccid3_hc_rx_getsockopt(struct sock *sk, const int optname, int len,
1170 return 0; 1198 return 0;
1171} 1199}
1172 1200
1173static int ccid3_hc_tx_getsockopt(struct sock *sk, const int optname, int len,
1174 u32 __user *optval, int __user *optlen)
1175{
1176 const struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk);
1177 const void *val;
1178
1179 /* Listen socks doesn't have a private CCID block */
1180 if (sk->sk_state == DCCP_LISTEN)
1181 return -EINVAL;
1182
1183 switch (optname) {
1184 case DCCP_SOCKOPT_CCID_TX_INFO:
1185 if (len < sizeof(hctx->ccid3hctx_tfrc))
1186 return -EINVAL;
1187 len = sizeof(hctx->ccid3hctx_tfrc);
1188 val = &hctx->ccid3hctx_tfrc;
1189 break;
1190 default:
1191 return -ENOPROTOOPT;
1192 }
1193
1194 if (put_user(len, optlen) || copy_to_user(optval, val, len))
1195 return -EFAULT;
1196
1197 return 0;
1198}
1199
1200static struct ccid_operations ccid3 = { 1201static struct ccid_operations ccid3 = {
1201 .ccid_id = DCCPC_CCID3, 1202 .ccid_id = DCCPC_CCID3,
1202 .ccid_name = "ccid3", 1203 .ccid_name = "ccid3",