]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
rx: Make struct rx_connection private
authorSimon Wilkinson <sxw@your-file-system.com>
Tue, 15 Nov 2011 10:40:44 +0000 (10:40 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Sun, 4 Dec 2011 04:44:20 +0000 (20:44 -0800)
Move the rx_connection structure into a private header file, so that
it is only visible from within the rx module. This allows us to use
types within the structure that are not visible to everywhere that
includes rx.h, as well as being a step towards a more stable ABI for
RX.

Add accessor functions for all of the connection members which are
currently used by external callers, and modify those accessors
which were implemented as macros to also be functions.

Change all external access to the connection structures to use these
new functions.

Change-Id: Ife67e63f37cb04273fbfc9079db3907bde78ab98
Reviewed-on: http://gerrit.openafs.org/6180
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
32 files changed:
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_conn.c [new file with mode: 0644]
src/rx/rx_conn.h [new file with mode: 0644]
src/rx/rx_conncache.c
src/rx/rx_packet.c
src/rx/rx_packet.h
src/rx/rx_rdwr.c
src/rx/rx_trace.c
src/rx/test/rxperf.c
src/rx/test/testclient.c
src/rx/test/testserver.c
src/rxgen/rpc_parse.c
src/rxkad/rxkad_client.c
src/rxkad/rxkad_common.c
src/rxkad/rxkad_server.c
src/shlibafsrpc/Makefile.in
src/shlibafsrpc/libafsrpc.map
src/sys/rmtsyss.c
src/viced/afsfileprocs.c
src/viced/host.c
src/volser/vos.c
tests/rpctestlib/rpc_test_procs.h

index 794d85a014d0c28059dc9e3cfae88dd45c10b929..d286d50de239be554236e9c16bf3a069b78046c2 100644 (file)
@@ -554,8 +554,8 @@ Unlock(struct cmd_syndesc *as, void *arock)
        if (code && (code != UNOSERVERS)) {
            server = 0;
            if (conn && conn->conns[count - 1]
-               && conn->conns[count - 1]->peer) {
-               server = conn->conns[count - 1]->peer->host;
+               && rx_PeerOf(conn->conns[count - 1])) {
+               server = rx_PeerOf(conn->conns[count - 1])->host;
            }
            afs_com_err(whoami, code,
                    "so %s.%s may still be locked (on server %d.%d.%d.%d)",
index 9d2d04e28632b3f4dfe0daea10a1ef7b7c9713ea..43fb48107661c0cb848a0e24b6f315596ba0c667 100644 (file)
@@ -647,7 +647,7 @@ kamCreateUser(struct rx_call *call, char *aname, char *ainstance,
        return code;
     }
     code = ubik_EndTrans(tt);
-    KALOG(aname, ainstance, NULL, NULL, NULL, call->conn->peer->host,
+    KALOG(aname, ainstance, NULL, NULL, NULL, rx_PeerOf(call->conn)->host,
          LOG_CRUSER);
     return code;
 }
@@ -923,7 +923,7 @@ kamSetPassword(struct rx_call *call, char *aname, char *ainstance,
        goto abort;
 
     code = ubik_EndTrans(tt);
-    KALOG(aname, ainstance, NULL, NULL, NULL, call->conn->peer->host,
+    KALOG(aname, ainstance, NULL, NULL, NULL, rx_PeerOf(call->conn)->host,
          LOG_CHPASSWD);
     return code;
 
@@ -1246,14 +1246,14 @@ Authenticate(int version, struct rx_call *call, char *aname, char *ainstance,
     DES_pcbc_encrypt(oanswer->SeqBody, oanswer->SeqBody, oanswer->SeqLen,
                     &user_schedule, ktc_to_cblockptr(&tentry.key), ENCRYPT);
     code = ubik_EndTrans(tt);
-    KALOG(aname, ainstance, sname, sinst, NULL, call->conn->peer->host,
+    KALOG(aname, ainstance, sname, sinst, NULL, rx_PeerOf(call->conn)->host,
          LOG_AUTHENTICATE);
     return code;
 
   abort:
     COUNT_ABO;
     ubik_AbortTrans(tt);
-    KALOG(aname, ainstance, sname, sinst, NULL, call->conn->peer->host,
+    KALOG(aname, ainstance, sname, sinst, NULL, rx_PeerOf(call->conn)->host,
          LOG_AUTHFAILED);
     return code;
 }
@@ -1455,7 +1455,7 @@ kamSetFields(struct rx_call *call,
        goto abort;
 
     code = ubik_EndTrans(tt);
-    KALOG(aname, ainstance, NULL, NULL, NULL, call->conn->peer->host,
+    KALOG(aname, ainstance, NULL, NULL, NULL, rx_PeerOf(call->conn)->host,
          LOG_SETFIELDS);
     return code;
 
@@ -1528,7 +1528,7 @@ kamDeleteUser(struct rx_call *call, char *aname, char *ainstance)
        goto abort;
 
     code = ubik_EndTrans(tt);
-    KALOG(aname, ainstance, NULL, NULL, NULL, call->conn->peer->host,
+    KALOG(aname, ainstance, NULL, NULL, NULL, rx_PeerOf(call->conn)->host,
          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),
-         call->conn->peer->host, LOG_GETTICKET);
+         rx_PeerOf(call->conn)->host, LOG_GETTICKET);
     return code;
 
   abort:
@@ -2258,7 +2258,7 @@ SKAM_Unlock(struct rx_call *call,
     kaux_write(to, 0, 0);      /* zero failure counters at this offset */
 
     code = ubik_EndTrans(tt);
-    KALOG(aname, ainstance, NULL, NULL, NULL, call->conn->peer->host,
+    KALOG(aname, ainstance, NULL, NULL, NULL, rx_PeerOf(call->conn)->host,
          LOG_UNLOCK);
     goto exit;
 
index 3b8fcbea0aeb31aa6038c1c937e952e2a8deb053..d91a8f7414557450b4f161b3b16bd2733bd2dbe8 100644 (file)
@@ -136,6 +136,7 @@ AFSAOBJS = \
        Kvice.cs.o      \
        fcrypt.o                \
        rx.o            \
+       rx_conn.o       \
        rx_rdwr.o       \
        rx_clock.o      \
        rx_event.o      \
@@ -229,6 +230,7 @@ AFSPAGOBJS = \
        xdr_int32.o     \
        xdr_int64.o     \
        rx.o            \
+       rx_conn.o       \
        rx_rdwr.o       \
        rx_clock.o      \
        rx_event.o      \
@@ -356,6 +358,8 @@ afs_vnop_write.o: $(TOP_SRC_VNOPS)/afs_vnop_write.c
        $(CRULE_NOOPT) $(TOP_SRC_VNOPS)/afs_vnop_write.c
 afs_volume.o: $(TOP_SRC_AFS)/afs_volume.c
        $(CRULE_OPT) $(TOP_SRC_AFS)/afs_volume.c
+rx_conn.o: $(TOP_SRC_RX)/rx_conn.c
+       $(CRULE_OPT) $(TOP_SRC_RX)/rx_conn.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 39c5ee6d67f25590d233251ebc40397f39e7fddd..35f3cc6d447b710425b3c5c90badb8f19ab0f37f 100644 (file)
@@ -63,6 +63,7 @@ RXOBJS =\
        rx.o \
        rx_null.o \
        rx_opaque.o \
+       rx_conn.o \
        rx_conncache.o \
        rx_globals.o \
        rx_identity.o \
@@ -141,6 +142,9 @@ rx.o: ${RX}/rx.c
 rx_conncache.o: ${RX}/rx_conncache.c
        $(AFS_CCRULE) $(RX)/rx_conncache.c
 
+rx_conn.o: ${RX}/rx_conn.c
+       $(AFS_CCRULE) $(RX)/rx_conn.c
+
 rx_null.o: ${RX}/rx_null.c
        $(AFS_CCRULE) $(RX)/rx_null.c
 
index 18161d30289db5723e2062336ae847ad158f187d..311f80f677e62d256396c099cdb144935a52fee7 100644 (file)
@@ -37,7 +37,8 @@ RXOBJS = $(OUT)\rx_event.obj $(OUT)\rx_user.obj $(OUT)\rx_pthread.obj \
         $(OUT)\rx_globals.obj $(OUT)\rx_getaddr.obj $(OUT)\rx_misc.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_identity.obj $(OUT)\rx_stats.obj \
+         $(OUT)\rx_conn.obj
 
 RXSTATBJS = $(OUT)\rxstat.obj $(OUT)\rxstat.ss.obj $(OUT)\rxstat.xdr.obj $(OUT)\rxstat.cs.obj
 
index 1afbbbabecdf8742e1e8a98ee2114b547e59bd2a..91bff88c5136bb76d08d644c42a93414acacd785 100755 (executable)
@@ -297,6 +297,28 @@ EXPORTS
        rx_GetThreadNum                         @305
        rx_SetThreadNum                         @306
 
+        rx_SetConnectionEpoch                   @307
+        rx_GetConnectionEpoch                   @308
+        rx_SetConnectionId                      @309
+        rx_GetConnectionId                      @310
+        rx_GetSecurityData                      @311
+        rx_SetSecurityData                      @312
+        rx_IsUsingPktCksum                      @313
+        rx_SetSecurityHeaderSize                @314
+        rx_GetSecurityHeaderSize                @315
+        rx_SetSecurityMaxTrailerSize            @316
+        rx_GetSecurityMaxTrailerSize            @317
+        rx_SetServerConnIdleDeadErr             @318
+        rx_SetMsgsizeRetryErr                   @319
+        rx_IsServerConn                         @320
+        rx_IsClientConn                         @321
+        rx_SecurityObjectOf                     @322
+        rx_PeerOf                               @323
+        rx_ServiceIdOf                          @324
+        rx_SecurityClassOf                      @325
+        rx_ServiceOf                            @326
+        rx_ConnError                            @327
+
 ; for performance testing
         rx_TSFPQGlobSize                        @2001 DATA
         rx_TSFPQLocalMax                        @2002 DATA
index 4de08f427f893d35b8a3eb7672e2d10d90170df5..6eda73b428ea320d5bd12e987296b2915b86db71 100644 (file)
@@ -201,6 +201,7 @@ UAFSOBJ = \
        $(UOBJ)/rx_stats.o \
        $(UOBJ)/rx_packet.o \
        $(UOBJ)/rx_conncache.o \
+       $(UOBJ)/rx_conn.o \
        $(UOBJ)/xdr_rx.o \
        $(UOBJ)/Kvldbint.cs.o \
        $(UOBJ)/Kvldbint.xdr.o \
@@ -346,6 +347,7 @@ PICUAFSOBJ = \
        $(PICOBJ)/rx_stats.o \
        $(PICOBJ)/rx_packet.o \
        $(PICOBJ)/rx_conncache.o \
+       $(PICOBJ)/rx_conn.o \
        $(PICOBJ)/xdr_rx.o \
        $(PICOBJ)/Kvldbint.cs.o \
        $(PICOBJ)/Kvldbint.xdr.o \
@@ -491,6 +493,7 @@ AFSWEBOBJ = \
        $(WEBOBJ)/rx_stats.o \
        $(WEBOBJ)/rx_packet.o \
        $(WEBOBJ)/rx_conncache.o \
+       $(WEBOBJ)/rx_conn.o \
        $(WEBOBJ)/xdr_rx.o \
        $(WEBOBJ)/Kvldbint.cs.o \
        $(WEBOBJ)/Kvldbint.xdr.o \
@@ -630,6 +633,7 @@ AFSWEBOBJKRB = \
        $(WEBOBJ)/rx_stats.o \
        $(WEBOBJ)/rx_packet.o \
        $(WEBOBJ)/rx_conncache.o \
+       $(WEBOBJ)/rx_conn.o \
        $(WEBOBJ)/xdr_rx.o \
        $(WEBOBJ)/Kvldbint.cs.o \
        $(WEBOBJ)/Kvldbint.xdr.o \
@@ -773,6 +777,7 @@ JUAFSOBJ = \
        $(JUAFS)/rx_stats.o \
        $(JUAFS)/rx_packet.o \
        $(JUAFS)/rx_conncache.o \
+       $(JUAFS)/rx_conn.o \
        $(JUAFS)/xdr_rx.o \
        $(JUAFS)/Kvldbint.cs.o \
        $(JUAFS)/Kvldbint.xdr.o \
@@ -974,6 +979,8 @@ $(UOBJ)/rx_packet.o: $(TOP_SRC_RX)/rx_packet.c
        $(CRULE1)
 $(UOBJ)/rx_conncache.o: $(TOP_SRCDIR)/rx/rx_conncache.c
        $(CRULE1)
+$(UOBJ)/rx_conn.o: $(TOP_SRCDIR)/rx/rx_conn.c
+       $(CRULE1)
 $(UOBJ)/xdr_rx.o: $(TOP_SRC_RX)/xdr_rx.c
        $(CRULE1)
 $(UOBJ)/xdr_int32.o: $(TOP_SRC_RX)/xdr_int32.c
@@ -1271,6 +1278,8 @@ $(PICOBJ)/rx_packet.o: $(TOP_SRC_RX)/rx_packet.c
        $(CRULEPIC)
 $(PICOBJ)/rx_conncache.o: $(TOP_SRCDIR)/rx/rx_conncache.c
        $(CRULEPIC)
+$(PICOBJ)/rx_conn.o: $(TOP_SRCDIR)/rx/rx_conn.c
+       $(CRULEPIC)
 $(PICOBJ)/xdr_rx.o: $(TOP_SRC_RX)/xdr_rx.c
        $(CRULEPIC)
 $(PICOBJ)/xdr_int32.o: $(TOP_SRC_RX)/xdr_int32.c
@@ -1570,6 +1579,8 @@ $(WEBOBJ)/rx_packet.o: $(TOP_SRC_RX)/rx_packet.c
        $(CRULE2)
 $(WEBOBJ)/rx_conncache.o: $(TOP_SRCDIR)/rx/rx_conncache.c
        $(CRULE2)
+$(WEBOBJ)/rx_conn.o: $(TOP_SRCDIR)/rx/rx_conn.c
+       $(CRULE2)
 $(WEBOBJ)/xdr_rx.o: $(TOP_SRC_RX)/xdr_rx.c
        $(CRULE2)
 $(WEBOBJ)/afs_usrops.o: $(TOP_SRC_AFS)/UKERNEL/afs_usrops.c
@@ -1873,6 +1884,8 @@ $(JUAFS)/rx_packet.o: $(TOP_SRC_RX)/rx_packet.c
        $(CRULE1)
 $(JUAFS)/rx_conncache.o: $(TOP_SRCDIR)/rx/rx_conncache.c
        $(CRULE1)
+$(JUAFS)/rx_conn.o: $(TOP_SRC_RX)/rx_conn.c
+       $(CRULE1)
 $(JUAFS)/xdr_rx.o: $(TOP_SRC_RX)/xdr_rx.c
        $(CRULE1)
 $(JUAFS)/xdr_int64.o: $(TOP_SRC_RX)/xdr_int64.c
index 3c35b39c4dcfe0b7a329ef3c19662b93c4171f81..ef783f5a5391aad9a4c6ec3e651ab403097ac842 100644 (file)
@@ -20,7 +20,7 @@ XDROBJS_common = xdr.o xdr_array.o xdr_rx.o xdr_mem.o xdr_len.o xdr_afsuuid.o
 
 XDROBJS = xdr_arrayn.o ${XDROBJS_common}
 
-RXOBJS_common = rx_clock.o rx_event.o rx_user.o rx_lwp.o rx.o rx_null.o \
+RXOBJS_common = rx_clock.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
index 1ae68cbc5611bbfcb057e5213e577c844e066612..4b1f6dbd74f86deba3afbbf6de75f56f881e3167 100644 (file)
@@ -35,7 +35,8 @@ RXOBJS = $(OUT)\rx_event.obj $(OUT)\rx_clock_nt.obj $(OUT)\rx_user.obj \
         $(OUT)\rx_globals.obj $(OUT)\rx_getaddr.obj $(OUT)\rx_misc.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_opaque.obj $(OUT)\rx_identity.obj $(OUT)\rx_stats.obj \
+         $(OUT)\rx_conn.obj
 
 MULTIOBJS = $(OUT)\rx_multi.obj
 
index 1c5622e0b24a1b3d831bb9aa754295c014230941..735c3de0d4e359795899005dabbe31661a6fde3d 100644 (file)
@@ -80,6 +80,8 @@ extern afs_int32 afs_termState;
 #include "rx_stats.h"
 #include "rx_event.h"
 
+#include "rx_conn.h"
+
 #include <afs/rxgen_consts.h>
 
 #ifndef KERNEL
index 97a9f493c41a012b6645d809651b7edfed662a97..c0d26100c9a2e3329961b23f27773fc5e7e8d95e 100644 (file)
 #include "rx_null.h"
 #include "rx_multi.h"
 
+/* These items are part of the new RX API. They're living in this section
+ * for now, to keep them separate from everything else... */
+
+/* Connection management */
+struct rx_connection;
+
+extern void rx_SetConnectionEpoch(struct rx_connection *conn, int epoch);
+extern int  rx_GetConnectionEpoch(struct rx_connection *conn);
+extern void rx_SetConnectionId(struct rx_connection *conn, int id);
+extern int  rx_GetConnectionId(struct rx_connection *conn);
+extern void *rx_GetSecurityData(struct rx_connection *conn);
+extern void  rx_SetSecurityData(struct rx_connection *conn, void *data);
+extern int  rx_IsUsingPktCksum(struct rx_connection *conn);
+extern void rx_SetSecurityHeaderSize(struct rx_connection *conn, int size);
+extern int  rx_GetSecurityHeaderSize(struct rx_connection *conn);
+extern void rx_SetSecurityMaxTrailerSize(struct rx_connection *conn, int size);
+extern int  rx_GetSecurityMaxTrailerSize(struct rx_connection *conn);
+extern void rx_SetServerConnIdleDeadErr(struct rx_connection *conn, int err);
+extern void rx_SetMsgsizeRetryErr(struct rx_connection *conn, int err);
+extern int  rx_IsServerConn(struct rx_connection *conn);
+extern int  rx_IsClientConn(struct rx_connection *conn);
+extern struct rx_securityClass *rx_SecurityObjectOf(const struct rx_connection *);
+extern struct rx_peer *rx_PeerOf(struct rx_connection *);
+extern u_short rx_ServiceIdOf(struct rx_connection *);
+extern int rx_SecurityClassOf(struct rx_connection *);
+extern struct rx_service *rx_ServiceOf(struct rx_connection *);
+extern int rx_ConnError(struct rx_connection *);
+
 /* Configurable parameters */
 #define        RX_IDLE_DEAD_TIME       60      /* default idle dead time */
 #define        RX_MAX_SERVICES         20      /* Maximum number of services that may be installed */
@@ -95,23 +123,12 @@ int ntoh_syserr_conv(int error);
 #define        RX_DONTWAIT 0
 
 #define        rx_ConnectionOf(call)           ((call)->conn)
-#define        rx_PeerOf(conn)                 ((conn)->peer)
 #define        rx_HostOf(peer)                 ((peer)->host)
 #define        rx_PortOf(peer)                 ((peer)->port)
 #define        rx_SetLocalStatus(call, status) ((call)->localStatus = (status))
 #define rx_GetLocalStatus(call, status) ((call)->localStatus)
 #define        rx_GetRemoteStatus(call)        ((call)->remoteStatus)
 #define        rx_Error(call)                  ((call)->error)
-#define        rx_ConnError(conn)              ((conn)->error)
-#define        rx_IsServerConn(conn)           ((conn)->type == RX_SERVER_CONNECTION)
-#define        rx_IsClientConn(conn)           ((conn)->type == RX_CLIENT_CONNECTION)
-/* Don't use these; use the IsServerConn style */
-#define        rx_ServerConn(conn)             ((conn)->type == RX_SERVER_CONNECTION)
-#define        rx_ClientConn(conn)             ((conn)->type == RX_CLIENT_CONNECTION)
-#define rx_IsUsingPktCksum(conn)       ((conn)->flags & RX_CONN_USING_PACKET_CKSUM)
-#define rx_ServiceIdOf(conn)           ((conn)->serviceId)
-#define        rx_SecurityClassOf(conn)        ((conn)->securityIndex)
-#define rx_SecurityObjectOf(conn)      ((conn)->securityObject)
 
 static_inline int
 rx_IsLoopbackAddr(afs_uint32 addr)
@@ -166,14 +183,10 @@ rx_IsLoopbackAddr(afs_uint32 addr)
 /* Enable or disable asymmetric client checking for a service */
 #define rx_SetCheckReach(service, x) ((service)->checkReach = (x))
 
-#define rx_SetServerConnIdleDeadErr(conn,err) ((conn)->idleDeadErr = (err))
 
 /* Set the overload threshold and the overload error */
 #define rx_SetBusyThreshold(threshold, code) (rx_BusyThreshold=(threshold),rx_BusyError=(code))
 
-/* Set the error to use for retrying a connection during MTU tuning */
-#define rx_SetMsgsizeRetryErr(conn, err) ((conn)->msgsizeRetryErr = (err))
-
 /* If this flag is set,no new requests are processed by rx, all new requests are
 returned with an error code of RX_CALL_DEAD ( transient error ) */
 #define        rx_SetRxTranquil()              (rx_tranquil = 1)
@@ -213,76 +226,6 @@ returned with an error code of RX_CALL_DEAD ( transient error ) */
 
 #define rx_PutConnection(conn) rx_DestroyConnection(conn)
 
-/* A connection is an authenticated communication path, allowing
-   limited multiple asynchronous conversations. */
-#ifdef KDUMP_RX_LOCK
-struct rx_connection_rx_lock {
-    struct rx_connection_rx_lock *next;        /*  on hash chain _or_ free list */
-    struct rx_peer_rx_lock *peer;
-#else
-struct rx_connection {
-    struct rx_connection *next;        /*  on hash chain _or_ free list */
-    struct rx_peer *peer;
-#endif
-#ifdef RX_ENABLE_LOCKS
-    afs_kmutex_t conn_call_lock;       /* locks conn_call_cv */
-    afs_kcondvar_t conn_call_cv;
-    afs_kmutex_t conn_data_lock;       /* locks packet data */
-#endif
-    afs_uint32 epoch;          /* Process start time of client side of connection */
-    afs_uint32 cid;            /* Connection id (call channel is bottom bits) */
-    afs_int32 error;           /* If this connection is in error, this is it */
-#ifdef KDUMP_RX_LOCK
-    struct rx_call_rx_lock *call[RX_MAXCALLS];
-#else
-    struct rx_call *call[RX_MAXCALLS];
-#endif
-    afs_uint32 callNumber[RX_MAXCALLS];        /* Current call numbers */
-    afs_uint32 rwind[RX_MAXCALLS];
-    u_short twind[RX_MAXCALLS];
-    afs_uint32 lastBusy[RX_MAXCALLS]; /* timestamp of the last time we got an
-                                       * RX_PACKET_TYPE_BUSY packet for this
-                                       * call slot, or 0 if the slot is not busy */
-    afs_uint32 serial;         /* Next outgoing packet serial number */
-    afs_uint32 lastSerial;     /* # of last packet received, for computing skew */
-    afs_int32 lastPacketSize; /* last >max attempt */
-    afs_int32 lastPacketSizeSeq; /* seq number of attempt */
-    afs_int32 lastPingSize; /* last MTU ping attempt */
-    afs_int32 lastPingSizeSer; /* serial of last MTU ping attempt */
-    struct rxevent *challengeEvent;    /* Scheduled when the server is challenging a     */
-    struct rxevent *delayedAbortEvent; /* Scheduled to throttle looping client */
-    struct rxevent *checkReachEvent;   /* Scheduled when checking reachability */
-    int abortCount;            /* count of abort messages sent */
-    /* client-- to retransmit the challenge */
-    struct rx_service *service;        /* used by servers only */
-    u_short serviceId;         /* To stamp on requests (clients only) */
-    afs_int32 refCount;                /* Reference count (rx_refcnt_mutex) */
-    u_char flags;              /* Defined below - (conn_data_lock) */
-    u_char type;               /* Type of connection, defined below */
-    u_char secondsUntilPing;   /* how often to ping for each active call */
-    u_char securityIndex;      /* corresponds to the security class of the */
-    /* securityObject for this conn */
-    struct rx_securityClass *securityObject;   /* Security object for this connection */
-    void *securityData;                /* Private data for this conn's security class */
-    u_short securityHeaderSize;        /* Length of security module's packet header data */
-    u_short securityMaxTrailerSize;    /* Length of security module's packet trailer data */
-
-    int timeout;               /* Overall timeout per call (seconds) for this conn */
-    int lastSendTime;          /* Last send time for this connection */
-    u_short secondsUntilDead;  /* Maximum silence from peer before RX_CALL_DEAD */
-    u_short hardDeadTime;      /* hard max for call execution */
-    u_short idleDeadTime;      /* max time a call can be idle (no data) */
-    u_char ackRate;            /* how many packets between ack requests */
-    u_char makeCallWaiters;    /* how many rx_NewCalls are waiting */
-    afs_int32 idleDeadErr;
-    afs_int32 secondsUntilNatPing;     /* how often to ping conn */
-    struct rxevent *natKeepAliveEvent; /* Scheduled to keep connection open */
-    afs_int32 msgsizeRetryErr;
-    int nSpecific;             /* number entries in specific data */
-    void **specific;           /* pointer to connection specific data */
-};
-
-
 /* A service is installed by rx_NewService, and specifies a service type that
  * is exported by this process.  Incoming calls are stamped with the service
  * type, and must match an installed service for the call to be accepted.
diff --git a/src/rx/rx_conn.c b/src/rx/rx_conn.c
new file mode 100644 (file)
index 0000000..91a4f5f
--- /dev/null
@@ -0,0 +1,138 @@
+/*
+ * Copyright 2000, International Business Machines Corporation and others.
+ * Copyright 2011, Your File System Inc
+ * 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_conn.h"
+
+void
+rx_SetConnectionEpoch(struct rx_connection *conn, afs_int32 epoch) {
+    conn->epoch = epoch;
+}
+
+int
+rx_GetConnectionEpoch(struct rx_connection *conn) {
+    return conn->epoch;
+}
+
+void
+rx_SetConnectionId(struct rx_connection *conn, int cid) {
+    conn->cid = cid;
+}
+
+int
+rx_GetConnectionId(struct rx_connection *conn) {
+    return conn->cid;
+}
+
+void
+rx_SetSecurityData(struct rx_connection *conn, void *data) {
+    conn->securityData = data;
+}
+
+void *
+rx_GetSecurityData(struct rx_connection *conn)
+{
+    return conn->securityData;
+}
+
+int
+rx_IsUsingPktCksum(struct rx_connection *conn)
+{
+    return conn->flags & RX_CONN_USING_PACKET_CKSUM;
+}
+
+void
+rx_SetSecurityHeaderSize(struct rx_connection *conn, int size)
+{
+    conn->securityHeaderSize = size;
+}
+
+int
+rx_GetSecurityHeaderSize(struct rx_connection *conn)
+{
+    return conn->securityHeaderSize;
+}
+
+void
+rx_SetSecurityMaxTrailerSize(struct rx_connection *conn, int size)
+{
+    conn->securityMaxTrailerSize = size;
+}
+
+int
+rx_GetSecurityMaxTrailerSize(struct rx_connection *conn)
+{
+    return conn->securityMaxTrailerSize;
+}
+
+void
+rx_SetServerConnIdleDeadErr(struct rx_connection *conn, int err)
+{
+    conn->idleDeadErr = err;
+}
+
+void
+rx_SetMsgsizeRetryErr(struct rx_connection *conn, int err)
+{
+    conn->msgsizeRetryErr = err;
+}
+
+int
+rx_IsServerConn(struct rx_connection *conn)
+{
+    return conn->type == RX_SERVER_CONNECTION;
+}
+
+int
+rx_IsClientConn(struct rx_connection *conn)
+{
+    return conn->type == RX_CLIENT_CONNECTION;
+}
+
+struct rx_peer *
+rx_PeerOf(struct rx_connection *conn)
+{
+    return conn->peer;
+}
+
+u_short
+rx_ServiceIdOf(struct rx_connection *conn)
+{
+    return conn->serviceId;
+}
+
+int
+rx_SecurityClassOf(struct rx_connection *conn)
+{
+    return conn->securityIndex;
+}
+
+struct rx_securityClass *
+rx_SecurityObjectOf(const struct rx_connection *conn)
+{
+    return conn->securityObject;
+}
+
+struct rx_service *
+rx_ServiceOf(struct rx_connection *conn)
+{
+    return conn->service;
+}
+
+int
+rx_ConnError(struct rx_connection *conn)
+{
+    return conn->error;
+}
diff --git a/src/rx/rx_conn.h b/src/rx/rx_conn.h
new file mode 100644 (file)
index 0000000..15b7e83
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ * 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_CONN_H
+#define OPENAFS_RX_CONN_H 1
+
+/* A connection is an authenticated communication path, allowing limited
+ * multiple asynchronous conversations. */
+
+#ifdef KDUMP_RX_LOCK
+struct rx_connection_rx_lock {
+    struct rx_connection_rx_lock *next;        /*  on hash chain _or_ free list */
+    struct rx_peer_rx_lock *peer;
+#else
+struct rx_connection {
+    struct rx_connection *next;        /*  on hash chain _or_ free list */
+    struct rx_peer *peer;
+#endif
+#ifdef RX_ENABLE_LOCKS
+    afs_kmutex_t conn_call_lock;       /* locks conn_call_cv */
+    afs_kcondvar_t conn_call_cv;
+    afs_kmutex_t conn_data_lock;       /* locks packet data */
+#endif
+    afs_uint32 epoch;          /* Process start time of client side of connection */
+    afs_uint32 cid;            /* Connection id (call channel is bottom bits) */
+    afs_int32 error;           /* If this connection is in error, this is it */
+#ifdef KDUMP_RX_LOCK
+    struct rx_call_rx_lock *call[RX_MAXCALLS];
+#else
+    struct rx_call *call[RX_MAXCALLS];
+#endif
+    afs_uint32 callNumber[RX_MAXCALLS];        /* Current call numbers */
+    afs_uint32 rwind[RX_MAXCALLS];
+    u_short twind[RX_MAXCALLS];
+    afs_uint32 lastBusy[RX_MAXCALLS]; /* timestamp of the last time we got an
+                                       * RX_PACKET_TYPE_BUSY packet for this
+                                       * call slot, or 0 if the slot is not busy */
+    afs_uint32 serial;         /* Next outgoing packet serial number */
+    afs_uint32 lastSerial;     /* # of last packet received, for computing skew */
+    afs_int32 lastPacketSize; /* last >max attempt */
+    afs_int32 lastPacketSizeSeq; /* seq number of attempt */
+    afs_int32 lastPingSize; /* last MTU ping attempt */
+    afs_int32 lastPingSizeSer; /* serial of last MTU ping attempt */
+    struct rxevent *challengeEvent;    /* Scheduled when the server is challenging a     */
+    struct rxevent *delayedAbortEvent; /* Scheduled to throttle looping client */
+    struct rxevent *checkReachEvent;   /* Scheduled when checking reachability */
+    int abortCount;            /* count of abort messages sent */
+    /* client-- to retransmit the challenge */
+    struct rx_service *service;        /* used by servers only */
+    u_short serviceId;         /* To stamp on requests (clients only) */
+    afs_int32 refCount;                /* Reference count (rx_refcnt_mutex) */
+    u_char flags;              /* Defined below - (conn_data_lock) */
+    u_char type;               /* Type of connection, defined below */
+    u_char secondsUntilPing;   /* how often to ping for each active call */
+    u_char securityIndex;      /* corresponds to the security class of the */
+    /* securityObject for this conn */
+    struct rx_securityClass *securityObject;   /* Security object for this connection */
+    void *securityData;                /* Private data for this conn's security class */
+    u_short securityHeaderSize;        /* Length of security module's packet header data */
+    u_short securityMaxTrailerSize;    /* Length of security module's packet trailer data */
+
+    int timeout;               /* Overall timeout per call (seconds) for this conn */
+    int lastSendTime;          /* Last send time for this connection */
+    u_short secondsUntilDead;  /* Maximum silence from peer before RX_CALL_DEAD */
+    u_short hardDeadTime;      /* hard max for call execution */
+    u_short idleDeadTime;      /* max time a call can be idle (no data) */
+    u_char ackRate;            /* how many packets between ack requests */
+    u_char makeCallWaiters;    /* how many rx_NewCalls are waiting */
+    afs_int32 idleDeadErr;
+    afs_int32 secondsUntilNatPing;     /* how often to ping conn */
+    struct rxevent *natKeepAliveEvent; /* Scheduled to keep connection open */
+    afs_int32 msgsizeRetryErr;
+    int nSpecific;             /* number entries in specific data */
+    void **specific;           /* pointer to connection specific data */
+};
+
+#endif
+
index 1202f583793fc25244847d21572b246a69ea0907..4828f2a7f5ce89ceb1c7194d2014c52b6b9ffcf5 100644 (file)
@@ -18,6 +18,8 @@
 
 #include "rx.h"
 
+#include "rx_conn.h"
+
 /*
  * We initialize rxi_connectionCache at compile time, so there is no
  * need to call queue_Init(&rxi_connectionCache).
index a36694b0cc2ece9844cb072c984949025b9bb413..4e51d9d3c53b62bcb8398d27ea35c142837426fc 100644 (file)
@@ -66,6 +66,8 @@
 #include "rx_internal.h"
 #include "rx_stats.h"
 
+#include "rx_conn.h"
+
 #ifdef RX_LOCKS_DB
 /* rxdb_fileID is used to identify the lock location, along with line#. */
 static int rxdb_fileID = RXDB_FILE_RX_PACKET;
index b7cbd0ab5ca2ad00e5ec4ddf8f7fd02156cd0873..9b11d88db4220a1641945ff8aaacd5f72c30dda6 100644 (file)
@@ -298,14 +298,6 @@ struct rx_packet {
     ((struct rx_packet *) \
      ((char *)(CP) - ((char *)(&(PP)->localdata[0])-(char *)(PP))))
 
-/* Macros callable by security modules, to set header/trailer lengths,
- * set actual packet size, and find the beginning of the security
- * header (or data) */
-#define rx_SetSecurityHeaderSize(conn, length) ((conn)->securityHeaderSize = (length))
-#define rx_SetSecurityMaxTrailerSize(conn, length) ((conn)->securityMaxTrailerSize = (length))
-#define rx_GetSecurityHeaderSize(conn) ((conn)->securityHeaderSize)
-#define rx_GetSecurityMaxTrailerSize(conn) ((conn)->securityMaxTrailerSize)
-
 /* This is the address of the data portion of the packet.  Any encryption
  * headers will be at this address, the actual data, for a data packet, will
  * start at this address + the connection's security header size. */
index 267fe5083283dc3f63be3bf7b90287c0d591e9d3..367e2b3853fe52eba07d9ec7dd7e8a5ee83ba3fb 100644 (file)
@@ -60,6 +60,8 @@
 #include "rx_queue.h"
 #include "rx_globals.h"
 
+#include "rx_conn.h"
+
 #ifdef RX_LOCKS_DB
 /* rxdb_fileID is used to identify the lock location, along with line#. */
 static int rxdb_fileID = RXDB_FILE_RX_RDWR;
index ded4722115c5460444eff3cf24c45e9298b1a51f..ff6139b6bf4e5f67c07718579fd9da1c381f06fe 100644 (file)
@@ -29,6 +29,8 @@ main(int argc, char **argv)
 #include "rx_internal.h"
 #include "rx_trace.h"
 
+#include "rx_conn.h"
+
 #ifdef RXTRACEON
 char rxi_tracename[80] = "/tmp/rxcalltrace";
 #else
index ea7f576824a48cd472a1a97742177338ee6627b1..7f0b8d931a4c302e7f7b20c03387af644f7794a0 100644 (file)
@@ -897,7 +897,7 @@ do_client(const char *server, short port, char *filename, afs_int32 command,
 
     if (dumpstats) {
        rx_PrintStats(stdout);
-       rx_PrintPeerStats(stdout, conn->peer);
+       rx_PrintPeerStats(stdout, rx_PeerOf(conn));
     }
     rx_Finalize();
 
index e06933ed1a0061f57faaa4b1482e54842b8d4461..ebc0acbafc1222e0d01dff6f0fcde2d5a47a89e1 100644 (file)
@@ -97,6 +97,7 @@ main(int argc, char **argv)
     int logstdout = 0;
     struct rx_connection *conn;
     struct rx_call *call;
+    struct rx_peer *peer;
     int err = 0;
     int nCalls = 1, nBytes = 1;
     int bufferSize = 4000000;
@@ -238,12 +239,13 @@ main(int argc, char **argv)
        Abort("unable to make a new connection");
 
     /* Set initial parameters.  This is (currently) not the approved interface */
+    peer = rx_PeerOf(conn);
     if (burst)
-       conn->peer->burstSize = conn->peer->burst = burst;
+       peer->burstSize = peer->burst = burst;
     if (!clock_IsZero(&burstTime))
-       conn->peer->burstWait = burstTime;
+       peer->burstWait = burstTime;
     if (!clock_IsZero(&retryTime))
-       conn->peer->rtt = _8THMSEC(&retryTime);
+       peer->rtt = _8THMSEC(&retryTime);
     if (sendFile)
        SendFile(sendFile, conn);
     else {
index 5780db30892004070c43f45fb9de1601abc1f26f..f04e07cf5ed0dcb2a0895e0c6f8fe52445b894cf 100644 (file)
@@ -253,8 +253,8 @@ int SimpleRequest(struct rx_call *call)
                 strlen("So long, and thanks for all the fish!\n"));
     }
     if (debugFile)
-       rx_PrintPeerStats(debugFile, rx_PeerOf(call->conn));
-    rx_PrintPeerStats(stdout, rx_PeerOf(call->conn));
+       rx_PrintPeerStats(debugFile, rx_PeerOf(rx_ConnectionOf(call)));
+    rx_PrintPeerStats(stdout, rx_PeerOf(rx_ConnectionOf(call)));
     return 0;
 }
 
@@ -302,8 +302,8 @@ FileRequest(struct rx_call *call)
     printf("Received file %s\n", rcvFile);
     close(fd);
     if (debugFile)
-       rx_PrintPeerStats(debugFile, rx_PeerOf(call->conn));
-    rx_PrintPeerStats(stdout, rx_PeerOf(call->conn));
+       rx_PrintPeerStats(debugFile, rx_PeerOf(rx_ConnectionOf(call)));
+    rx_PrintPeerStats(stdout, rx_PeerOf(rx_ConnectionOf(call)));
     return 0;
 }
 
index f410830ddfe4b8898a9e6be0f452097bdf5f3ccb..87c2ce22f7eabb2007e101df2c5ed0d31c7d2215 100644 (file)
@@ -1335,22 +1335,22 @@ cs_ProcTail_setup(definition * defp, int split_flag)
        if (PackageStatIndex[PackageIndex]) {
            if (!split_flag) {
                f_print(fout,
-                       "\t    rx_IncrementTimeAndCount(z_conn->peer, %s,\n",
+                       "\t    rx_IncrementTimeAndCount(rx_PeerOf(z_conn), %s,\n",
                        PackageStatIndex[PackageIndex]);
            } else {
                f_print(fout,
-                       "\t    rx_IncrementTimeAndCount(z_call->conn->peer, %s,\n",
+                       "\t    rx_IncrementTimeAndCount(rx_PeerOf(z_call->conn), %s,\n",
                        PackageStatIndex[PackageIndex]);
            }
        } else {
            if (!split_flag) {
                f_print(fout,
-                       "\t    rx_IncrementTimeAndCount(z_conn->peer,\n"
+                       "\t    rx_IncrementTimeAndCount(rx_PeerOf(z_conn),\n"
                        "\t\t(((afs_uint32)(ntohs(z_conn->serviceId) << 16)) \n"
                        "\t\t| ((afs_uint32)ntohs(z_conn->peer->port))),\n");
            } else {
                f_print(fout,
-                       "\t    rx_IncrementTimeAndCount(z_call->conn->peer,\n"
+                       "\t    rx_IncrementTimeAndCount(rx_PeerOf(z_call->conn),\n"
                        "\t\t(((afs_uint32)(ntohs(z_call->conn->serviceId) << 16)) |\n"
                        "\t\t((afs_uint32)ntohs(z_call->conn->peer->port))),\n");
            }
@@ -1737,7 +1737,7 @@ ss_ProcTail_setup(definition * defp, int somefrees)
        f_print(fout, "\t    clock_Sub(&__EXEC, &z_call->startTime);\n");
        f_print(fout, "\t    __QUEUE = z_call->startTime;\n");
        f_print(fout, "\t    clock_Sub(&__QUEUE, &z_call->queueTime);\n");
-       f_print(fout, "\t    rx_IncrementTimeAndCount(z_call->conn->peer,");
+       f_print(fout, "\t    rx_IncrementTimeAndCount(rx_PeerOf(z_call->conn),");
        if (PackageStatIndex[PackageIndex]) {
            f_print(fout, " %s,\n", PackageStatIndex[PackageIndex]);
        } else {
@@ -1762,7 +1762,7 @@ ss_ProcTail_setup(definition * defp, int somefrees)
            f_print(fout, "\t    __QUEUE = z_call->startTime;\n");
            f_print(fout, "\t    clock_Sub(&__QUEUE, &z_call->queueTime);\n");
            f_print(fout,
-                   "\t    rx_IncrementTimeAndCount(z_call->conn->peer,");
+                   "\t    rx_IncrementTimeAndCount(rx_PeerOf(z_call->conn),");
            if (PackageStatIndex[PackageIndex]) {
                f_print(fout, " %s,\n", PackageStatIndex[PackageIndex]);
            } else {
index f8522d1f90889f5c87b8dde1e1d7bb9e81b9c38e..2657f701883f3a021cd8fc2baa499d66e085b234 100644 (file)
@@ -135,8 +135,8 @@ rxkad_AllocCID(struct rx_securityClass *aobj, struct rx_connection *aconn)
        UNLOCK_CUID;
        return 0;
     }
-    aconn->epoch = Cuid[0];
-    aconn->cid = Cuid[1];
+    rx_SetConnectionEpoch(aconn, Cuid[0]);
+    rx_SetConnectionId(aconn, Cuid[1]);
     Cuid[1] += 1 << RX_CIDSHIFT;
     UNLOCK_CUID;
     return 0;
index 8eed980a4bb8f7f2b8153c116ad8014927a0ae83..83e6d1ec9763a5d5f4becd511d25b343e591c472 100644 (file)
@@ -205,11 +205,11 @@ rxkad_SetupEndpoint(struct rx_connection *aconnp,
 {
     afs_int32 i;
 
-    aendpointp->cuid[0] = htonl(aconnp->epoch);
-    i = aconnp->cid & RX_CIDMASK;
+    aendpointp->cuid[0] = htonl(rx_GetConnectionEpoch(aconnp));
+    i = rx_GetConnectionId(aconnp) & RX_CIDMASK;
     aendpointp->cuid[1] = htonl(i);
     aendpointp->cksum = 0;     /* used as cksum only in chal resp. */
-    aendpointp->securityIndex = htonl(aconnp->securityIndex);
+    aendpointp->securityIndex = htonl(rx_SecurityClassOf(aconnp));
     return 0;
 }
 
@@ -336,26 +336,28 @@ int
 rxkad_NewConnection(struct rx_securityClass *aobj,
                    struct rx_connection *aconn)
 {
-    if (aconn->securityData)
+    if (rx_GetSecurityData(aconn) != NULL)
        return RXKADINCONSISTENCY;      /* already allocated??? */
 
     if (rx_IsServerConn(aconn)) {
-       int size = sizeof(struct rxkad_sconn);
-       aconn->securityData = rxi_Alloc(size);
-       memset(aconn->securityData, 0, size);   /* initialize it conveniently */
+       struct rxkad_sconn *data;
+       data = rxi_Alloc(sizeof(struct rxkad_sconn));
+       memset(data, 0, sizeof(struct rxkad_sconn));
+       rx_SetSecurityData(aconn, data);
     } else {                   /* client */
        struct rxkad_cprivate *tcp;
-       struct rxkad_cconn *tccp;
-       int size = sizeof(struct rxkad_cconn);
-       tccp = rxi_Alloc(size);
-       aconn->securityData = (char *)tccp;
-       memset(aconn->securityData, 0, size);   /* initialize it conveniently */
+       struct rxkad_cconn *data;
+
+       data = rxi_Alloc(sizeof(struct rxkad_cconn));
+       memset(data, 0, sizeof(struct rxkad_cconn));
+       rx_SetSecurityData(aconn, data);
+
        tcp = (struct rxkad_cprivate *)aobj->privateData;
        if (!(tcp->type & rxkad_client))
            return RXKADINCONSISTENCY;
        rxkad_SetLevel(aconn, tcp->level);      /* set header and trailer sizes */
        rxkad_AllocCID(aobj, aconn);    /* CHANGES cid AND epoch!!!! */
-       rxkad_DeriveXORInfo(aconn, (fc_KeySchedule *)tcp->keysched, (char *)tcp->ivec, (char *)tccp->preSeq);
+       rxkad_DeriveXORInfo(aconn, (fc_KeySchedule *)tcp->keysched, (char *)tcp->ivec, (char *)data->preSeq);
        INC_RXKAD_STATS(connections[rxkad_LevelIndex(tcp->level)]);
     }
 
@@ -372,9 +374,9 @@ rxkad_DestroyConnection(struct rx_securityClass *aobj,
     if (rx_IsServerConn(aconn)) {
        struct rxkad_sconn *sconn;
        struct rxkad_serverinfo *rock;
-       sconn = (struct rxkad_sconn *)aconn->securityData;
+       sconn = rx_GetSecurityData(aconn);
        if (sconn) {
-           aconn->securityData = 0;
+           rx_SetSecurityData(aconn, NULL);
            if (sconn->authenticated)
                INC_RXKAD_STATS(destroyConn[rxkad_LevelIndex(sconn->level)]);
            else
@@ -389,12 +391,12 @@ rxkad_DestroyConnection(struct rx_securityClass *aobj,
     } else {                   /* client */
        struct rxkad_cconn *cconn;
        struct rxkad_cprivate *tcp;
-       cconn = (struct rxkad_cconn *)aconn->securityData;
+       cconn = rx_GetSecurityData(aconn);
        tcp = (struct rxkad_cprivate *)aobj->privateData;
        if (!(tcp->type & rxkad_client))
            return RXKADINCONSISTENCY;
        if (cconn) {
-           aconn->securityData = 0;
+           rx_SetSecurityData(aconn, NULL);
            rxi_Free(cconn, sizeof(struct rxkad_cconn));
        }
        INC_RXKAD_STATS(destroyClient);
@@ -431,7 +433,7 @@ rxkad_CheckPacket(struct rx_securityClass *aobj, struct rx_call *acall,
     checkCksum = 0;            /* init */
     if (rx_IsServerConn(tconn)) {
        struct rxkad_sconn *sconn;
-       sconn = (struct rxkad_sconn *)tconn->securityData;
+       sconn = rx_GetSecurityData(tconn);
        if (rx_GetPacketCksum(apacket) != 0)
            sconn->cksumSeen = 1;
        checkCksum = sconn->cksumSeen;
@@ -451,7 +453,7 @@ rxkad_CheckPacket(struct rx_securityClass *aobj, struct rx_call *acall,
     } else {                   /* client connection */
        struct rxkad_cconn *cconn;
        struct rxkad_cprivate *tcp;
-       cconn = (struct rxkad_cconn *)tconn->securityData;
+       cconn = rx_GetSecurityData(tconn);
        if (rx_GetPacketCksum(apacket) != 0)
            cconn->cksumSeen = 1;
        checkCksum = cconn->cksumSeen;
@@ -521,7 +523,7 @@ rxkad_PreparePacket(struct rx_securityClass *aobj, struct rx_call *acall,
     len = rx_GetDataSize(apacket);
     if (rx_IsServerConn(tconn)) {
        struct rxkad_sconn *sconn;
-       sconn = (struct rxkad_sconn *)tconn->securityData;
+       sconn = rx_GetSecurityData(tconn);
        if (sconn && sconn->authenticated
            && (osi_Time() < sconn->expirationTime)) {
            level = sconn->level;
@@ -538,7 +540,7 @@ rxkad_PreparePacket(struct rx_securityClass *aobj, struct rx_call *acall,
     } else {                   /* client connection */
        struct rxkad_cconn *cconn;
        struct rxkad_cprivate *tcp;
-       cconn = (struct rxkad_cconn *)tconn->securityData;
+       cconn = rx_GetSecurityData(tconn);
        tcp = (struct rxkad_cprivate *)aobj->privateData;
        if (!(tcp->type & rxkad_client))
            return RXKADINCONSISTENCY;
@@ -597,15 +599,20 @@ int
 rxkad_GetStats(struct rx_securityClass *aobj, struct rx_connection *aconn,
               struct rx_securityObjectStats *astats)
 {
+    void *securityData;
+
     astats->type = 3;
     astats->level = ((struct rxkad_cprivate *)aobj->privateData)->level;
-    if (!aconn->securityData) {
+
+    securityData = rx_GetSecurityData(aconn);
+
+    if (!securityData) {
        astats->flags |= 1;
        return 0;
     }
     if (rx_IsServerConn(aconn)) {
-       struct rxkad_sconn *sconn;
-       sconn = (struct rxkad_sconn *)aconn->securityData;
+       struct rxkad_sconn *sconn = securityData;
+
        astats->level = sconn->level;
        if (sconn->authenticated)
            astats->flags |= 2;
@@ -617,8 +624,8 @@ rxkad_GetStats(struct rx_securityClass *aobj, struct rx_connection *aconn,
        astats->bytesSent = sconn->stats.bytesSent;
        astats->packetsSent = sconn->stats.packetsSent;
     } else {                   /* client connection */
-       struct rxkad_cconn *cconn;
-       cconn = (struct rxkad_cconn *)aconn->securityData;
+       struct rxkad_cconn *cconn = securityData;
+
        if (cconn->cksumSeen)
            astats->flags |= 8;
        astats->bytesReceived = cconn->stats.bytesReceived;
index 82b1c969658cbce526d90416a03940421d4386ac..5c7a0ef725ed6b4be4abd60fc9b4bb8ca6ea3b53 100644 (file)
@@ -169,13 +169,12 @@ int
 rxkad_CheckAuthentication(struct rx_securityClass *aobj,
                          struct rx_connection *aconn)
 {
-    struct rxkad_sconn *sconn;
+    struct rxkad_sconn *sconn = rx_GetSecurityData(aconn);
 
     /* first make sure the object exists */
-    if (!aconn->securityData)
+    if (!sconn)
        return RXKADINCONSISTENCY;
 
-    sconn = (struct rxkad_sconn *)aconn->securityData;
     return !sconn->authenticated;
 }
 
@@ -186,10 +185,9 @@ int
 rxkad_CreateChallenge(struct rx_securityClass *aobj,
                      struct rx_connection *aconn)
 {
-    struct rxkad_sconn *sconn;
+    struct rxkad_sconn *sconn = rx_GetSecurityData(aconn);
     struct rxkad_sprivate *tsp;
 
-    sconn = (struct rxkad_sconn *)aconn->securityData;
     sconn->challengeID = get_random_int32();
     sconn->authenticated = 0;  /* conn unauth. 'til we hear back */
     /* initialize level from object's minimum acceptable level */
@@ -204,13 +202,12 @@ int
 rxkad_GetChallenge(struct rx_securityClass *aobj, struct rx_connection *aconn,
                   struct rx_packet *apacket)
 {
-    struct rxkad_sconn *sconn;
+    struct rxkad_sconn *sconn = rx_GetSecurityData(aconn);
     char *challenge;
     int challengeSize;
     struct rxkad_v2Challenge c_v2;     /* version 2 */
     struct rxkad_oldChallenge c_old;   /* old style */
 
-    sconn = (struct rxkad_sconn *)aconn->securityData;
     if (rx_IsUsingPktCksum(aconn))
        sconn->cksumSeen = 1;
 
@@ -267,7 +264,7 @@ rxkad_CheckResponse(struct rx_securityClass *aobj,
     unsigned int pos;
     struct rxkad_serverinfo *rock;
 
-    sconn = (struct rxkad_sconn *)aconn->securityData;
+    sconn = rx_GetSecurityData(aconn);
     tsp = (struct rxkad_sprivate *)aobj->privateData;
 
     if (sconn->cksumSeen) {
@@ -435,7 +432,7 @@ rxkad_GetServerInfo(struct rx_connection * aconn, rxkad_level * level,
 {
     struct rxkad_sconn *sconn;
 
-    sconn = (struct rxkad_sconn *)aconn->securityData;
+    sconn = rx_GetSecurityData(aconn);
     if (sconn && sconn->authenticated && sconn->rock
        && (time(0) < sconn->expirationTime)) {
        if (level)
index 30ff565a1d978b63e9c3627a20b3fc317d46f57f..40b13fb75a9f8513e5717051b339fbda89c14fba 100644 (file)
@@ -77,7 +77,8 @@ RXOBJS =\
        rx_rdwr.o \
        rx_stats.o \
        rx_trace.o \
-       rx_multi.o
+       rx_multi.o \
+       rx_conn.o
 
 RXSTATOBJS =\
        rxstat.o \
@@ -163,6 +164,9 @@ rx.o: ${RX}/rx.c
 rx_conncache.o: ${RX}/rx_conncache.c
        $(AFS_CCRULE) $(RX)/rx_conncache.c
 
+rx_conn.o : ${RX}/rx_conn.c
+       $(AFS_CCRULE) $(RX)/rx_conn.c
+
 rx_null.o: ${RX}/rx_null.c
        $(AFS_CCRULE) $(RX)/rx_null.c
 
index 34549830d464654a18d376937b12340b88ae4af3..4560672df31b356c06253d661b34f1c9492e1036 100755 (executable)
        rx_identity_free;
        rx_InterruptCall;
        rx_SetBusyChannelError;
+       rx_PeerOf;
+       rx_SecurityClassOf;
+       rx_ServiceIdOf;
+       rx_SecurityObjectOf;
+       rx_ConnError;
     local:
        *;
 };
index 655b0e5929a6f28eb30b6ce5899ef7948204d4db..ef63a1c6b32e1d0da0ffa353c54f2d484d93897a 100644 (file)
@@ -87,7 +87,7 @@ SRMTSYS_SetPag(struct rx_call *call, clientcred *creds, afs_int32 *newpag,
     afs_int32 error;
 
     *errornumber = 0;
-    SETCLIENTCONTEXT(blob, rx_HostOf(call->conn->peer), creds->uid,
+    SETCLIENTCONTEXT(blob, rx_HostOf(rx_PeerOf(call->conn)), creds->uid,
                     creds->group0, creds->group1, PSETPAG, NFS_EXPORTER);
     data.in = (caddr_t) blob;
     data.in_size = sizeof(blob);
@@ -117,7 +117,7 @@ SRMTSYS_Pioctl(struct rx_call *call, clientcred *creds, char *path,
     afs_uint32 blob[PIOCTL_HEADER];
 
     *errornumber = 0;
-    SETCLIENTCONTEXT(blob, rx_HostOf(call->conn->peer), creds->uid,
+    SETCLIENTCONTEXT(blob, rx_HostOf(rx_PeerOf(call->conn)), creds->uid,
                     creds->group0, creds->group1, cmd, NFS_EXPORTER);
     data.in =
        (char *)malloc(InData->rmtbulk_len +
index 4f5589ee1679bca2cf427a8b9744cef60ec572da..792d6afd1408e96dc6b5fc4395a12b498e6aac45 100644 (file)
@@ -5480,7 +5480,7 @@ common_GiveUpCallBacks(struct rx_call *acall, struct AFSCBFids *FidArray,
     if (!FidArray && !CallBackArray) {
        ViceLog(1,
                ("SAFS_GiveUpAllCallBacks: host=%x\n",
-                (tcon->peer ? tcon->peer->host : 0)));
+                (rx_PeerOf(tcon) ? rx_PeerOf(tcon)->host : 0)));
        errorCode = GetClient(tcon, &client);
        if (!errorCode) {
            H_LOCK;
@@ -5493,7 +5493,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,
-                    (tcon->peer ? tcon->peer->host : 0)));
+                    (rx_PeerOf(tcon) ? rx_PeerOf(tcon)->host : 0)));
            errorCode = EINVAL;
            goto Bad_GiveUpCallBacks;
        }
index 3850371a3faaec84f0f50015660a97151e152767..2502331dc51644a91f1b8f5b7158165aab17250e 100644 (file)
@@ -2362,8 +2362,8 @@ h_FindClient_r(struct rx_connection *tcon)
     int created = 0;
 
     client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
-    if (client && client->sid == rxr_CidOf(tcon)
-       && client->VenusEpoch == rxr_GetEpoch(tcon)
+    if (client && client->sid == rx_GetConnectionId(tcon)
+       && client->VenusEpoch == rx_GetConnectionEpoch(tcon)
        && !(client->host->hostFlags & HOSTDELETED)
        && !client->deleted) {
 
@@ -2442,8 +2442,8 @@ h_FindClient_r(struct rx_connection *tcon)
     retryfirstclient:
        /* First try to find the client structure */
        for (client = host->FirstClient; client; client = client->next) {
-           if (!client->deleted && (client->sid == rxr_CidOf(tcon))
-               && (client->VenusEpoch == rxr_GetEpoch(tcon))) {
+           if (!client->deleted && (client->sid == rx_GetConnectionId(tcon))
+               && (client->VenusEpoch == rx_GetConnectionEpoch(tcon))) {
                client->refCount++;
                H_UNLOCK;
                ObtainWriteLock(&client->lock);
@@ -2462,8 +2462,8 @@ h_FindClient_r(struct rx_connection *tcon)
             }
            /* Retry to find the client structure */
            for (client = host->FirstClient; client; client = client->next) {
-               if (!client->deleted && (client->sid == rxr_CidOf(tcon))
-                   && (client->VenusEpoch == rxr_GetEpoch(tcon))) {
+               if (!client->deleted && (client->sid == rx_GetConnectionId(tcon))
+                   && (client->VenusEpoch == rx_GetConnectionEpoch(tcon))) {
                    h_Unlock_r(host);
                    goto retryfirstclient;
                }
@@ -2479,8 +2479,8 @@ h_FindClient_r(struct rx_connection *tcon)
            client->ViceId = viceid;
            client->expTime = expTime;  /* rx only */
            client->authClass = authClass;      /* rx only */
-           client->sid = rxr_CidOf(tcon);
-           client->VenusEpoch = rxr_GetEpoch(tcon);
+           client->sid = rx_GetConnectionId(tcon);
+           client->VenusEpoch = rx_GetConnectionEpoch(tcon);
            client->CPS.prlist_val = NULL;
            client->CPS.prlist_len = 0;
            h_Unlock_r(host);
@@ -2541,8 +2541,9 @@ h_FindClient_r(struct rx_connection *tcon)
      * the RPC from the other client structure's rock.
      */
     oldClient = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
-    if (oldClient && oldClient != client && oldClient->sid == rxr_CidOf(tcon)
-       && oldClient->VenusEpoch == rxr_GetEpoch(tcon)
+    if (oldClient && oldClient != client
+       && oldClient->sid == rx_GetConnectionId(tcon)
+       && oldClient->VenusEpoch == rx_GetConnectionEpoch(tcon)
        && !(oldClient->host->hostFlags & HOSTDELETED)) {
        char hoststr[16];
        if (!oldClient->deleted) {
@@ -2583,7 +2584,7 @@ h_FindClient_r(struct rx_connection *tcon)
                        oldClient, oldClient->sid, oldClient->refCount,
                        oldClient->host, oldClient->host->refCount, tcon,
                        afs_inet_ntoa_r(rxr_HostOf(tcon), hoststr),
-                       ntohs(rxr_PortOf(tcon)), rxr_CidOf(tcon),
+                       ntohs(rxr_PortOf(tcon)), rx_GetConnectionId(tcon),
                        client, client->sid, client->refCount,
                        client->host, client->host->refCount));
            /* rx_SetSpecific will be done immediately below */
@@ -2656,10 +2657,11 @@ GetClient(struct rx_connection *tcon, struct client **cp)
        H_UNLOCK;
        return VBUSY;
     }
-    if (rxr_CidOf(tcon) != client->sid || rxr_GetEpoch(tcon) != client->VenusEpoch) {
+    if (rx_GetConnectionId(tcon) != client->sid
+       || rx_GetConnectionEpoch(tcon) != client->VenusEpoch) {
        ViceLog(0,
                ("GetClient: tcon %p tcon sid %d client sid %d\n",
-                tcon, rxr_CidOf(tcon), client->sid));
+                tcon, rx_GetConnectionId(tcon), client->sid));
        H_UNLOCK;
        return VBUSY;
     }
@@ -2675,7 +2677,7 @@ GetClient(struct rx_connection *tcon, struct client **cp)
        ViceLog(0, ("GetClient: got deleted client, connection will appear "
                    "anonymous; tcon %p cid %x client %p ref %d host %p "
                    "(%s:%d) href %d ViceId %d\n",
-                   tcon, rxr_CidOf(tcon), client, client->refCount,
+                   tcon, rx_GetConnectionId(tcon), client, client->refCount,
                    client->host,
                    afs_inet_ntoa_r(client->host->host, hoststr),
                    (int)ntohs(client->host->port), client->host->refCount,
index 2735ac11e5d3d5aa7c48baade68eb2f48bd90dac..589ae830daa5e21044c5ae98bd743d0303601915 100644 (file)
@@ -2890,8 +2890,8 @@ DumpVolumeCmd(struct cmd_syndesc *as, void *arock)
        if (rxConn == 0)
            break;
        rx_SetConnDeadTime(rxConn, rx_connDeadTime);
-       if (rxConn->service)
-           rxConn->service->connDeadTime = rx_connDeadTime;
+       if (rx_ServiceOf(rxConn))
+           rx_ServiceOf(rxConn)->connDeadTime = rx_connDeadTime;
     }
 
     avolid = vsu_GetVolumeID(as->parms[0].items->data, cstruct, &err);
@@ -5667,8 +5667,8 @@ Sizes(struct cmd_syndesc *as, void *arock)
        if (rxConn == 0)
            break;
        rx_SetConnDeadTime(rxConn, rx_connDeadTime);
-       if (rxConn->service)
-           rxConn->service->connDeadTime = rx_connDeadTime;
+       if (rx_ServiceOf(rxConn))
+           rx_ServiceOf(rxConn)->connDeadTime = rx_connDeadTime;
     }
 
     avolid = vsu_GetVolumeID(as->parms[0].items->data, cstruct, &err);
index fa5e439f4ea7006977e7b02396ba5f817d3e641f..ee7527b9cbcd2a6827aac13bb60faeab109acf28 100644 (file)
@@ -72,7 +72,7 @@ typedef struct rpc_test_request_ctx {
 
 
 #define CTX_FOR_RXCALL(call) \
-    (rx_GetServiceSpecific((rx_ConnectionOf(call))->service, ctx_key))
+    (rx_GetServiceSpecific((rx_ServiceOf(rx_ConnectionOf(call))), ctx_key))
 
 afs_int32 rpc_test_PkgInit();
 void rpc_test_PkgShutdown();