xref: /kernel/linux/linux-6.6/net/tipc/socket.h (revision 62306a36)
162306a36Sopenharmony_ci/* net/tipc/socket.h: Include file for TIPC socket code
262306a36Sopenharmony_ci *
362306a36Sopenharmony_ci * Copyright (c) 2014-2016, Ericsson AB
462306a36Sopenharmony_ci * All rights reserved.
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci * Redistribution and use in source and binary forms, with or without
762306a36Sopenharmony_ci * modification, are permitted provided that the following conditions are met:
862306a36Sopenharmony_ci *
962306a36Sopenharmony_ci * 1. Redistributions of source code must retain the above copyright
1062306a36Sopenharmony_ci *    notice, this list of conditions and the following disclaimer.
1162306a36Sopenharmony_ci * 2. Redistributions in binary form must reproduce the above copyright
1262306a36Sopenharmony_ci *    notice, this list of conditions and the following disclaimer in the
1362306a36Sopenharmony_ci *    documentation and/or other materials provided with the distribution.
1462306a36Sopenharmony_ci * 3. Neither the names of the copyright holders nor the names of its
1562306a36Sopenharmony_ci *    contributors may be used to endorse or promote products derived from
1662306a36Sopenharmony_ci *    this software without specific prior written permission.
1762306a36Sopenharmony_ci *
1862306a36Sopenharmony_ci * Alternatively, this software may be distributed under the terms of the
1962306a36Sopenharmony_ci * GNU General Public License ("GPL") version 2 as published by the Free
2062306a36Sopenharmony_ci * Software Foundation.
2162306a36Sopenharmony_ci *
2262306a36Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
2362306a36Sopenharmony_ci * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2462306a36Sopenharmony_ci * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2562306a36Sopenharmony_ci * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
2662306a36Sopenharmony_ci * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2762306a36Sopenharmony_ci * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2862306a36Sopenharmony_ci * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2962306a36Sopenharmony_ci * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
3062306a36Sopenharmony_ci * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
3162306a36Sopenharmony_ci * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3262306a36Sopenharmony_ci * POSSIBILITY OF SUCH DAMAGE.
3362306a36Sopenharmony_ci */
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci#ifndef _TIPC_SOCK_H
3662306a36Sopenharmony_ci#define _TIPC_SOCK_H
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci#include <net/sock.h>
3962306a36Sopenharmony_ci#include <net/genetlink.h>
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci/* Compatibility values for deprecated message based flow control */
4262306a36Sopenharmony_ci#define FLOWCTL_MSG_WIN 512
4362306a36Sopenharmony_ci#define FLOWCTL_MSG_LIM ((FLOWCTL_MSG_WIN * 2 + 1) * SKB_TRUESIZE(MAX_MSG_SIZE))
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ci#define FLOWCTL_BLK_SZ 1024
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci/* Socket receive buffer sizes */
4862306a36Sopenharmony_ci#define RCVBUF_MIN  (FLOWCTL_BLK_SZ * 512)
4962306a36Sopenharmony_ci#define RCVBUF_DEF  (FLOWCTL_BLK_SZ * 1024 * 2)
5062306a36Sopenharmony_ci#define RCVBUF_MAX  (FLOWCTL_BLK_SZ * 1024 * 16)
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_cistruct tipc_sock;
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ciint tipc_socket_init(void);
5562306a36Sopenharmony_civoid tipc_socket_stop(void);
5662306a36Sopenharmony_civoid tipc_sk_rcv(struct net *net, struct sk_buff_head *inputq);
5762306a36Sopenharmony_civoid tipc_sk_mcast_rcv(struct net *net, struct sk_buff_head *arrvq,
5862306a36Sopenharmony_ci		       struct sk_buff_head *inputq);
5962306a36Sopenharmony_civoid tipc_sk_reinit(struct net *net);
6062306a36Sopenharmony_ciint tipc_sk_rht_init(struct net *net);
6162306a36Sopenharmony_civoid tipc_sk_rht_destroy(struct net *net);
6262306a36Sopenharmony_ciint tipc_nl_sk_dump(struct sk_buff *skb, struct netlink_callback *cb);
6362306a36Sopenharmony_ciint tipc_nl_publ_dump(struct sk_buff *skb, struct netlink_callback *cb);
6462306a36Sopenharmony_ciint tipc_sk_fill_sock_diag(struct sk_buff *skb, struct netlink_callback *cb,
6562306a36Sopenharmony_ci			   struct tipc_sock *tsk, u32 sk_filter_state,
6662306a36Sopenharmony_ci			   u64 (*tipc_diag_gen_cookie)(struct sock *sk));
6762306a36Sopenharmony_ciint tipc_nl_sk_walk(struct sk_buff *skb, struct netlink_callback *cb,
6862306a36Sopenharmony_ci		    int (*skb_handler)(struct sk_buff *skb,
6962306a36Sopenharmony_ci				       struct netlink_callback *cb,
7062306a36Sopenharmony_ci				       struct tipc_sock *tsk));
7162306a36Sopenharmony_ciint tipc_dump_start(struct netlink_callback *cb);
7262306a36Sopenharmony_ciint __tipc_dump_start(struct netlink_callback *cb, struct net *net);
7362306a36Sopenharmony_ciint tipc_dump_done(struct netlink_callback *cb);
7462306a36Sopenharmony_ciu32 tipc_sock_get_portid(struct sock *sk);
7562306a36Sopenharmony_cibool tipc_sk_overlimit1(struct sock *sk, struct sk_buff *skb);
7662306a36Sopenharmony_cibool tipc_sk_overlimit2(struct sock *sk, struct sk_buff *skb);
7762306a36Sopenharmony_ciint tipc_sk_bind(struct socket *sock, struct sockaddr *skaddr, int alen);
7862306a36Sopenharmony_ciint tsk_set_importance(struct sock *sk, int imp);
7962306a36Sopenharmony_ci
8062306a36Sopenharmony_ci#endif
81