| 1 |
|
| 2 | |
| 3 | *
|
| 4 | * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
|
| 5 | * Written by David Howells ([email protected])
|
| 6 |
|
| 7 |
|
| 8 | #ifndef _NET_RXRPC_H
|
| 9 | #define _NET_RXRPC_H
|
| 10 |
|
| 11 | #include <linux/rxrpc.h>
|
| 12 | #include <linux/ktime.h>
|
| 13 |
|
| 14 | struct key;
|
| 15 | struct sock;
|
| 16 | struct socket;
|
| 17 | struct rxrpc_call;
|
| 18 | struct rxrpc_peer;
|
| 19 | struct krb5_buffer;
|
| 20 | enum rxrpc_abort_reason;
|
| 21 |
|
| 22 | enum rxrpc_interruptibility {
|
| 23 | RXRPC_INTERRUPTIBLE,
|
| 24 | RXRPC_PREINTERRUPTIBLE,
|
| 25 | RXRPC_UNINTERRUPTIBLE,
|
| 26 | };
|
| 27 |
|
| 28 | enum rxrpc_oob_type {
|
| 29 | RXRPC_OOB_CHALLENGE,
|
| 30 | };
|
| 31 |
|
| 32 | |
| 33 | * Debug ID counter for tracing.
|
| 34 |
|
| 35 | extern atomic_t rxrpc_debug_id;
|
| 36 |
|
| 37 | |
| 38 | * Operations table for rxrpc to call out to a kernel application (e.g. kAFS).
|
| 39 |
|
| 40 | struct rxrpc_kernel_ops {
|
| 41 | void (*notify_new_call)(struct sock *sk, struct rxrpc_call *call,
|
| 42 | unsigned long user_call_ID);
|
| 43 | void (*discard_new_call)(struct rxrpc_call *call, unsigned long user_call_ID);
|
| 44 | void (*user_attach_call)(struct rxrpc_call *call, unsigned long user_call_ID);
|
| 45 | void (*notify_oob)(struct sock *sk, struct sk_buff *oob);
|
| 46 | };
|
| 47 |
|
| 48 | typedef void (*rxrpc_notify_rx_t)(struct sock *, struct rxrpc_call *,
|
| 49 | unsigned long);
|
| 50 | typedef void (*rxrpc_notify_end_tx_t)(struct sock *, struct rxrpc_call *,
|
| 51 | unsigned long);
|
| 52 |
|
| 53 | void rxrpc_kernel_set_notifications(struct socket *sock,
|
| 54 | const struct rxrpc_kernel_ops *app_ops);
|
| 55 | struct rxrpc_call *rxrpc_kernel_begin_call(struct socket *sock,
|
| 56 | struct rxrpc_peer *peer,
|
| 57 | struct key *key,
|
| 58 | unsigned long user_call_ID,
|
| 59 | s64 tx_total_len,
|
| 60 | u32 hard_timeout,
|
| 61 | gfp_t gfp,
|
| 62 | rxrpc_notify_rx_t notify_rx,
|
| 63 | u16 service_id,
|
| 64 | bool upgrade,
|
| 65 | enum rxrpc_interruptibility interruptibility,
|
| 66 | unsigned int debug_id);
|
| 67 | int rxrpc_kernel_send_data(struct socket *, struct rxrpc_call *,
|
| 68 | struct msghdr *, size_t,
|
| 69 | rxrpc_notify_end_tx_t);
|
| 70 | int rxrpc_kernel_recv_data(struct socket *, struct rxrpc_call *,
|
| 71 | struct iov_iter *, size_t *, bool, u32 *, u16 *);
|
| 72 | bool rxrpc_kernel_abort_call(struct socket *, struct rxrpc_call *,
|
| 73 | u32, int, enum rxrpc_abort_reason);
|
| 74 | void rxrpc_kernel_shutdown_call(struct socket *sock, struct rxrpc_call *call);
|
| 75 | void rxrpc_kernel_put_call(struct socket *sock, struct rxrpc_call *call);
|
| 76 | struct rxrpc_peer *rxrpc_kernel_lookup_peer(struct socket *sock,
|
| 77 | struct sockaddr_rxrpc *srx, gfp_t gfp);
|
| 78 | void rxrpc_kernel_put_peer(struct rxrpc_peer *peer);
|
| 79 | struct rxrpc_peer *rxrpc_kernel_get_peer(struct rxrpc_peer *peer);
|
| 80 | struct rxrpc_peer *rxrpc_kernel_get_call_peer(struct socket *sock, struct rxrpc_call *call);
|
| 81 | const struct sockaddr_rxrpc *rxrpc_kernel_remote_srx(const struct rxrpc_peer *peer);
|
| 82 | const struct sockaddr *rxrpc_kernel_remote_addr(const struct rxrpc_peer *peer);
|
| 83 | unsigned long rxrpc_kernel_set_peer_data(struct rxrpc_peer *peer, unsigned long app_data);
|
| 84 | unsigned long rxrpc_kernel_get_peer_data(const struct rxrpc_peer *peer);
|
| 85 | unsigned int rxrpc_kernel_get_srtt(const struct rxrpc_peer *);
|
| 86 | int rxrpc_kernel_charge_accept(struct socket *sock, rxrpc_notify_rx_t notify_rx,
|
| 87 | unsigned long user_call_ID, gfp_t gfp,
|
| 88 | unsigned int debug_id);
|
| 89 | void rxrpc_kernel_set_tx_length(struct socket *, struct rxrpc_call *, s64);
|
| 90 | bool rxrpc_kernel_check_life(const struct socket *, const struct rxrpc_call *);
|
| 91 |
|
| 92 | int rxrpc_sock_set_min_security_level(struct sock *sk, unsigned int val);
|
| 93 | int rxrpc_sock_set_security_keyring(struct sock *, struct key *);
|
| 94 | int rxrpc_sock_set_manage_response(struct sock *sk, bool set);
|
| 95 |
|
| 96 | enum rxrpc_oob_type rxrpc_kernel_query_oob(struct sk_buff *oob,
|
| 97 | struct rxrpc_peer **_peer,
|
| 98 | unsigned long *_peer_appdata);
|
| 99 | struct sk_buff *rxrpc_kernel_dequeue_oob(struct socket *sock,
|
| 100 | enum rxrpc_oob_type *_type);
|
| 101 | void rxrpc_kernel_free_oob(struct sk_buff *oob);
|
| 102 | void rxrpc_kernel_query_challenge(struct sk_buff *challenge,
|
| 103 | struct rxrpc_peer **_peer,
|
| 104 | unsigned long *_peer_appdata,
|
| 105 | u16 *_service_id, u8 *_security_index);
|
| 106 | int rxrpc_kernel_reject_challenge(struct sk_buff *challenge, u32 abort_code,
|
| 107 | int error, enum rxrpc_abort_reason why);
|
| 108 | int rxkad_kernel_respond_to_challenge(struct sk_buff *challenge);
|
| 109 | u32 rxgk_kernel_query_challenge(struct sk_buff *challenge);
|
| 110 | int rxgk_kernel_respond_to_challenge(struct sk_buff *challenge,
|
| 111 | struct krb5_buffer *appdata);
|
| 112 | u8 rxrpc_kernel_query_call_security(struct rxrpc_call *call,
|
| 113 | u16 *_service_id, u32 *_enctype);
|
| 114 |
|
| 115 | #endif
|