^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (c) 2014 Intel Corporation. All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright (c) 2014 Chelsio, Inc. All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #ifndef _IW_PORTMAP_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #define _IW_PORTMAP_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/socket.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/netlink.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #define IWPM_ULIBNAME_SIZE 32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #define IWPM_DEVNAME_SIZE 32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #define IWPM_IFNAME_SIZE 16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #define IWPM_IPADDR_SIZE 16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) IWPM_INVALID_NLMSG_ERR = 10,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) IWPM_CREATE_MAPPING_ERR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) IWPM_DUPLICATE_MAPPING_ERR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) IWPM_UNKNOWN_MAPPING_ERR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) IWPM_CLIENT_DEV_INFO_ERR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) IWPM_USER_LIB_INFO_ERR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) IWPM_REMOTE_QUERY_REJECT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) struct iwpm_dev_data {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) char dev_name[IWPM_DEVNAME_SIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) char if_name[IWPM_IFNAME_SIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) struct iwpm_sa_data {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) struct sockaddr_storage loc_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) struct sockaddr_storage mapped_loc_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) struct sockaddr_storage rem_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) struct sockaddr_storage mapped_rem_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) u32 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) int iwpm_init(u8);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) int iwpm_exit(u8);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) int iwpm_valid_pid(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) int iwpm_register_pid(struct iwpm_dev_data *pm_msg, u8 nl_client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) int iwpm_add_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) int iwpm_add_and_query_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) int iwpm_remove_mapping(struct sockaddr_storage *local_addr, u8 nl_client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) int iwpm_register_pid_cb(struct sk_buff *, struct netlink_callback *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) int iwpm_add_mapping_cb(struct sk_buff *, struct netlink_callback *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) int iwpm_add_and_query_mapping_cb(struct sk_buff *, struct netlink_callback *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) int iwpm_remote_info_cb(struct sk_buff *, struct netlink_callback *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) int iwpm_mapping_error_cb(struct sk_buff *, struct netlink_callback *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) int iwpm_mapping_info_cb(struct sk_buff *, struct netlink_callback *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) int iwpm_ack_mapping_info_cb(struct sk_buff *, struct netlink_callback *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) int iwpm_get_remote_info(struct sockaddr_storage *mapped_loc_addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) struct sockaddr_storage *mapped_rem_addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) struct sockaddr_storage *remote_addr, u8 nl_client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) int iwpm_create_mapinfo(struct sockaddr_storage *local_addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) struct sockaddr_storage *mapped_addr, u8 nl_client,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) u32 map_flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) int iwpm_remove_mapinfo(struct sockaddr_storage *local_addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) struct sockaddr_storage *mapped_addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) int iwpm_hello_cb(struct sk_buff *skb, struct netlink_callback *cb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) #endif /* _IW_PORTMAP_H */