rx: Hide struct rx_peer from the rest of the tree
authorSimon Wilkinson <sxw@your-file-system.com>
Mon, 5 Dec 2011 18:56:03 +0000 (18:56 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Mon, 9 Apr 2012 23:36:45 +0000 (16:36 -0700)
The peer structure is an internal RX structure, so it shouldn't
be contained in public header files, or used by non-rx modules.

Hide the structure definition in rx_peer.h, and convert the
rx_HostOf and rx_PortOf accessors from macros into functions. This
will also help with adding support for non-IPv4 addresses to RX.

Change-Id: I790fa3193bfa629a2872fc5395d0146e76a2de9e
Reviewed-on: http://gerrit.openafs.org/7002
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

20 files changed:
src/bucoord/server.c
src/kauth/admin_tools.c
src/kauth/kaprocs.c
src/libafs/Makefile.common.in
src/libafsrpc/Makefile.in
src/libafsrpc/NTMakefile
src/libafsrpc/afsrpc.def
src/libuafs/Makefile.common.in
src/rx/Makefile.in
src/rx/NTMakefile
src/rx/rx.c
src/rx/rx.h
src/rx/rx_kcommon.c
src/rx/rx_packet.c
src/rx/rx_peer.c [new file with mode: 0644]
src/rx/rx_peer.h [new file with mode: 0644]
src/rx/rx_user.c
src/shlibafsrpc/Makefile.in
src/shlibafsrpc/libafsrpc.map
src/viced/afsfileprocs.c

index aa2ebfd..eeead83 100644 (file)
@@ -24,6 +24,6 @@ SBC_Print(struct rx_call *acall, afs_int32 acode, afs_int32 aflags,
 
     tconn = rx_ConnectionOf(acall);
     tpeer = rx_PeerOf(tconn);
-    printf("From %08x: %s <%d>\n", tpeer->host, amessage, acode);
+    printf("From %08x: %s <%d>\n", rx_HostOf(tpeer), amessage, acode);
     return 0;
 }
index d286d50..71b2b4c 100644 (file)
@@ -555,7 +555,7 @@ Unlock(struct cmd_syndesc *as, void *arock)
            server = 0;
            if (conn && conn->conns[count - 1]
                && rx_PeerOf(conn->conns[count - 1])) {
-               server = rx_PeerOf(conn->conns[count - 1])->host;
+               server = rx_HostOf(rx_PeerOf(conn->conns[count - 1]));
            }
            afs_com_err(whoami, code,
                    "so %s.%s may still be locked (on server %d.%d.%d.%d)",
index 71a834d..7a93753 100644 (file)
@@ -648,7 +648,7 @@ kamCreateUser(struct rx_call *call, char *aname, char *ainstance,
     }
     code = ubik_EndTrans(tt);
     KALOG(aname, ainstance, NULL, NULL, NULL,
-         rx_PeerOf(rx_ConnectionOf(call))->host, LOG_CRUSER);
+         rx_HostOf(rx_PeerOf(rx_ConnectionOf(call))), LOG_CRUSER);
     return code;
 }
 
@@ -924,7 +924,7 @@ kamSetPassword(struct rx_call *call, char *aname, char *ainstance,
 
     code = ubik_EndTrans(tt);
     KALOG(aname, ainstance, NULL, NULL, NULL,
-         rx_PeerOf(rx_ConnectionOf(call))->host, LOG_CHPASSWD);
+         rx_HostOf(rx_PeerOf(rx_ConnectionOf(call))), LOG_CHPASSWD);
     return code;
 
   abort:
@@ -1247,14 +1247,14 @@ Authenticate(int version, struct rx_call *call, char *aname, char *ainstance,
                     &user_schedule, ktc_to_cblockptr(&tentry.key), ENCRYPT);
     code = ubik_EndTrans(tt);
     KALOG(aname, ainstance, sname, sinst, NULL,
-         rx_PeerOf(rx_ConnectionOf(call))->host, LOG_AUTHENTICATE);
+         rx_HostOf(rx_PeerOf(rx_ConnectionOf(call))), LOG_AUTHENTICATE);
     return code;
 
   abort:
     COUNT_ABO;
     ubik_AbortTrans(tt);
     KALOG(aname, ainstance, sname, sinst, NULL,
-         rx_PeerOf(rx_ConnectionOf(call))->host, LOG_AUTHFAILED);
+         rx_HostOf(rx_PeerOf(rx_ConnectionOf(call))), LOG_AUTHFAILED);
     return code;
 }
 
