1246827Sdes/*	$NetBSD: rfc6056.h,v 1.1 2011/09/24 17:18:17 christos Exp $	*/
2246827Sdes
3246827Sdes/*
4246827Sdes * Copyright 2011 Vlad Balan
5246827Sdes *
6298107Sgjb * Written by Vlad Balan for the NetBSD Foundation.
7249454Sdes *
8246827Sdes * Redistribution and use in source and binary forms, with or without
9249457Sdes * modification, are permitted provided that the following conditions
10255386Sdes * are met:
11246827Sdes * 1. Redistributions of source code must retain the above copyright
12249457Sdes *    notice, this list of conditions and the following disclaimer.
13246827Sdes * 2. Redistributions in binary form must reproduce the above copyright
14249457Sdes *    notice, this list of conditions and the following disclaimer in the
15249457Sdes *    documentation and/or other materials provided with the distribution.
16266114Sdes *
17266114Sdes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18249457Sdes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19246827Sdes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20266114Sdes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21249454Sdes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22275024Sbapt * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23255402Sdes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24246827Sdes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25246827Sdes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26246827Sdes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 */
30#ifndef _NETINET_RFC6056_H_
31#define _NETINET_RFC6056_H_
32
33#ifdef _KERNEL
34#include <sys/sysctl.h>
35
36int rfc6056_randport(uint16_t *, struct inpcb_hdr *, kauth_cred_t);
37int sysctl_rfc6056_selected(SYSCTLFN_ARGS);
38int sysctl_rfc6056_selected6(SYSCTLFN_ARGS);
39int sysctl_rfc6056_available(SYSCTLFN_ARGS);
40int rfc6056_algo_index_select(struct inpcb_hdr *, int);
41
42#define	RFC6056_MAXLEN       16
43#endif /* _KERNEL */
44
45/*
46 * User-settable options (used with setsockopt).
47 */
48#define	RFC6056_ALGO_DEFAULT			0xffff
49#define	RFC6056_ALGO_BSD			0
50#define	RFC6056_ALGO_RANDOM_START		1
51#define	RFC6056_ALGO_RANDOM_PICK		2
52#define	RFC6056_ALGO_HASH			3
53#define	RFC6056_ALGO_DOUBLEHASH			4
54#define	RFC6056_ALGO_RANDINC			5
55
56#endif /* !_NETINET_RFC6056_H_ */
57