/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * include/uapi/linux/tipc_config.h: Header for TIPC configuration interface * * Copyright (c) 2003-2006, Ericsson AB * Copyright (c) 2005-2007, 2010-2011, Wind River Systems * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the names of the copyright holders nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * Alternatively, this software may be distributed under the terms of the * GNU General Public License ("GPL") version 2 as published by the Free * Software Foundation. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #ifndef _LINUX_TIPC_CONFIG_H_ #define _LINUX_TIPC_CONFIG_H_ #include <linux/types.h> #include <linux/string.h> #include <linux/tipc.h> #include <asm/byteorder.h> /* * Configuration * * All configuration management messaging involves sending a request message * to the TIPC configuration service on a node, which sends a reply message * back. (In the future multi-message replies may be supported.) * * Both request and reply messages consist of a transport header and payload. * The transport header contains info about the desired operation; * the payload consists of zero or more type/length/value (TLV) items * which specify parameters or results for the operation. * * For many operations, the request and reply messages have a fixed number * of TLVs (usually zero or one); however, some reply messages may return * a variable number of TLVs. A failed request is denoted by the presence * of an "error string" TLV in the reply message instead of the TLV(s) the * reply should contain if the request succeeds. */ /* * Public commands: * May be issued by any process. * Accepted by own node, or by remote node only if remote management enabled. */ #define TIPC_CMD_NOOP … #define TIPC_CMD_GET_NODES … #define TIPC_CMD_GET_MEDIA_NAMES … #define TIPC_CMD_GET_BEARER_NAMES … #define TIPC_CMD_GET_LINKS … #define TIPC_CMD_SHOW_NAME_TABLE … #define TIPC_CMD_SHOW_PORTS … #define TIPC_CMD_SHOW_LINK_STATS … #define TIPC_CMD_SHOW_STATS … /* * Protected commands: * May only be issued by "network administration capable" process. * Accepted by own node, or by remote node only if remote management enabled * and this node is zone manager. */ #define TIPC_CMD_GET_REMOTE_MNG … #define TIPC_CMD_GET_MAX_PORTS … #define TIPC_CMD_GET_MAX_PUBL … #define TIPC_CMD_GET_MAX_SUBSCR … #define TIPC_CMD_GET_MAX_ZONES … #define TIPC_CMD_GET_MAX_CLUSTERS … #define TIPC_CMD_GET_MAX_NODES … #define TIPC_CMD_GET_MAX_SLAVES … #define TIPC_CMD_GET_NETID … #define TIPC_CMD_ENABLE_BEARER … #define TIPC_CMD_DISABLE_BEARER … #define TIPC_CMD_SET_LINK_TOL … #define TIPC_CMD_SET_LINK_PRI … #define TIPC_CMD_SET_LINK_WINDOW … #define TIPC_CMD_SET_LOG_SIZE … #define TIPC_CMD_DUMP_LOG … #define TIPC_CMD_RESET_LINK_STATS … /* * Private commands: * May only be issued by "network administration capable" process. * Accepted by own node only; cannot be used on a remote node. */ #define TIPC_CMD_SET_NODE_ADDR … #define TIPC_CMD_SET_REMOTE_MNG … #define TIPC_CMD_SET_MAX_PORTS … #define TIPC_CMD_SET_MAX_PUBL … #define TIPC_CMD_SET_MAX_SUBSCR … #define TIPC_CMD_SET_MAX_ZONES … #define TIPC_CMD_SET_MAX_CLUSTERS … #define TIPC_CMD_SET_MAX_NODES … #define TIPC_CMD_SET_MAX_SLAVES … #define TIPC_CMD_SET_NETID … /* * Reserved commands: * May not be issued by any process. * Used internally by TIPC. */ #define TIPC_CMD_NOT_NET_ADMIN … /* * TLV types defined for TIPC */ #define TIPC_TLV_NONE … #define TIPC_TLV_VOID … #define TIPC_TLV_UNSIGNED … #define TIPC_TLV_STRING … #define TIPC_TLV_LARGE_STRING … #define TIPC_TLV_ULTRA_STRING … #define TIPC_TLV_ERROR_STRING … #define TIPC_TLV_NET_ADDR … #define TIPC_TLV_MEDIA_NAME … #define TIPC_TLV_BEARER_NAME … #define TIPC_TLV_LINK_NAME … #define TIPC_TLV_NODE_INFO … #define TIPC_TLV_LINK_INFO … #define TIPC_TLV_BEARER_CONFIG … #define TIPC_TLV_LINK_CONFIG … #define TIPC_TLV_NAME_TBL_QUERY … #define TIPC_TLV_PORT_REF … /* * Link priority limits (min, default, max, media default) */ #define TIPC_MIN_LINK_PRI … #define TIPC_DEF_LINK_PRI … #define TIPC_MAX_LINK_PRI … #define TIPC_MEDIA_LINK_PRI … /* * Link tolerance limits (min, default, max), in ms */ #define TIPC_MIN_LINK_TOL … #define TIPC_DEF_LINK_TOL … #define TIPC_MAX_LINK_TOL … #if (TIPC_MIN_LINK_TOL < 16) #error "TIPC_MIN_LINK_TOL is too small (abort limit may be NaN)" #endif /* * Link window limits (min, default, max), in packets */ #define TIPC_MIN_LINK_WIN … #define TIPC_DEF_LINK_WIN … #define TIPC_MAX_LINK_WIN … /* * Default MTU for UDP media */ #define TIPC_DEF_LINK_UDP_MTU … struct tipc_node_info { … }; struct tipc_link_info { … }; struct tipc_bearer_config { … }; struct tipc_link_config { … }; #define TIPC_NTQ_ALLTYPES … struct tipc_name_table_query { … }; /* * The error string TLV is a null-terminated string describing the cause * of the request failure. To simplify error processing (and to save space) * the first character of the string can be a special error code character * (lying by the range 0x80 to 0xFF) which represents a pre-defined reason. */ #define TIPC_CFG_TLV_ERROR … #define TIPC_CFG_NOT_NET_ADMIN … #define TIPC_CFG_NOT_ZONE_MSTR … #define TIPC_CFG_NO_REMOTE … #define TIPC_CFG_NOT_SUPPORTED … #define TIPC_CFG_INVALID_VALUE … /* * A TLV consists of a descriptor, followed by the TLV value. * TLV descriptor fields are stored in network byte order; * TLV values must also be stored in network byte order (where applicable). * TLV descriptors must be aligned to addresses which are multiple of 4, * so up to 3 bytes of padding may exist at the end of the TLV value area. * There must not be any padding between the TLV descriptor and its value. */ struct tlv_desc { … }; #define TLV_ALIGNTO … #define TLV_ALIGN(datalen) … #define TLV_LENGTH(datalen) … #define TLV_SPACE(datalen) … #define TLV_DATA(tlv) … static inline int TLV_OK(const void *tlv, __u16 space) { … } static inline int TLV_CHECK(const void *tlv, __u16 space, __u16 exp_type) { … } static inline int TLV_GET_LEN(struct tlv_desc *tlv) { … } static inline void TLV_SET_LEN(struct tlv_desc *tlv, __u16 len) { … } static inline int TLV_CHECK_TYPE(struct tlv_desc *tlv, __u16 type) { … } static inline void TLV_SET_TYPE(struct tlv_desc *tlv, __u16 type) { … } static inline int TLV_SET(void *tlv, __u16 type, void *data, __u16 len) { … } /* * A TLV list descriptor simplifies processing of messages * containing multiple TLVs. */ struct tlv_list_desc { … }; static inline void TLV_LIST_INIT(struct tlv_list_desc *list, void *data, __u32 space) { … } static inline int TLV_LIST_EMPTY(struct tlv_list_desc *list) { … } static inline int TLV_LIST_CHECK(struct tlv_list_desc *list, __u16 exp_type) { … } static inline void *TLV_LIST_DATA(struct tlv_list_desc *list) { … } static inline void TLV_LIST_STEP(struct tlv_list_desc *list) { … } /* * Configuration messages exchanged via NETLINK_GENERIC use the following * family id, name, version and command. */ #define TIPC_GENL_NAME … #define TIPC_GENL_VERSION … #define TIPC_GENL_CMD … /* * TIPC specific header used in NETLINK_GENERIC requests. */ struct tipc_genlmsghdr { … }; #define TIPC_GENL_HDRLEN … /* * Configuration messages exchanged via TIPC sockets use the TIPC configuration * message header, which is defined below. This structure is analogous * to the Netlink message header, but fields are stored in network byte order * and no padding is permitted between the header and the message data * that follows. */ struct tipc_cfg_msg_hdr { … }; #define TCM_F_REQUEST … #define TCM_F_MORE … #define TCM_ALIGN(datalen) … #define TCM_LENGTH(datalen) … #define TCM_SPACE(datalen) … #define TCM_DATA(tcm_hdr) … static inline int TCM_SET(void *msg, __u16 cmd, __u16 flags, void *data, __u16 data_len) { … } #endif