1 /* $OpenBSD: util.h,v 1.32 2014/01/23 01:04:28 deraadt Exp $ */ 2 /* $EOM: util.h,v 1.10 2000/10/24 13:33:39 niklas Exp $ */ 3 4 /* 5 * Copyright (c) 1998 Niklas Hallqvist. All rights reserved. 6 * Copyright (c) 2001, 2004 H�kan Olsson. All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29 /* 30 * This code was written under funding by Ericsson Radio Systems. 31 */ 32 33 #ifndef _UTIL_H_ 34 #define _UTIL_H_ 35 36 #include <sys/types.h> 37 #include <sys/time.h> 38 39 extern int allow_name_lookups; 40 41 extern int sysdep_cleartext(int, int); 42 43 struct message; 44 struct sockaddr; 45 46 extern int check_file_secrecy_fd(int, char *, size_t *); 47 extern u_int16_t decode_16(u_int8_t *); 48 extern u_int32_t decode_32(u_int8_t *); 49 extern void encode_16(u_int8_t *, u_int16_t); 50 extern void encode_32(u_int8_t *, u_int32_t); 51 extern int hex2raw(char *, u_int8_t *, size_t); 52 extern char *raw2hex(u_int8_t *, size_t); 53 extern int sockaddr2text(struct sockaddr *, char **, int); 54 extern u_int8_t *sockaddr_addrdata(struct sockaddr *); 55 extern int sockaddr_addrlen(struct sockaddr *); 56 extern in_port_t sockaddr_port(struct sockaddr *); 57 extern void sockaddr_set_port(struct sockaddr *, in_port_t); 58 extern in_port_t text2port(char *); 59 extern int text2sockaddr(char *, char *, struct sockaddr **, 60 sa_family_t, int); 61 extern void util_ntoa(char **, int, u_int8_t *); 62 extern int zero_test(const u_int8_t *, size_t); 63 extern long get_timeout(struct timeval *); 64 extern int expand_string(char *, size_t, const char *, const char *); 65 66 #endif /* _UTIL_H_ */ 67