ipsec_strerror.c (55505) | ipsec_strerror.c (62583) |
---|---|
1/* $FreeBSD: head/lib/libipsec/ipsec_strerror.c 62583 2000-07-04 16:22:05Z itojun $ */ 2/* $KAME: ipsec_strerror.c,v 1.6 2000/05/07 05:25:03 itojun Exp $ */ 3 |
|
1/* 2 * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. | 4/* 5 * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project. 6 * 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 --- 11 unchanged lines hidden (view full) --- 23 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE 24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. |
28 * 29 * $FreeBSD: head/lib/libipsec/ipsec_strerror.c 55505 2000-01-06 12:40:54Z shin $ | |
30 */ 31 32#include <sys/types.h> 33#include <sys/param.h> 34 35#include <string.h> 36#include <netinet6/ipsec.h> 37 38#include "ipsec_strerror.h" 39 | 31 */ 32 33#include <sys/types.h> 34#include <sys/param.h> 35 36#include <string.h> 37#include <netinet6/ipsec.h> 38 39#include "ipsec_strerror.h" 40 |
40int ipsec_errcode; | 41int __ipsec_errcode; |
41 42static char *ipsec_errlist[] = { 43"Success", /*EIPSEC_NO_ERROR*/ 44"Not supported", /*EIPSEC_NOT_SUPPORTED*/ 45"Invalid argument", /*EIPSEC_INVAL_ARGUMENT*/ 46"Invalid sadb message", /*EIPSEC_INVAL_SADBMSG*/ 47"Invalid version", /*EIPSEC_INVAL_VERSION*/ 48"Invalid security policy", /*EIPSEC_INVAL_POLICY*/ --- 18 unchanged lines hidden (view full) --- 67"Family mismatch", /*EIPSEC_FAMILY_MISMATCH*/ 68"Too few arguments", /*EIPSEC_FEW_ARGUMENTS*/ 69NULL, /*EIPSEC_SYSTEM_ERROR*/ 70"Unknown error", /*EIPSEC_MAX*/ 71}; 72 73char *ipsec_strerror(void) 74{ | 42 43static char *ipsec_errlist[] = { 44"Success", /*EIPSEC_NO_ERROR*/ 45"Not supported", /*EIPSEC_NOT_SUPPORTED*/ 46"Invalid argument", /*EIPSEC_INVAL_ARGUMENT*/ 47"Invalid sadb message", /*EIPSEC_INVAL_SADBMSG*/ 48"Invalid version", /*EIPSEC_INVAL_VERSION*/ 49"Invalid security policy", /*EIPSEC_INVAL_POLICY*/ --- 18 unchanged lines hidden (view full) --- 68"Family mismatch", /*EIPSEC_FAMILY_MISMATCH*/ 69"Too few arguments", /*EIPSEC_FEW_ARGUMENTS*/ 70NULL, /*EIPSEC_SYSTEM_ERROR*/ 71"Unknown error", /*EIPSEC_MAX*/ 72}; 73 74char *ipsec_strerror(void) 75{ |
75 if (ipsec_errcode < 0 || ipsec_errcode > EIPSEC_MAX) 76 ipsec_errcode = EIPSEC_MAX; | 76 if (__ipsec_errcode < 0 || __ipsec_errcode > EIPSEC_MAX) 77 __ipsec_errcode = EIPSEC_MAX; |
77 | 78 |
78 return ipsec_errlist[ipsec_errcode]; | 79 return ipsec_errlist[__ipsec_errcode]; |
79} 80 | 80} 81 |
81void ipsec_set_strerror(char *str) | 82void __ipsec_set_strerror(char *str) |
82{ | 83{ |
83 ipsec_errcode = EIPSEC_SYSTEM_ERROR; | 84 __ipsec_errcode = EIPSEC_SYSTEM_ERROR; |
84 ipsec_errlist[EIPSEC_SYSTEM_ERROR] = str; 85 86 return; 87} | 85 ipsec_errlist[EIPSEC_SYSTEM_ERROR] = str; 86 87 return; 88} |