aboutsummaryrefslogtreecommitdiffstats
path: root/include/rxrpc/transport.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/rxrpc/transport.h')
-rw-r--r--include/rxrpc/transport.h106
1 files changed, 106 insertions, 0 deletions
diff --git a/include/rxrpc/transport.h b/include/rxrpc/transport.h
new file mode 100644
index 000000000000..7c7b9683fa39
--- /dev/null
+++ b/include/rxrpc/transport.h
@@ -0,0 +1,106 @@
1/* transport.h: Rx transport management
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_TRANSPORT_H
13#define _LINUX_RXRPC_TRANSPORT_H
14
15#include <rxrpc/types.h>
16#include <rxrpc/krxiod.h>
17#include <rxrpc/rxrpc.h>
18#include <linux/skbuff.h>
19#include <linux/rwsem.h>
20
21typedef int (*rxrpc_newcall_fnx_t)(struct rxrpc_call *call);
22
23extern wait_queue_head_t rxrpc_krxiod_wq;
24
25/*****************************************************************************/
26/*
27 * Rx operation specification
28 * - tables of these must be sorted by op ID so that they can be binary-chop searched
29 */
30struct rxrpc_operation
31{
32 unsigned id; /* operation ID */
33 size_t asize; /* minimum size of argument block */
34 const char *name; /* name of operation */
35 void *user; /* initial user data */
36};
37
38/*****************************************************************************/
39/*
40 * Rx transport service record
41 */
42struct rxrpc_service
43{
44 struct list_head link; /* link in services list on transport */
45 struct module *owner; /* owner module */
46 rxrpc_newcall_fnx_t new_call; /* new call handler function */
47 const char *name; /* name of service */
48 unsigned short service_id; /* Rx service ID */
49 rxrpc_call_attn_func_t attn_func; /* call requires attention callback */
50 rxrpc_call_error_func_t error_func; /* call error callback */
51 rxrpc_call_aemap_func_t aemap_func; /* abort -> errno mapping callback */
52
53 const struct rxrpc_operation *ops_begin; /* beginning of operations table */
54 const struct rxrpc_operation *ops_end; /* end of operations table */
55};
56
57/*****************************************************************************/
58/*
59 * Rx transport endpoint record
60 */
61struct rxrpc_transport
62{
63 atomic_t usage;
64 struct socket *socket; /* my UDP socket */
65 struct list_head services; /* services listening on this socket */
66 struct list_head link; /* link in transport list */
67 struct list_head proc_link; /* link in transport proc list */
68 struct list_head krxiodq_link; /* krxiod attention queue link */
69 spinlock_t lock; /* access lock */
70 struct list_head peer_active; /* active peers connected to over this socket */
71 struct list_head peer_graveyard; /* inactive peer list */
72 spinlock_t peer_gylock; /* peer graveyard lock */
73 wait_queue_head_t peer_gy_waitq; /* wait queue hit when peer graveyard is empty */
74 rwlock_t peer_lock; /* peer list access lock */
75 atomic_t peer_count; /* number of peers */
76 struct rxrpc_peer_ops *peer_ops; /* default peer operations */
77 unsigned short port; /* port upon which listening */
78 volatile char error_rcvd; /* T if received ICMP error outstanding */
79};
80
81extern int rxrpc_create_transport(unsigned short port,
82 struct rxrpc_transport **_trans);
83
84static inline void rxrpc_get_transport(struct rxrpc_transport *trans)
85{
86 BUG_ON(atomic_read(&trans->usage) <= 0);
87 atomic_inc(&trans->usage);
88 //printk("rxrpc_get_transport(%p{u=%d})\n",
89 // trans, atomic_read(&trans->usage));
90}
91
92extern void rxrpc_put_transport(struct rxrpc_transport *trans);
93
94extern int rxrpc_add_service(struct rxrpc_transport *trans,
95 struct rxrpc_service *srv);
96
97extern void rxrpc_del_service(struct rxrpc_transport *trans,
98 struct rxrpc_service *srv);
99
100extern void rxrpc_trans_receive_packet(struct rxrpc_transport *trans);
101
102extern int rxrpc_trans_immediate_abort(struct rxrpc_transport *trans,
103 struct rxrpc_message *msg,
104 int error);
105
106#endif /* _LINUX_RXRPC_TRANSPORT_H */