18c2ecf20Sopenharmony_ci/* net/tipc/socket.h: Include file for TIPC socket code
28c2ecf20Sopenharmony_ci *
38c2ecf20Sopenharmony_ci * Copyright (c) 2014-2016, Ericsson AB
48c2ecf20Sopenharmony_ci * All rights reserved.
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * Redistribution and use in source and binary forms, with or without
78c2ecf20Sopenharmony_ci * modification, are permitted provided that the following conditions are met:
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci * 1. Redistributions of source code must retain the above copyright
108c2ecf20Sopenharmony_ci *    notice, this list of conditions and the following disclaimer.
118c2ecf20Sopenharmony_ci * 2. Redistributions in binary form must reproduce the above copyright
128c2ecf20Sopenharmony_ci *    notice, this list of conditions and the following disclaimer in the
138c2ecf20Sopenharmony_ci *    documentation and/or other materials provided with the distribution.
148c2ecf20Sopenharmony_ci * 3. Neither the names of the copyright holders nor the names of its
158c2ecf20Sopenharmony_ci *    contributors may be used to endorse or promote products derived from
168c2ecf20Sopenharmony_ci *    this software without specific prior written permission.
178c2ecf20Sopenharmony_ci *
188c2ecf20Sopenharmony_ci * Alternatively, this software may be distributed under the terms of the
198c2ecf20Sopenharmony_ci * GNU General Public License ("GPL") version 2 as published by the Free
208c2ecf20Sopenharmony_ci * Software Foundation.
218c2ecf20Sopenharmony_ci *
228c2ecf20Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
238c2ecf20Sopenharmony_ci * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
248c2ecf20Sopenharmony_ci * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
258c2ecf20Sopenharmony_ci * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
268c2ecf20Sopenharmony_ci * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
278c2ecf20Sopenharmony_ci * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
288c2ecf20Sopenharmony_ci * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
298c2ecf20Sopenharmony_ci * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
308c2ecf20Sopenharmony_ci * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
318c2ecf20Sopenharmony_ci * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
328c2ecf20Sopenharmony_ci * POSSIBILITY OF SUCH DAMAGE.
338c2ecf20Sopenharmony_ci */
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#ifndef _TIPC_SOCK_H
368c2ecf20Sopenharmony_ci#define _TIPC_SOCK_H
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci#include <net/sock.h>
398c2ecf20Sopenharmony_ci#include <net/genetlink.h>
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci/* Compatibility values for deprecated message based flow control */
428c2ecf20Sopenharmony_ci#define FLOWCTL_MSG_WIN 512
438c2ecf20Sopenharmony_ci#define FLOWCTL_MSG_LIM ((FLOWCTL_MSG_WIN * 2 + 1) * SKB_TRUESIZE(MAX_MSG_SIZE))
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci#define FLOWCTL_BLK_SZ 1024
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci/* Socket receive buffer sizes */
488c2ecf20Sopenharmony_ci#define RCVBUF_MIN  (FLOWCTL_BLK_SZ * 512)
498c2ecf20Sopenharmony_ci#define RCVBUF_DEF  (FLOWCTL_BLK_SZ * 1024 * 2)
508c2ecf20Sopenharmony_ci#define RCVBUF_MAX  (FLOWCTL_BLK_SZ * 1024 * 16)
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_cistruct tipc_sock;
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ciint tipc_socket_init(void);
558c2ecf20Sopenharmony_civoid tipc_socket_stop(void);
568c2ecf20Sopenharmony_civoid tipc_sk_rcv(struct net *net, struct sk_buff_head *inputq);
578c2ecf20Sopenharmony_civoid tipc_sk_mcast_rcv(struct net *net, struct sk_buff_head *arrvq,
588c2ecf20Sopenharmony_ci		       struct sk_buff_head *inputq);
598c2ecf20Sopenharmony_civoid tipc_sk_reinit(struct net *net);
608c2ecf20Sopenharmony_ciint tipc_sk_rht_init(struct net *net);
618c2ecf20Sopenharmony_civoid tipc_sk_rht_destroy(struct net *net);
628c2ecf20Sopenharmony_ciint tipc_nl_sk_dump(struct sk_buff *skb, struct netlink_callback *cb);
638c2ecf20Sopenharmony_ciint tipc_nl_publ_dump(struct sk_buff *skb, struct netlink_callback *cb);
648c2ecf20Sopenharmony_ciint tipc_sk_fill_sock_diag(struct sk_buff *skb, struct netlink_callback *cb,
658c2ecf20Sopenharmony_ci			   struct tipc_sock *tsk, u32 sk_filter_state,
668c2ecf20Sopenharmony_ci			   u64 (*tipc_diag_gen_cookie)(struct sock *sk));
678c2ecf20Sopenharmony_ciint tipc_nl_sk_walk(struct sk_buff *skb, struct netlink_callback *cb,
688c2ecf20Sopenharmony_ci		    int (*skb_handler)(struct sk_buff *skb,
698c2ecf20Sopenharmony_ci				       struct netlink_callback *cb,
708c2ecf20Sopenharmony_ci				       struct tipc_sock *tsk));
718c2ecf20Sopenharmony_ciint tipc_dump_start(struct netlink_callback *cb);
728c2ecf20Sopenharmony_ciint __tipc_dump_start(struct netlink_callback *cb, struct net *net);
738c2ecf20Sopenharmony_ciint tipc_dump_done(struct netlink_callback *cb);
748c2ecf20Sopenharmony_ciu32 tipc_sock_get_portid(struct sock *sk);
758c2ecf20Sopenharmony_cibool tipc_sk_overlimit1(struct sock *sk, struct sk_buff *skb);
768c2ecf20Sopenharmony_cibool tipc_sk_overlimit2(struct sock *sk, struct sk_buff *skb);
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ciint tsk_set_importance(struct sock *sk, int imp);
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci#endif
81