1/*
2 * Copyright (c) 2009-2013 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24/*
25 * DHCPv6Socket.h
26 * - maintain list of DHCPv6 clients
27 * - distribute packet reception to enabled clients
28 */
29/*
30 * Modification History
31 *
32 * September 30, 2009		Dieter Siegmund (dieter@apple.com)
33 * - created (based on bootp_session.h)
34 */
35
36#ifndef _S_DHCPV6SOCKET_H
37#define _S_DHCPV6SOCKET_H
38
39#include <stdint.h>
40#include "DHCPv6.h"
41#include "DHCPv6Options.h"
42#include "FDSet.h"
43#include "interfaces.h"
44
45typedef struct {
46    DHCPv6PacketRef		pkt;
47    int				pkt_len;
48    DHCPv6OptionListRef		options;
49} DHCPv6SocketReceiveData, * DHCPv6SocketReceiveDataRef;
50
51/*
52 * Type: DHCPv6SocketReceiveFunc
53 * Purpose:
54 *   Called to deliver data to the client.  The first two args are
55 *   supplied by the client, the third is a pointer to a DHCPv6Receive_data_t.
56 */
57typedef void (DHCPv6SocketReceiveFunc)(void * arg1, void * arg2, void * arg3);
58typedef DHCPv6SocketReceiveFunc * DHCPv6SocketReceiveFuncPtr;
59
60typedef struct DHCPv6Socket * DHCPv6SocketRef;
61
62void
63DHCPv6SocketSetVerbose(bool verbose);
64
65void
66DHCPv6SocketSetPorts(uint16_t client_port, uint16_t server_port);
67
68DHCPv6SocketRef
69DHCPv6SocketCreate(interface_t * if_p);
70
71interface_t *
72DHCPv6SocketGetInterface(DHCPv6SocketRef sock);
73
74void
75DHCPv6SocketRelease(DHCPv6SocketRef * sock);
76
77void
78DHCPv6SocketEnableReceive(DHCPv6SocketRef sock,
79			  DHCPv6SocketReceiveFuncPtr func,
80			  void * arg1, void * arg2);
81
82void
83DHCPv6SocketDisableReceive(DHCPv6SocketRef sock);
84
85int
86DHCPv6SocketTransmit(DHCPv6SocketRef sock,
87		     DHCPv6PacketRef pkt, int pkt_len);
88
89#endif /* _S_DHCPV6SOCKET_H */
90