@@ -1456,7 +1456,7 @@ kamSetFields(struct rx_call *call,
 
     code = ubik_EndTrans(tt);
     KALOG(aname, ainstance, NULL, NULL, NULL,
-         rx_PeerOf(rx_ConnectionOf(call))->host, LOG_SETFIELDS);
+         rx_HostOf(rx_PeerOf(rx_ConnectionOf(call))), LOG_SETFIELDS);
     return code;
 
   abort:
@@ -1529,7 +1529,7 @@ kamDeleteUser(struct rx_call *call, char *aname, char *ainstance)
 
     code = ubik_EndTrans(tt);
     KALOG(aname, ainstance, NULL, NULL, NULL,
-         rx_PeerOf(rx_ConnectionOf(call))->host, LOG_DELUSER);
+         rx_HostOf(rx_PeerOf(rx_ConnectionOf(call))), LOG_DELUSER);
     return code;
 }
 
@@ -1932,7 +1932,7 @@ GetTicket(int version,
                     &schedule, ktc_to_cblockptr(&authSessionKey), ENCRYPT);
     code = ubik_EndTrans(tt);
     KALOG(name, instance, sname, sinstance, (import ? authDomain : NULL),
-         rx_PeerOf(rx_ConnectionOf(call))->host, LOG_GETTICKET);
+         rx_HostOf(rx_PeerOf(rx_ConnectionOf(call))), LOG_GETTICKET);
     return code;
 
   abort:
@@ -2259,7 +2259,7 @@ SKAM_Unlock(struct rx_call *call,
 
     code = ubik_EndTrans(tt);
     KALOG(aname, ainstance, NULL, NULL, NULL,
-         rx_PeerOf(rx_ConnectionOf(call))->host, LOG_UNLOCK);
+         rx_HostOf(rx_PeerOf(rx_ConnectionOf(call))), LOG_UNLOCK);
     goto exit;
 
   abort:
index 346c70d..d43c64c 100644 (file)
@@ -138,6 +138,7 @@ AFSAOBJS = \
        rx.o            \
        rx_call.o       \
        rx_conn.o       \
+       rx_peer.o       \
        rx_rdwr.o       \
        rx_clock.o      \
        rx_event.o      \
@@ -233,6 +234,7 @@ AFSPAGOBJS = \
        rx.o            \
        rx_call.o       \
        rx_conn.o       \
+        rx_peer.o       \
        rx_rdwr.o       \
        rx_clock.o      \
        rx_event.o      \
@@ -364,6 +366,8 @@ rx_call.o: $(TOP_SRC_RX)/rx_call.c
        $(CRULE_OPT) $(TOP_SRC_RX)/rx_call.c
 rx_conn.o: $(TOP_SRC_RX)/rx_conn.c
        $(CRULE_OPT) $(TOP_SRC_RX)/rx_conn.c
+rx_peer.o: $(TOP_SRC_RX)/rx_peer.c
+       $(CRULE_OPT) $(TOP_SRC_RX)/rx_peer.c
 rx_rdwr.o: $(TOP_SRC_RX)/rx_rdwr.c
        $(CRULE_OPT) $(TOP_SRC_RX)/rx_rdwr.c
 afs_uuid.o: $(TOP_SRCDIR)/util/uuid.c
index 67864f4..09ab4f8 100644 (file)
@@ -65,6 +65,7 @@ RXOBJS =\
        rx_opaque.o \
        rx_call.o \
        rx_conn.o \
+       rx_peer.o \
        rx_conncache.o \
        rx_globals.o \
        rx_identity.o \
@@ -143,6 +144,9 @@ rx.o: ${RX}/rx.c
 rx_conncache.o: ${RX}/rx_conncache.c
        $(AFS_CCRULE) $(RX)/rx_conncache.c
 
+rx_peer.o: $(RX)/rx_peer.c
+       $(AFS_CCRULE) $(RX)/rx_peer.c
+
 rx_conn.o: ${RX}/rx_conn.c
        $(AFS_CCRULE) $(RX)/rx_conn.c
 
