10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * Author: Tatu Ylonen <ylo@cs.hut.fi> 30Sstevel@tonic-gate * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 40Sstevel@tonic-gate * All rights reserved 50Sstevel@tonic-gate * 60Sstevel@tonic-gate * As far as I am concerned, the code I have written for this software 70Sstevel@tonic-gate * can be used freely for any purpose. Any derived versions of this 80Sstevel@tonic-gate * software must be clearly marked as such, and if the derived work is 90Sstevel@tonic-gate * incompatible with the protocol description in the RFC file, it must be 100Sstevel@tonic-gate * called by a name other than "ssh" or "Secure Shell". 110Sstevel@tonic-gate */ 120Sstevel@tonic-gate /* 134907Sjp161948 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 140Sstevel@tonic-gate * Use is subject to license terms. 150Sstevel@tonic-gate */ 160Sstevel@tonic-gate 17*5087Sjp161948 #ifndef _MISC_H 18*5087Sjp161948 #define _MISC_H 19*5087Sjp161948 20*5087Sjp161948 /* $OpenBSD: misc.h,v 1.12 2002/03/19 10:49:35 markus Exp $ */ 21*5087Sjp161948 22*5087Sjp161948 #pragma ident "%Z%%M% %I% %E% SMI" 23*5087Sjp161948 24*5087Sjp161948 #ifdef __cplusplus 25*5087Sjp161948 extern "C" { 26*5087Sjp161948 #endif 27*5087Sjp161948 280Sstevel@tonic-gate char *chop(char *); 290Sstevel@tonic-gate char *strdelim(char **); 300Sstevel@tonic-gate void set_nonblock(int); 310Sstevel@tonic-gate void unset_nonblock(int); 320Sstevel@tonic-gate void set_nodelay(int); 330Sstevel@tonic-gate int a2port(const char *); 340Sstevel@tonic-gate char *cleanhostname(char *); 350Sstevel@tonic-gate char *colon(char *); 360Sstevel@tonic-gate long convtime(const char *); 374907Sjp161948 char *tohex(const void *, size_t); 38*5087Sjp161948 void sanitise_stdfd(void); 394958Sjp161948 int get_yes_no_flag(int *option, const char *arg, const char *filename, 404958Sjp161948 int linenum, int active); 410Sstevel@tonic-gate 420Sstevel@tonic-gate struct passwd *pwcopy(struct passwd *); 430Sstevel@tonic-gate void pwfree(struct passwd **); 440Sstevel@tonic-gate 450Sstevel@tonic-gate typedef struct arglist arglist; 460Sstevel@tonic-gate struct arglist { 470Sstevel@tonic-gate char **list; 480Sstevel@tonic-gate int num; 490Sstevel@tonic-gate int nalloc; 500Sstevel@tonic-gate }; 510Sstevel@tonic-gate void addargs(arglist *, char *, ...) __attribute__((format(printf, 2, 3))); 52*5087Sjp161948 void replacearg(arglist *, u_int, char *, ...) 53*5087Sjp161948 __attribute__((format(printf, 3, 4))); 542780Sjp161948 void freeargs(arglist *); 550Sstevel@tonic-gate 560Sstevel@tonic-gate /* wrapper for signal interface */ 570Sstevel@tonic-gate typedef void (*mysig_t)(int); 580Sstevel@tonic-gate mysig_t mysignal(int sig, mysig_t act); 590Sstevel@tonic-gate 60*5087Sjp161948 /* Functions to extract or store big-endian words of various sizes */ 61*5087Sjp161948 u_int64_t get_u64(const void *) 62*5087Sjp161948 __attribute__((__bounded__( __minbytes__, 1, 8))); 63*5087Sjp161948 u_int32_t get_u32(const void *) 64*5087Sjp161948 __attribute__((__bounded__( __minbytes__, 1, 4))); 65*5087Sjp161948 u_int16_t get_u16(const void *) 66*5087Sjp161948 __attribute__((__bounded__( __minbytes__, 1, 2))); 67*5087Sjp161948 void put_u64(void *, u_int64_t) 68*5087Sjp161948 __attribute__((__bounded__( __minbytes__, 1, 8))); 69*5087Sjp161948 void put_u32(void *, u_int32_t) 70*5087Sjp161948 __attribute__((__bounded__( __minbytes__, 1, 4))); 71*5087Sjp161948 void put_u16(void *, u_int16_t) 72*5087Sjp161948 __attribute__((__bounded__( __minbytes__, 1, 2))); 73*5087Sjp161948 740Sstevel@tonic-gate #ifdef __cplusplus 750Sstevel@tonic-gate } 760Sstevel@tonic-gate #endif 770Sstevel@tonic-gate 780Sstevel@tonic-gate #endif /* _MISC_H */ 79