aboutsummaryrefslogtreecommitdiffstats
path: root/include/rxrpc/connection.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/rxrpc/connection.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/rxrpc/connection.h')
-rw-r--r--include/rxrpc/connection.h83
1 files changed, 83 insertions, 0 deletions
diff --git a/include/rxrpc/connection.h b/include/rxrpc/connection.h
new file mode 100644
index 000000000000..41e6781ad067
--- /dev/null
+++ b/include/rxrpc/connection.h
@@ -0,0 +1,83 @@
1/* connection.h: Rx connection record
2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_RXRPC_CONNECTION_H
13#define _LINUX_RXRPC_CONNECTION_H
14
15#include <rxrpc/types.h>
16#include <rxrpc/krxtimod.h>
17
18struct sk_buff;
19
20/*****************************************************************************/
21/*
22 * Rx connection
23 * - connections are matched by (rmt_port,rmt_addr,service_id,conn_id,clientflag)
24 * - connections only retain a refcount on the peer when they are active
25 * - connections with refcount==0 are inactive and reside in the peer's graveyard
26 */
27struct rxrpc_connection
28{
29 atomic_t usage;
30 struct rxrpc_transport *trans; /* transport endpoint */
31 struct rxrpc_peer *peer; /* peer from/to which connected */
32 struct rxrpc_service *service; /* responsible service (inbound conns) */
33 struct rxrpc_timer timeout; /* decaching timer */
34 struct list_head link; /* link in peer's list */
35 struct list_head proc_link; /* link in proc list */
36 struct list_head err_link; /* link in ICMP error processing list */
37 struct list_head id_link; /* link in ID grant list */
38 struct sockaddr_in addr; /* remote address */
39 struct rxrpc_call *channels[4]; /* channels (active calls) */
40 wait_queue_head_t chanwait; /* wait for channel to become available */
41 spinlock_t lock; /* access lock */
42 struct timeval atime; /* last access time */
43 size_t mtu_size; /* MTU size for outbound messages */
44 unsigned call_counter; /* call ID counter */
45 rxrpc_serial_t serial_counter; /* packet serial number counter */
46
47 /* the following should all be in net order */
48 __be32 in_epoch; /* peer's epoch */
49 __be32 out_epoch; /* my epoch */
50 __be32 conn_id; /* connection ID, appropriately shifted */
51 __be16 service_id; /* service ID */
52 uint8_t security_ix; /* security ID */
53 uint8_t in_clientflag; /* RXRPC_CLIENT_INITIATED if we are server */
54 uint8_t out_clientflag; /* RXRPC_CLIENT_INITIATED if we are client */
55};
56
57extern int rxrpc_create_connection(struct rxrpc_transport *trans,
58 __be16 port,
59 __be32 addr,
60 uint16_t service_id,
61 void *security,
62 struct rxrpc_connection **_conn);
63
64extern int rxrpc_connection_lookup(struct rxrpc_peer *peer,
65 struct rxrpc_message *msg,
66 struct rxrpc_connection **_conn);
67
68static inline void rxrpc_get_connection(struct rxrpc_connection *conn)
69{
70 BUG_ON(atomic_read(&conn->usage)<0);
71 atomic_inc(&conn->usage);
72 //printk("rxrpc_get_conn(%p{u=%d})\n",conn,atomic_read(&conn->usage));
73}
74
75extern void rxrpc_put_connection(struct rxrpc_connection *conn);
76
77extern int rxrpc_conn_receive_call_packet(struct rxrpc_connection *conn,
78 struct rxrpc_call *call,
79 struct rxrpc_message *msg);
80
81extern void rxrpc_conn_handle_error(struct rxrpc_connection *conn, int local, int errno);
82
83#endif /* _LINUX_RXRPC_CONNECTION_H */