xref: /linux-6.15/net/tipc/socket.h (revision b4b9771b)
18826cde6SJon Paul Maloy /* net/tipc/socket.h: Include file for TIPC socket code
28826cde6SJon Paul Maloy  *
310724cc7SJon Paul Maloy  * Copyright (c) 2014-2016, Ericsson AB
48826cde6SJon Paul Maloy  * All rights reserved.
58826cde6SJon Paul Maloy  *
68826cde6SJon Paul Maloy  * Redistribution and use in source and binary forms, with or without
78826cde6SJon Paul Maloy  * modification, are permitted provided that the following conditions are met:
88826cde6SJon Paul Maloy  *
98826cde6SJon Paul Maloy  * 1. Redistributions of source code must retain the above copyright
108826cde6SJon Paul Maloy  *    notice, this list of conditions and the following disclaimer.
118826cde6SJon Paul Maloy  * 2. Redistributions in binary form must reproduce the above copyright
128826cde6SJon Paul Maloy  *    notice, this list of conditions and the following disclaimer in the
138826cde6SJon Paul Maloy  *    documentation and/or other materials provided with the distribution.
148826cde6SJon Paul Maloy  * 3. Neither the names of the copyright holders nor the names of its
158826cde6SJon Paul Maloy  *    contributors may be used to endorse or promote products derived from
168826cde6SJon Paul Maloy  *    this software without specific prior written permission.
178826cde6SJon Paul Maloy  *
188826cde6SJon Paul Maloy  * Alternatively, this software may be distributed under the terms of the
198826cde6SJon Paul Maloy  * GNU General Public License ("GPL") version 2 as published by the Free
208826cde6SJon Paul Maloy  * Software Foundation.
218826cde6SJon Paul Maloy  *
228826cde6SJon Paul Maloy  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
238826cde6SJon Paul Maloy  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
248826cde6SJon Paul Maloy  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
258826cde6SJon Paul Maloy  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
268826cde6SJon Paul Maloy  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
278826cde6SJon Paul Maloy  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
288826cde6SJon Paul Maloy  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
298826cde6SJon Paul Maloy  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
308826cde6SJon Paul Maloy  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
318826cde6SJon Paul Maloy  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
328826cde6SJon Paul Maloy  * POSSIBILITY OF SUCH DAMAGE.
338826cde6SJon Paul Maloy  */
348826cde6SJon Paul Maloy 
358826cde6SJon Paul Maloy #ifndef _TIPC_SOCK_H
368826cde6SJon Paul Maloy #define _TIPC_SOCK_H
378826cde6SJon Paul Maloy 
388826cde6SJon Paul Maloy #include <net/sock.h>
3934b78a12SRichard Alpe #include <net/genetlink.h>
408826cde6SJon Paul Maloy 
4110724cc7SJon Paul Maloy /* Compatibility values for deprecated message based flow control */
4210724cc7SJon Paul Maloy #define FLOWCTL_MSG_WIN 512
4310724cc7SJon Paul Maloy #define FLOWCTL_MSG_LIM ((FLOWCTL_MSG_WIN * 2 + 1) * SKB_TRUESIZE(MAX_MSG_SIZE))
4410724cc7SJon Paul Maloy 
4510724cc7SJon Paul Maloy #define FLOWCTL_BLK_SZ 1024
4610724cc7SJon Paul Maloy 
4710724cc7SJon Paul Maloy /* Socket receive buffer sizes */
4810724cc7SJon Paul Maloy #define RCVBUF_MIN  (FLOWCTL_BLK_SZ * 512)
4910724cc7SJon Paul Maloy #define RCVBUF_DEF  (FLOWCTL_BLK_SZ * 1024 * 2)
5010724cc7SJon Paul Maloy #define RCVBUF_MAX  (FLOWCTL_BLK_SZ * 1024 * 16)
5110724cc7SJon Paul Maloy 
52c30b70deSGhantaKrishnamurthy MohanKrishna struct tipc_sock;
53c30b70deSGhantaKrishnamurthy MohanKrishna 
54859fc7c0SYing Xue int tipc_socket_init(void);
55859fc7c0SYing Xue void tipc_socket_stop(void);
56cda3696dSJon Paul Maloy void tipc_sk_rcv(struct net *net, struct sk_buff_head *inputq);
57cb1b7280SJon Paul Maloy void tipc_sk_mcast_rcv(struct net *net, struct sk_buff_head *arrvq,
58cb1b7280SJon Paul Maloy 		       struct sk_buff_head *inputq);
59e05b31f4SYing Xue void tipc_sk_reinit(struct net *net);
60e05b31f4SYing Xue int tipc_sk_rht_init(struct net *net);
61e05b31f4SYing Xue void tipc_sk_rht_destroy(struct net *net);
6234b78a12SRichard Alpe int tipc_nl_sk_dump(struct sk_buff *skb, struct netlink_callback *cb);
631a1a143dSRichard Alpe int tipc_nl_publ_dump(struct sk_buff *skb, struct netlink_callback *cb);
64e41f0548SCong Wang int tipc_sk_fill_sock_diag(struct sk_buff *skb, struct netlink_callback *cb,
65e41f0548SCong Wang 			   struct tipc_sock *tsk, u32 sk_filter_state,
66c30b70deSGhantaKrishnamurthy MohanKrishna 			   u64 (*tipc_diag_gen_cookie)(struct sock *sk));
67c30b70deSGhantaKrishnamurthy MohanKrishna int tipc_nl_sk_walk(struct sk_buff *skb, struct netlink_callback *cb,
68c30b70deSGhantaKrishnamurthy MohanKrishna 		    int (*skb_handler)(struct sk_buff *skb,
69c30b70deSGhantaKrishnamurthy MohanKrishna 				       struct netlink_callback *cb,
70c30b70deSGhantaKrishnamurthy MohanKrishna 				       struct tipc_sock *tsk));
719a07efa9SCong Wang int tipc_dump_start(struct netlink_callback *cb);
728f5c5fcfSCong Wang int __tipc_dump_start(struct netlink_callback *cb, struct net *net);
739a07efa9SCong Wang int tipc_dump_done(struct netlink_callback *cb);
74*b4b9771bSTuong Lien u32 tipc_sock_get_portid(struct sock *sk);
75*b4b9771bSTuong Lien 
768826cde6SJon Paul Maloy #endif
77