index fe48f8e..274d823 100644 (file)
@@ -38,7 +38,7 @@ RXOBJS = $(OUT)\rx_event.obj $(OUT)\rx_user.obj $(OUT)\rx_pthread.obj \
         $(OUT)\rx_packet.obj $(OUT)\rx_rdwr.obj $(OUT)\rx_trace.obj \
         $(OUT)\rx_xmit_nt.obj $(OUT)\rx_conncache.obj $(OUT)\rx_opaque.obj \
         $(OUT)\rx_identity.obj $(OUT)\rx_stats.obj \
-         $(OUT)\rx_call.obj $(OUT)\rx_conn.obj
+         $(OUT)\rx_call.obj $(OUT)\rx_conn.obj $(OUT)\rx_peer.obj
 
 RXSTATBJS = $(OUT)\rxstat.obj $(OUT)\rxstat.ss.obj $(OUT)\rxstat.xdr.obj $(OUT)\rxstat.cs.obj
 
index 5cc9143..59ad355 100755 (executable)
@@ -328,6 +328,8 @@ EXPORTS
         rx_RecordCallStatistics                 @334
        rx_KeepAliveOn                          @335
        rx_KeepAliveOff                         @336
+       rx_HostOf                               @337
+        rx_PortOf                               @338
 
 ; for performance testing
         rx_TSFPQGlobSize                        @2001 DATA
index 2e4831a..7962468 100644 (file)
@@ -203,6 +203,7 @@ UAFSOBJ = \
        $(UOBJ)/rx_conncache.o \
        $(UOBJ)/rx_call.o \
        $(UOBJ)/rx_conn.o \
+       $(UOBJ)/rx_peer.o \
        $(UOBJ)/xdr_rx.o \
        $(UOBJ)/Kvldbint.cs.o \
        $(UOBJ)/Kvldbint.xdr.o \
@@ -350,6 +351,7 @@ PICUAFSOBJ = \
        $(PICOBJ)/rx_conncache.o \
        $(PICOBJ)/rx_call.o \
        $(PICOBJ)/rx_conn.o \
+       $(PICOBJ)/rx_peer.o \
        $(PICOBJ)/xdr_rx.o \
        $(PICOBJ)/Kvldbint.cs.o \
        $(PICOBJ)/Kvldbint.xdr.o \
@@ -497,6 +499,7 @@ AFSWEBOBJ = \
        $(WEBOBJ)/rx_conncache.o \
        $(WEBOBJ)/rx_call.o \
        $(WEBOBJ)/rx_conn.o \
+       $(WEBOBJ)/rx_peer.o \
        $(WEBOBJ)/xdr_rx.o \
        $(WEBOBJ)/Kvldbint.cs.o \
        $(WEBOBJ)/Kvldbint.xdr.o \
@@ -638,6 +641,7 @@ AFSWEBOBJKRB = \
        $(WEBOBJ)/rx_conncache.o \
        $(WEBOBJ)/rx_call.o \
        $(WEBOBJ)/rx_conn.o \
+       $(WEBOBJ)/rx_peer.o \
        $(WEBOBJ)/xdr_rx.o \
        $(WEBOBJ)/Kvldbint.cs.o \
        $(WEBOBJ)/Kvldbint.xdr.o \
@@ -783,6 +787,7 @@ JUAFSOBJ = \
        $(JUAFS)/rx_conncache.o \
        $(JUAFS)/rx_call.o \
        $(JUAFS)/rx_conn.o \
+       $(JUAFS)/rx_peer.o \
        $(JUAFS)/xdr_rx.o \
        $(JUAFS)/Kvldbint.cs.o \
        $(JUAFS)/Kvldbint.xdr.o \
@@ -988,6 +993,8 @@ $(UOBJ)/rx_call.o: $(TOP_SRCDIR)/rx/rx_call.c
        $(CRULE1)
 $(UOBJ)/rx_conn.o: $(TOP_SRCDIR)/rx/rx_conn.c
        $(CRULE1)
+$(UOBJ)/rx_peer.o: $(TOP_SRCDIR)/rx/rx_peer.c
+       $(CRULE1)
 $(UOBJ)/xdr_rx.o: $(TOP_SRC_RX)/xdr_rx.c
        $(CRULE1)
 $(UOBJ)/xdr_int32.o: $(TOP_SRC_RX)/xdr_int32.c
