Import Upstream version 1.8.5
[hcoop/debian/openafs.git] / src / rx / rx_call.c
1 /*
2 * Copyright 2000, International Business Machines Corporation and others.
3 * Copyright 2011, Your File System Inc
4 * All Rights Reserved.
5 *
6 * This software has been released under the terms of the IBM Public
7 * License. For details, see the LICENSE file in the top-level source
8 * directory or online at http://www.openafs.org/dl/license10.html
9 */
10
11 #include <afsconfig.h>
12 #include <afs/param.h>
13
14 #include <roken.h>
15
16 #include "rx.h"
17 #include "rx_call.h"
18 #include "rx_conn.h"
19 #include "rx_atomic.h"
20 #include "rx_internal.h"
21
22 struct rx_connection *
23 rx_ConnectionOf(struct rx_call *call)
24 {
25 return call->conn;
26 }
27
28 int
29 rx_Error(struct rx_call *call)
30 {
31 return call->error;
32 }
33
34 int
35 rx_GetRemoteStatus(struct rx_call *call)
36 {
37 return call->remoteStatus;
38 }
39
40 void
41 rx_SetLocalStatus(struct rx_call *call, int status)
42 {
43 call->localStatus = status;
44 }
45
46 int
47 rx_GetCallAbortCode(struct rx_call *call)
48 {
49 return call->abortCode;
50 }
51
52 void
53 rx_SetCallAbortCode(struct rx_call *call, int code)
54 {
55 call->abortCode = code;
56 }
57
58 void
59 rx_RecordCallStatistics(struct rx_call *call, unsigned int rxInterface,
60 unsigned int currentFunc, unsigned int totalFunc,
61 int isServer)
62 {
63 struct clock queue;
64 struct clock exec;
65
66 clock_GetTime(&exec);
67 clock_Sub(&exec, &call->startTime);
68 queue = call->startTime;
69 clock_Sub(&queue, &call->queueTime);
70
71 rxi_IncrementTimeAndCount(call->conn->peer, rxInterface, currentFunc,
72 totalFunc, &queue, &exec, call->app.bytesSent,
73 call->app.bytesRcvd, 1);
74 }
75
76 /*
77 * Accessor for VolMonitor 'vos status'
78 * note: the rx_call members are all unsigned, but our return targets
79 * in wire struct transDebugInfo are all signed. Sigh.
80 */
81 void
82 rx_GetCallStatus(struct rx_call *call, afs_int32 *readNext,
83 afs_int32 *transmitNext, int *lastSendTime,
84 int *lastReceiveTime)
85 {
86 if (readNext != NULL)
87 *readNext = call->rnext;
88 if (transmitNext != NULL)
89 *transmitNext = call->tnext;
90 if (lastSendTime != NULL)
91 *lastSendTime = call->lastSendTime;
92 if (lastReceiveTime != NULL)
93 *lastReceiveTime = call->lastReceiveTime;
94 }