1/*
2 * Copyright (c) 2000-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 * bootp_session.h
26 * - maintain BOOTP client socket session
27 * - maintain list of BOOTP clients
28 * - distribute packet reception to enabled clients
29 */
30
31/*
32 * Modification History
33 *
34 * May 10, 2000		Dieter Siegmund (dieter@apple.com)
35 * - created
36 */
37
38#ifndef _S_BOOTP_SESSION_H
39#define _S_BOOTP_SESSION_H
40
41#include <stdint.h>
42#include "dhcp_options.h"
43#include "FDSet.h"
44#include "interfaces.h"
45
46typedef struct {
47    struct dhcp  *		data;
48    int				size;
49    dhcpol_t			options;
50} bootp_receive_data_t;
51
52/*
53 * Type: bootp_receive_func_t
54 * Purpose:
55 *   Called to deliver data to the client.  The first two args are
56 *   supplied by the client, the third is a pointer to a bootp_receive_data_t.
57 */
58typedef void (bootp_receive_func_t)(void * arg1, void * arg2, void * arg3);
59
60typedef struct bootp_session bootp_session_t;
61typedef struct bootp_client bootp_client_t;
62
63bootp_client_t *
64bootp_client_init(bootp_session_t * slist, interface_t * if_p);
65
66void
67bootp_client_free(bootp_client_t * * session);
68
69void
70bootp_client_enable_receive(bootp_client_t * client,
71			    bootp_receive_func_t * func,
72			    void * arg1, void * arg2);
73
74void
75bootp_client_disable_receive(bootp_client_t * client);
76
77int
78bootp_client_transmit(bootp_client_t * client,
79		      struct in_addr dest_ip,
80		      struct in_addr src_ip,
81		      uint16_t dest_port,
82		      uint16_t src_port,
83		      void * data, int len);
84
85bootp_session_t *
86bootp_session_init(uint16_t client_port);
87
88void
89bootp_session_set_verbose(bool verbose);
90
91void
92bootp_session_free(bootp_session_t * * slist);
93
94#endif /* _S_BOOTP_SESSION_H */
95