@@ -1289,6 +1296,8 @@ $(PICOBJ)/rx_call.o: $(TOP_SRCDIR)/rx/rx_call.c
        $(CRULEPIC)
 $(PICOBJ)/rx_conn.o: $(TOP_SRCDIR)/rx/rx_conn.c
        $(CRULEPIC)
+$(PICOBJ)/rx_peer.o: $(TOP_SRCDIR)/rx/rx_peer.c
+       $(CRULEPIC)
 $(PICOBJ)/xdr_rx.o: $(TOP_SRC_RX)/xdr_rx.c
        $(CRULEPIC)
 $(PICOBJ)/xdr_int32.o: $(TOP_SRC_RX)/xdr_int32.c
@@ -1592,6 +1601,8 @@ $(WEBOBJ)/rx_call.o: $(TOP_SRCDIR)/rx_rx_call.c
        $(CRULE2)
 $(WEBOBJ)/rx_conn.o: $(TOP_SRCDIR)/rx/rx_conn.c
        $(CRULE2)
+$(WEBOBJ)/rx_peer.o: $(TOP_SRCDIR)/rx/rx_peer.c
+       $(CRULE2)
 $(WEBOBJ)/xdr_rx.o: $(TOP_SRC_RX)/xdr_rx.c
        $(CRULE2)
 $(WEBOBJ)/afs_usrops.o: $(TOP_SRC_AFS)/UKERNEL/afs_usrops.c
@@ -1899,6 +1910,8 @@ $(JUAFS)/rx_call.o: $(TOP_SRC_RX)/rx_call.c
        $(CRULE1)
 $(JUAFS)/rx_conn.o: $(TOP_SRC_RX)/rx_conn.c
        $(CRULE1)
+$(JUAFS)/rx_peer.o: $(TOP_SRC_RX)/rx_peer.c
+       $(CRULE1)
 $(JUAFS)/xdr_rx.o: $(TOP_SRC_RX)/xdr_rx.c
        $(CRULE1)
 $(JUAFS)/xdr_int64.o: $(TOP_SRC_RX)/xdr_int64.c
index 8a2dc22..63108ed 100644 (file)
@@ -22,8 +22,9 @@ XDROBJS = xdr_arrayn.o ${XDROBJS_common}
 
 RXOBJS_common = rx_clock.o rx_call.o rx_conn.o rx_event.o rx_user.o rx_lwp.o \
                rx.o rx_null.o rx_globals.o rx_getaddr.o rx_misc.o rx_packet.o \
-               rx_rdwr.o rx_trace.o rx_conncache.o rx_opaque.o rx_identity.o \
-               rx_stats.o xdr_int32.o xdr_int64.o xdr_update.o xdr_refernce.o
+               rx_peer.o rx_rdwr.o rx_trace.o rx_conncache.o rx_opaque.o \
+               rx_identity.o rx_stats.o \
+               xdr_int32.o xdr_int64.o xdr_update.o xdr_refernce.o
 
 RXOBJS = ${RXOBJS_common} 
 
index 7fa9959..b386e31 100644 (file)
@@ -36,7 +36,7 @@ RXOBJS = $(OUT)\rx_event.obj $(OUT)\rx_clock_nt.obj $(OUT)\rx_user.obj \
         $(OUT)\rx_packet.obj $(OUT)\rx_rdwr.obj $(OUT)\rx_trace.obj \
         $(OUT)\rx_xmit_nt.obj $(OUT)\rx_conncache.obj \
         $(OUT)\rx_opaque.obj $(OUT)\rx_identity.obj $(OUT)\rx_stats.obj \
-         $(OUT)\rx_call.obj $(OUT)\rx_conn.obj
+         $(OUT)\rx_call.obj $(OUT)\rx_conn.obj $(OUT)\rx_peer.obj
 
 MULTIOBJS = $(OUT)\rx_multi.obj
 
index ee134bb..f6aa9ff 100644 (file)
@@ -80,6 +80,7 @@ extern afs_int32 afs_termState;
 #include "rx_stats.h"
 #include "rx_event.h"
 
+#include "rx_peer.h"
 #include "rx_conn.h"
 #include "rx_call.h"
 #include "rx_packet.h"
index 5ab0c46..45f40c7 100644 (file)
@@ -103,6 +103,9 @@ extern void rx_RecordCallStatistics(struct rx_call *call,
                                    unsigned int totalFunc,
                                    int isServer);
 
