1 /* $NetBSD: wrapcommon.h,v 1.3 2014/12/10 04:37:56 christos Exp $ */ 2 3 /* 4 * wrapcommon.h 5 */ 6 7 /* 8 * Copyright (c) 2000,2002 Japan Network Information Center. 9 * All rights reserved. 10 * 11 * By using this file, you agree to the terms and conditions set forth bellow. 12 * 13 * LICENSE TERMS AND CONDITIONS 14 * 15 * The following License Terms and Conditions apply, unless a different 16 * license is obtained from Japan Network Information Center ("JPNIC"), 17 * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda, 18 * Chiyoda-ku, Tokyo 101-0047, Japan. 19 * 20 * 1. Use, Modification and Redistribution (including distribution of any 21 * modified or derived work) in source and/or binary forms is permitted 22 * under this License Terms and Conditions. 23 * 24 * 2. Redistribution of source code must retain the copyright notices as they 25 * appear in each source code file, this License Terms and Conditions. 26 * 27 * 3. Redistribution in binary form must reproduce the Copyright Notice, 28 * this License Terms and Conditions, in the documentation and/or other 29 * materials provided with the distribution. For the purposes of binary 30 * distribution the "Copyright Notice" refers to the following language: 31 * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved." 32 * 33 * 4. The name of JPNIC may not be used to endorse or promote products 34 * derived from this Software without specific prior written approval of 35 * JPNIC. 36 * 37 * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC 38 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 39 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 40 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE 41 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 42 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 43 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 44 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 45 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 46 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 47 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 48 */ 49 50 #ifndef _WRAPCOMMON_H 51 #define _WRAPCOMMON_H 52 53 #include <idn/res.h> 54 #include <idn/log.h> 55 #include <idn/version.h> 56 57 #define WRAPPER_EXPORT extern __declspec(dllexport) 58 59 extern void idnPrintf(char *fmt, ...); 60 extern void idnLogPrintf(int level, char *fmt, ...); 61 extern void idnLogInit(const char *title); 62 extern void idnLogReset(void); 63 extern void idnLogFinish(void); 64 65 extern char *dumpAddr(const char FAR *addr, int len, char *buff, size_t size); 66 extern char *dumpHost(const struct hostent FAR *hp, char *buff, size_t size); 67 extern char *dumpName(const char *name, char *buff, size_t size); 68 69 extern int idnEncodeWhere(void); 70 71 #define IDN_ENCODE_ALWAYS 0 72 #define IDN_ENCODE_CHECK 1 73 #define IDN_ENCODE_ONLY11 2 74 #define IDN_ENCODE_ONLY20 3 75 76 extern BOOL idnGetPrgEncoding(char *enc, size_t len); 77 extern BOOL idnGetLogFile(char *file, size_t len); 78 79 extern int idnGetLogLevel(void); /* 0 : fatal */ 80 /* 1 : error */ 81 /* 2 : warning */ 82 /* 3 : info */ 83 /* 4 : trace */ 84 /* 5 : dump */ 85 extern int idnGetInstallDir(char *dir, size_t len); 86 87 extern idn_resconf_t idnConvInit(void); 88 extern void idnConvDone(idn_resconf_t ctx); 89 90 extern BOOL idnWinsockVersion(const char *version); 91 extern HINSTANCE idnWinsockHandle(void); 92 extern idn_resconf_t idnGetContext(void); 93 94 /* 95 * Converting Request/Response 96 */ 97 98 extern BOOL idnConvReq(idn_resconf_t ctx, const char FAR *from, 99 char FAR *to, size_t tolen); 100 extern BOOL idnConvRsp(idn_resconf_t ctx, const char FAR *from, 101 char FAR *to, size_t tolen); 102 103 /* 104 * Hook for Asynchronouse Query 105 */ 106 107 extern void idnHookInit(void); 108 extern void idnHookDone(void); 109 extern BOOL idnHook(HWND hWnd, u_int wMsg, char FAR *buf, idn_resconf_t ctx); 110 111 #endif /* _WRAPCOMMON_H */ 112