#include "sys/lock_def.h"
#endif /* AFS_AIX41_ENV */
# include "rxgen_consts.h"
+# include "afs/magic.h"
#else /* KERNEL */
# include <sys/types.h>
# include <errno.h>
# include "rx_globals.h"
# include "rx_trace.h"
# include <afs/rxgen_consts.h>
+# include <afs/magic.h>
#endif /* KERNEL */
int (*registerProgram) () = 0;
SPLVAR;
+ osi_Assert(securityObject->magic == MAGIC_RXSECURITY);
clock_NewTime();
dpf(("rx_NewConnection(host %x, port %u, service %u, securityObject %x, serviceSecurityIndex %d)\n", ntohl(rx_ss2v4addr(saddr)), ntohs(rx_ss2pn(saddr)), sservice, securityObject, serviceSecurityIndex));
NETPRI;
MUTEX_ENTER(&rx_connHashTable_lock);
cid = (rx_nextCid += RX_MAXCALLS);
+ conn->magic = MAGIC_RXCONN;
conn->type = RX_CLIENT_CONNECTION;
conn->cid = cid;
conn->epoch = rx_epoch;
void
rxi_CleanupConnection(struct rx_connection *conn)
{
+ osi_Assert(conn->magic == MAGIC_RXCONN);
+
/* Notify the service exporter, if requested, that this connection
* is being destroyed */
if (conn->type == RX_SERVER_CONNECTION && conn->service->destroyConnProc)
(*conn->service->destroyConnProc) (conn);
+ conn->magic = MAGIC_RXCONN_FREE;
+
/* Notify the security module that this connection is being destroyed */
RXS_DestroyConnection(conn->securityObject, conn);
void
rxi_DestroyConnection(register struct rx_connection *conn)
{
+ osi_Assert(conn->magic == MAGIC_RXCONN);
+
MUTEX_ENTER(&rx_connHashTable_lock);
rxi_DestroyConnectionNoLock(conn);
/* conn should be at the head of the cleanup list */
{
SPLVAR;
+ osi_Assert(conn->magic == MAGIC_RXCONN);
NETPRI;
MUTEX_ENTER(&conn->conn_data_lock);
conn->refCount++;
struct clock queueTime;
SPLVAR;
+ osi_Assert(conn->magic == MAGIC_RXCONN);
clock_NewTime();
dpf(("rx_MakeCall(conn %x)\n", conn));
}
}
service = tservice;
+ service->magic = MAGIC_RXSVC;
service->socket = socket;
service->servicePort = port;
service->serviceId = serviceId;
struct rx_service *service = NULL;
SPLVAR;
+ osi_Assert(cur_service->magic == MAGIC_RXSVC);
+
MUTEX_ENTER(&freeSQEList_lock);
if ((sq = rx_FreeSQEList)) {
struct rx_service *service = NULL;
SPLVAR;
+ osi_Assert(cur_service->magic == MAGIC_RXSVC);
+
NETPRI;
MUTEX_ENTER(&freeSQEList_lock);
register struct rx_service *service;
afs_int32 error;
SPLVAR;
+ osi_Assert(call->magic == MAGIC_RXCALL);
register struct rx_call *nxp; /* Next call pointer, for queue_Scan */
#endif /* AFS_GLOBAL_RXLOCK_KERNEL */
+ osi_Assert(conn->magic == MAGIC_RXCONN);
+
/* Grab an existing call structure, or allocate a new one.
* Existing call structures are assumed to have been left reset by
* rxi_FreeCall */
if (*call->callNumber == 0)
*call->callNumber = 1;
+ call->magic = MAGIC_RXCALL;
+
return call;
}
register struct rx_connection *conn = call->conn;
+ osi_Assert(call->magic == MAGIC_RXCALL);
+
if (call->state == RX_STATE_DALLY || call->state == RX_STATE_HOLD)
(*call->callNumber)++;
rxi_ResetCall(call, 0);
call->conn->call[channel] = (struct rx_call *)0;
+ call->magic = MAGIC_RXCALL_FREE;
+
MUTEX_ENTER(&rx_freeCallQueue_lock);
SET_CALL_QUEUE_LOCK(call, &rx_freeCallQueue_lock);
#ifdef AFS_GLOBAL_RXLOCK_KERNEL
if (!pp) {
if (create) {
pp = rxi_AllocPeer(); /* This bzero's *pp */
+ pp->magic = MAGIC_RXPEER;
memcpy(&pp->saddr, saddr, slen);
pp->saddrlen = slen;
pp->socktype = stype;
if (pp && create) {
pp->refCount++;
}
- if (origPeer)
+ if (origPeer) {
+ osi_Assert(origPeer->magic == MAGIC_RXPEER);
origPeer->refCount--;
+ }
MUTEX_EXIT(&rx_peerHashTable_lock);
return pp;
}
CV_INIT(&conn->conn_call_cv, "conn call cv", CV_DEFAULT, 0);
conn->next = rx_connHashTable[hashindex];
rx_connHashTable[hashindex] = conn;
+ conn->magic = MAGIC_RXCONN;
conn->peer = rxi_FindPeer(saddr, slen, socktype, 0, 1);
conn->type = RX_SERVER_CONNECTION;
conn->lastSendTime = clock_Sec(); /* don't GC immediately */
peer_ptr++) {
struct rx_peer *peer, *next, *prev;
for (prev = peer = *peer_ptr; peer; peer = next) {
+ osi_Assert(peer->magic == MAGIC_RXPEER);
next = peer->next;
code = MUTEX_TRYENTER(&peer->peer_lock);
if ((code) && (peer->refCount == 0)
int
rxs_Release(struct rx_securityClass *aobj)
{
+ osi_Assert(aobj->magic == MAGIC_RXSECURITY);
+
return RXS_Close(aobj);
}
rx_SetSpecific(struct rx_connection *conn, int key, void *ptr)
{
int i;
+ osi_Assert(conn->magic == MAGIC_RXCONN);
MUTEX_ENTER(&conn->conn_data_lock);
+ osi_Assert(conn->magic == MAGIC_RXCONN);
if (!conn->specific) {
conn->specific = (void **)malloc((key + 1) * sizeof(void *));
for (i = 0; i < key; i++)
rx_GetSpecific(struct rx_connection *conn, int key)
{
void *ptr;
+ osi_Assert(conn->magic == MAGIC_RXCONN);
MUTEX_ENTER(&conn->conn_data_lock);
+ osi_Assert(conn->magic == MAGIC_RXCONN);
if (key >= conn->nSpecific)
ptr = NULL;
else
limited multiple asynchronous conversations. */
#ifdef KDUMP_RX_LOCK
struct rx_connection_rx_lock {
+ int magic;
struct rx_connection_rx_lock *next; /* on hash chain _or_ free list */
struct rx_peer_rx_lock *peer;
#else
struct rx_connection {
+ int magic;
struct rx_connection *next; /* on hash chain _or_ free list */
struct rx_peer *peer;
#endif
* requests. */
struct rx_service {
+ int magic;
u_short serviceId; /* Service number */
u_short servicePort; /* UDP port for this service */
char *serviceName; /* Name of the service */
/* 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 {
+ int magic;
struct rx_peer_rx_lock *next; /* Next in hash conflict or free list */
#else
struct rx_peer {
+ int magic;
struct rx_peer *next; /* Next in hash conflict or free list */
#endif
#ifdef RX_ENABLE_LOCKS
#else
struct rx_call {
#endif
+ int magic;
struct rx_queue queue_item_header; /* Call can be on various queues (one-at-a-time) */
struct rx_queue tq; /* Transmit packet queue */
struct rx_queue rq; /* Receive packet queue */
* provide routines to create these objects. Rx provides a basic routine to
* allocate one of these objects; this routine must be called by the class. */
struct rx_securityClass {
+ int magic;
struct rx_securityOps {
int (*op_Close) (struct rx_securityClass * aobj);
int (*op_NewConnection) (struct rx_securityClass * aobj,
--- /dev/null
+/*
+ * 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 AFS_MAGIC_H
+#define AFS_MAGIC_H
+typedef enum afs_structmagic_t {
+ MAGIC_RXCONN = 0xFF010001,
+ MAGIC_RXCALL = 0xFF010002,
+ MAGIC_RXPEER = 0xFF010003,
+ MAGIC_RXSVC = 0xFF010004,
+ MAGIC_RXSECURITY = 0xFF010005,
+ MAGIC_UBIK = 0xFF010101,
+ MAGIC_VICED_HOST = 0xFF010201,
+ MAGIC_VICED_CLIENT = 0xFF010202,
+ MAGIC_RXCONN_FREE = 0xFF020001,
+ MAGIC_RXCALL_FREE = 0xFF020002,
+ MAGIC_RXPEER_FREE = 0xFF010003,
+ /*MAGIC_RXSVC_FREE = 0xFF020004,*/
+ MAGIC_RXSEC_FREE = 0xFF020005,
+ MAGIC_UBIK_FREE = 0xFF020101,
+ MAGIC_VICED_HOST_FREE = 0xFF020101,
+ MAGIC_VICED_CLIENT_FREE = 0xFF020102
+} afs_structmagic;
+#endif