iwpm_util.h revision 331769
1/*
2 * Copyright (c) 2014 Intel Corporation. All rights reserved.
3 * Copyright (c) 2014 Chelsio, Inc. All rights reserved.
4 *
5 * This software is available to you under a choice of one of two
6 * licenses.  You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the
9 * OpenIB.org BSD license below:
10 *
11 *     Redistribution and use in source and binary forms, with or
12 *     without modification, are permitted provided that the following
13 *     conditions are met:
14 *
15 *      - Redistributions of source code must retain the above
16 *	  copyright notice, this list of conditions and the following
17 *	  disclaimer.
18 *
19 *      - Redistributions in binary form must reproduce the above
20 *	  copyright notice, this list of conditions and the following
21 *	  disclaimer in the documentation and/or other materials
22 *	  provided with the distribution.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31 * SOFTWARE.
32 */
33#ifndef _IWPM_UTIL_H
34#define _IWPM_UTIL_H
35
36#include <linux/module.h>
37#include <linux/io.h>
38#include <linux/in.h>
39#include <linux/in6.h>
40#include <linux/spinlock.h>
41#include <linux/kernel.h>
42#include <linux/netdevice.h>
43#include <linux/delay.h>
44#include <linux/workqueue.h>
45#include <linux/mutex.h>
46#include <linux/jhash.h>
47#include <linux/kref.h>
48#include <linux/errno.h>
49#include <linux/rwsem.h>
50
51#include <rdma/iw_portmap.h>
52
53#define IWPM_PID_UNDEFINED     -1
54#define IWPM_PID_UNAVAILABLE   -2
55
56#define IWPM_REG_UNDEF          0x01
57#define IWPM_REG_VALID          0x02
58#define IWPM_REG_INCOMPL        0x04
59
60/**
61 * iwpm_compare_sockaddr - Compare two sockaddr storage structs
62 *
63 * Returns 0 if they are holding the same ip/tcp address info,
64 * otherwise returns 1
65 */
66int iwpm_compare_sockaddr(struct sockaddr_storage *a_sockaddr,
67			struct sockaddr_storage *b_sockaddr);
68
69/**
70 * iwpm_print_sockaddr - Print IPv4/IPv6 address and TCP port
71 * @sockaddr: Socket address to print
72 * @msg: Message to print
73 */
74void iwpm_print_sockaddr(struct sockaddr_storage *sockaddr, char *msg);
75#endif
76