+/* Peer management */
+extern afs_uint32 rx_HostOf(struct rx_peer *peer);
+extern u_short rx_PortOf(struct rx_peer *peer);
 
 /* Packets */
 
@@ -205,8 +208,6 @@ int ntoh_syserr_conv(int error);
 #define        RX_WAIT     1
 #define        RX_DONTWAIT 0
 
-#define        rx_HostOf(peer)                 ((peer)->host)
-#define        rx_PortOf(peer)                 ((peer)->port)
 #define rx_GetLocalStatus(call, status) ((call)->localStatus)
 
 
@@ -388,73 +389,6 @@ struct rx_serverQueueEntry {
     osi_socket *socketp;
 };
 
-
-/* A peer refers to a peer process, specified by a (host,port) pair.  There may be more than one peer on a given host. */
-#ifdef KDUMP_RX_LOCK
-struct rx_peer_rx_lock {
-    struct rx_peer_rx_lock *next;      /* Next in hash conflict or free list */
-#else
-struct rx_peer {
-    struct rx_peer *next;      /* Next in hash conflict or free list */
-#endif
-#ifdef RX_ENABLE_LOCKS
-    afs_kmutex_t peer_lock;    /* Lock peer */
-#endif                         /* RX_ENABLE_LOCKS */
-    afs_uint32 host;           /* Remote IP address, in net byte order */
-    u_short port;              /* Remote UDP port, in net byte order */
-
-    /* interface mtu probably used for this host  -  includes RX Header */
-    u_short ifMTU;             /* doesn't include IP header */
-
-    /* For garbage collection */
-    afs_uint32 idleWhen;       /* When the refcountwent to zero */
-    afs_int32 refCount;                /* Reference count for this structure (rx_peerHashTable_lock) */
-
-    /* Congestion control parameters */
-    u_char burstSize;          /* Reinitialization size for the burst parameter */
-    u_char burst;              /* Number of packets that can be transmitted right now, without pausing */
-    struct clock burstWait;    /* Delay until new burst is allowed */
-    struct rx_queue congestionQueue;   /* Calls that are waiting for non-zero burst value */
-    int rtt;                   /* Smoothed round trip time, measured in milliseconds/8 */
-    int rtt_dev;               /* Smoothed rtt mean difference, in milliseconds/4 */
-    int nSent;                 /* Total number of distinct data packets sent, not including retransmissions */
-    int reSends;               /* Total number of retransmissions for this peer, since this structure was created */
-
-/* Skew: if a packet is received N packets later than expected (based
- * on packet serial numbers), then we define it to have a skew of N.
- * The maximum skew values allow us to decide when a packet hasn't
- * been received yet because it is out-of-order, as opposed to when it
- * is likely to have been dropped. */
-    afs_uint32 inPacketSkew;   /* Maximum skew on incoming packets */
-    afs_uint32 outPacketSkew;  /* Peer-reported max skew on our sent packets */
-
-    /* the "natural" MTU, excluding IP,UDP headers, is negotiated by the endpoints */
-    u_short natMTU;
-    u_short maxMTU;
-    /* negotiated maximum number of packets to send in a single datagram. */
-    u_short maxDgramPackets;
-    /* local maximum number of packets to send in a single datagram. */
-    u_short ifDgramPackets;
-    /*
-     * MTU, cwind, and nDgramPackets are used to initialize
-     * slow start parameters for new calls. These values are set whenever a
-     * call sends a retransmission and at the end of each call.
-     * congestSeq is incremented each time the congestion parameters are
-     * changed by a call recovering from a dropped packet. A call used
-     * MAX when updating congestion parameters if it started with the
-     * current congestion sequence number, otherwise it uses MIN.
-     */
-    u_short MTU;               /* MTU for AFS 3.4a jumboGrams */
-    u_short cwind;             /* congestion window */
-    u_short nDgramPackets;     /* number packets per AFS 3.5 jumbogram */
-    u_short congestSeq;                /* Changed when a call retransmits */
-    afs_hyper_t bytesSent;     /* Number of bytes sent to this peer */
-    afs_hyper_t bytesReceived; /* Number of bytes received from this peer */
-    struct rx_queue rpcStats;  /* rpc statistic list */
-    int lastReachTime;         /* Last time we verified reachability */
-    afs_int32 maxPacketSize;    /* peer packetsize hint */
-};
-
 #ifndef KDUMP_RX_LOCK
 /* Flag bits for connection structure */
 #define        RX_CONN_MAKECALL_WAITING    1   /* rx_NewCall is waiting for a channel */
index 542df85..110ba60 100644 (file)
@@ -20,6 +20,7 @@
 #include "rx_packet.h"
 #include "rx_internal.h"
 #include "rx_stats.h"
+#include "rx_peer.h"
 
 #ifdef AFS_HPUX110_ENV
 #include "h/tihdr.h"
index a92ae38..c605d7d 100644 (file)
@@ -66,6 +66,7 @@
 #include "rx_internal.h"
 #include "rx_stats.h"
 
+#include "rx_peer.h"
 #include "rx_conn.h"
 #include "rx_call.h"
 
diff --git a/src/rx/rx_peer.c b/src/rx/rx_peer.c
new file mode 100644 (file)
index 0000000..28dda47
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2000, International Business Machines Corporation and others.
+ * All Rights Reserved.
+ *
+ * This software has been released under the terms of the IBM Public
+ * License.  For details, see the LICENSE file in the top-level source
+ * directory or online at http://www.openafs.org/dl/license10.html
+ */
+
+#include <afsconfig.h>
+#include <afs/param.h>
+
+#include <roken.h>
+
+#include "rx.h"
+
+#include "rx_atomic.h"
+#include "rx_clock.h"
+#include "rx_peer.h"
+
+afs_uint32 rx_HostOf(struct rx_peer *peer) {
+    return peer->host;
+}
+
+u_short rx_PortOf(struct rx_peer *peer) {
+    return peer->port;
+}
diff --git a/src/rx/rx_peer.h b/src/rx/rx_peer.h
new file mode 100644 (file)
index 0000000..90fe76b
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2000, International Business Machines Corporation and others.
+ * All Rights Reserved.
+ *
+ * This software has been released under the terms of the IBM Public
+ * License.  For details, see the LICENSE file in the top-level source
+ * directory or online at http://www.openafs.org/dl/license10.html
+ */
+
+#ifndef OPENAFS_RX_PEER_H
+#define OPENAFS_RX_PEER_H
+
+/* A peer refers to a peer process, specified by a (host,port) pair.  There may
+ * be more than one peer on a given host. */
+
+#ifdef KDUMP_RX_LOCK
+struct rx_peer_rx_lock {
+    struct rx_peer_rx_lock *next;      /* Next in hash conflict or free list */
+#else
+struct rx_peer {
+    struct rx_peer *next;      /* Next in hash conflict or free list */
+#endif
+#ifdef RX_ENABLE_LOCKS
+    afs_kmutex_t peer_lock;    /* Lock peer */
+#endif                         /* RX_ENABLE_LOCKS */
+    afs_uint32 host;           /* Remote IP address, in net byte order */
+    u_short port;              /* Remote UDP port, in net byte order */
+
+    /* interface mtu probably used for this host  -  includes RX Header */
+    u_short ifMTU;             /* doesn't include IP header */
+
+    /* For garbage collection */
+    afs_uint32 idleWhen;       /* When the refcountwent to zero */
+    afs_int32 refCount;                /* Reference count for this structure (rx_peerHashTable_lock) */
+
+    /* Congestion control parameters */
+    u_char burstSize;          /* Reinitialization size for the burst parameter */
+    u_char burst;              /* Number of packets that can be transmitted right now, without pausing */
+    struct clock burstWait;    /* Delay until new burst is allowed */
+    struct rx_queue congestionQueue;   /* Calls that are waiting for non-zero burst value */
+    int rtt;                   /* Smoothed round trip time, measured in milliseconds/8 */
+    int rtt_dev;               /* Smoothed rtt mean difference, in milliseconds/4 */
+    int nSent;                 /* Total number of distinct data packets sent, not including retransmissions */
+    int reSends;               /* Total number of retransmissions for this peer, since this structure was created */
+
+/* Skew: if a packet is received N packets later than expected (based
+ * on packet serial numbers), then we define it to have a skew of N.
+ * The maximum skew values allow us to decide when a packet hasn't
+ * been received yet because it is out-of-order, as opposed to when it
+ * is likely to have been dropped. */
+    afs_uint32 inPacketSkew;   /* Maximum skew on incoming packets */
+    afs_uint32 outPacketSkew;  /* Peer-reported max skew on our sent packets */
+
+    /* the "natural" MTU, excluding IP,UDP headers, is negotiated by the endpoints */
+    u_short natMTU;
+    u_short maxMTU;
+    /* negotiated maximum number of packets to send in a single datagram. */
+    u_short maxDgramPackets;
+    /* local maximum number of packets to send in a single datagram. */
+    u_short ifDgramPackets;
+    /*
+     * MTU, cwind, and nDgramPackets are used to initialize
+     * slow start parameters for new calls. These values are set whenever a
+     * call sends a retransmission and at the end of each call.
+     * congestSeq is incremented each time the congestion parameters are
+     * changed by a call recovering from a dropped packet. A call used
+     * MAX when updating congestion parameters if it started with the
+     * current congestion sequence number, otherwise it uses MIN.
+     */
+    u_short MTU;               /* MTU for AFS 3.4a jumboGrams */
+    u_short cwind;             /* congestion window */
+    u_short nDgramPackets;     /* number packets per AFS 3.5 jumbogram */
+    u_short congestSeq;                /* Changed when a call retransmits */
+    afs_hyper_t bytesSent;     /* Number of bytes sent to this peer */
+    afs_hyper_t bytesReceived; /* Number of bytes received from this peer */
+    struct rx_queue rpcStats;  /* rpc statistic list */
+    int lastReachTime;         /* Last time we verified reachability */
+    afs_int32 maxPacketSize;    /* peer packetsize hint */
+};
+
+#endif
index 2cc9c2d..aa85c26 100644 (file)
@@ -48,6 +48,7 @@
 #include "rx_atomic.h"
 #include "rx_globals.h"
 #include "rx_stats.h"
+#include "rx_peer.h"
 #include "rx_packet.h"
 
 #ifdef AFS_PTHREAD_ENV
index 8fdb756..c4cfa37 100644 (file)
@@ -78,6 +78,7 @@ RXOBJS =\
        rx_stats.o \
        rx_trace.o \
        rx_multi.o \
+       rx_peer.o \
        rx_conn.o \
         rx_call.o
 
@@ -168,9 +169,12 @@ rx_conncache.o: ${RX}/rx_conncache.c
 rx_call.o: ${RX}/rx_call.c
        $(AFS_CCRULE) $(RX)/rx_call.c
 
-rx_conn.o : ${RX}/rx_conn.c
+rx_conn.o: ${RX}/rx_conn.c
        $(AFS_CCRULE) $(RX)/rx_conn.c
 
+rx_peer.o: ${RX}/rx_peer.c
+       $(AFS_CCRULE) $(RX)/rx_peer.c
+
 rx_null.o: ${RX}/rx_null.c
        $(AFS_CCRULE) $(RX)/rx_null.c
 
index e85162e..95841c4 100755 (executable)
        rx_GetSecurityHeaderSize;
        rx_SetSecurityHeaderSize;
        rx_SetSecurityMaxTrailerSize;
+       rx_HostOf;
+       rx_PortOf;
     local:
        *;
 };
index 28a5de0..c2658ff 100644 (file)
@@ -5505,7 +5505,7 @@ common_GiveUpCallBacks(struct rx_call *acall, struct AFSCBFids *FidArray,
     if (!FidArray && !CallBackArray) {
        ViceLog(1,
                ("SAFS_GiveUpAllCallBacks: host=%x\n",
-                (rx_PeerOf(tcon) ? rx_PeerOf(tcon)->host : 0)));
+                (rx_PeerOf(tcon) ? rx_HostOf(rx_PeerOf(tcon)) : 0)));
        errorCode = GetClient(tcon, &client);
        if (!errorCode) {
            H_LOCK;
@@ -5518,7 +5518,7 @@ common_GiveUpCallBacks(struct rx_call *acall, struct AFSCBFids *FidArray,
            ViceLog(0,
                    ("GiveUpCallBacks: #Fids %d < #CallBacks %d, host=%x\n",
                     FidArray->AFSCBFids_len, CallBackArray->AFSCBs_len,
-                    (rx_PeerOf(tcon) ? rx_PeerOf(tcon)->host : 0)));
+                    (rx_PeerOf(tcon) ? rx_HostOf(rx_PeerOf(tcon)) : 0)));
            errorCode = EINVAL;
            goto Bad_GiveUpCallBacks;
        }