"Inital commit to Gerrit"
[profile/ivi/dhcp.git] / includes / omapip / convert.h
1 /* convert.h
2
3    Safe copying of integers into and out of a non-aligned memory buffer. */
4
5 /*
6  * Copyright (c) 2004,2009 by Internet Systems Consortium, Inc. ("ISC")
7  * Copyright (c) 1996-2003 by Internet Software Consortium
8  *
9  * Permission to use, copy, modify, and distribute this software for any
10  * purpose with or without fee is hereby granted, provided that the above
11  * copyright notice and this permission notice appear in all copies.
12  *
13  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
14  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15  * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR
16  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
19  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20  *
21  *   Internet Systems Consortium, Inc.
22  *   950 Charter Street
23  *   Redwood City, CA 94063
24  *   <info@isc.org>
25  *   https://www.isc.org/
26  *
27  * This software has been written for Internet Systems Consortium
28  * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc.
29  * To learn more about Internet Systems Consortium, see
30  * ``https://www.isc.org/''.  To learn more about Vixie Enterprises,
31  * see ``http://www.vix.com''.   To learn more about Nominum, Inc., see
32  * ``http://www.nominum.com''.
33  */
34
35 #ifndef OMAPI_CONVERT_H
36 #define OMAPI_CONVERT_H
37
38 u_int32_t getULong (const unsigned char *);
39 int32_t getLong (const unsigned char *);
40 u_int32_t getUShort (const unsigned char *);
41 int32_t getShort (const unsigned char *);
42 u_int32_t getUChar (const unsigned char *);
43 void putULong (unsigned char *, u_int32_t);
44 void putLong (unsigned char *, int32_t);
45 void putUShort (unsigned char *, u_int32_t);
46 void putShort (unsigned char *, int32_t);
47 void putUChar (unsigned char *, u_int32_t);
48 int converted_length (const unsigned char *, unsigned int, unsigned int);
49 int binary_to_ascii (unsigned char *, const unsigned char *,
50                      unsigned int, unsigned int);
51
52 #endif /* OMAPI_CONVERT_H */