xref: /netbsd-src/external/mpl/dhcp/dist/includes/omapip/convert.h (revision f407d9293b6650aa8c33d6a995f797bb6aaefd90)
1 /*	$NetBSD: convert.h,v 1.3 2022/04/03 01:10:59 christos Exp $	*/
2 
3 /* convert.h
4 
5    Safe copying of integers into and out of a non-aligned memory buffer. */
6 
7 /*
8  * Copyright (C) 2004-2022 Internet Systems Consortium, Inc. ("ISC")
9  * Copyright (c) 1996-2003 by Internet Software Consortium
10  *
11  * This Source Code Form is subject to the terms of the Mozilla Public
12  * License, v. 2.0. If a copy of the MPL was not distributed with this
13  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
16  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
17  * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR
18  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
20  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
21  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22  *
23  *   Internet Systems Consortium, Inc.
24  *   PO Box 360
25  *   Newmarket, NH 03857 USA
26  *   <info@isc.org>
27  *   https://www.isc.org/
28  *
29  */
30 
31 #ifndef OMAPI_CONVERT_H
32 #define OMAPI_CONVERT_H
33 
34 u_int32_t getULong (const unsigned char *);
35 int32_t getLong (const unsigned char *);
36 u_int32_t getUShort (const unsigned char *);
37 int32_t getShort (const unsigned char *);
38 u_int32_t getUChar (const unsigned char *);
39 void putULong (unsigned char *, u_int32_t);
40 void putLong (unsigned char *, int32_t);
41 void putUShort (unsigned char *, u_int32_t);
42 void putShort (unsigned char *, int32_t);
43 void putUChar (unsigned char *, u_int32_t);
44 int converted_length (const unsigned char *, unsigned int, unsigned int);
45 int binary_to_ascii (unsigned char *, const unsigned char *,
46 		     unsigned int, unsigned int);
47 
48 #endif /* OMAPI_CONVERT_H */
49