ipsec_strerror.c (62583) | ipsec_strerror.c (78064) |
---|---|
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 $ */ | 1/* $FreeBSD: head/lib/libipsec/ipsec_strerror.c 78064 2001-06-11 12:39:29Z ume $ */ 2/* $KAME: ipsec_strerror.c,v 1.7 2000/07/30 00:45:12 itojun Exp $ */ |
3 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: --- 24 unchanged lines hidden (view full) --- 35 36#include <string.h> 37#include <netinet6/ipsec.h> 38 39#include "ipsec_strerror.h" 40 41int __ipsec_errcode; 42 | 3 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: --- 24 unchanged lines hidden (view full) --- 35 36#include <string.h> 37#include <netinet6/ipsec.h> 38 39#include "ipsec_strerror.h" 40 41int __ipsec_errcode; 42 |
43static char *ipsec_errlist[] = { | 43static const 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*/ 50"Invalid address specification", /*EIPSEC_INVAL_ADDRESS*/ 51"Invalid ipsec protocol", /*EIPSEC_INVAL_PROTO*/ --- 14 unchanged lines hidden (view full) --- 66"Must get supported algorithms list first", /*EIPSEC_DO_GET_SUPP_LIST*/ 67"Protocol mismatch", /*EIPSEC_PROTO_MISMATCH*/ 68"Family mismatch", /*EIPSEC_FAMILY_MISMATCH*/ 69"Too few arguments", /*EIPSEC_FEW_ARGUMENTS*/ 70NULL, /*EIPSEC_SYSTEM_ERROR*/ 71"Unknown error", /*EIPSEC_MAX*/ 72}; 73 | 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*/ 50"Invalid address specification", /*EIPSEC_INVAL_ADDRESS*/ 51"Invalid ipsec protocol", /*EIPSEC_INVAL_PROTO*/ --- 14 unchanged lines hidden (view full) --- 66"Must get supported algorithms list first", /*EIPSEC_DO_GET_SUPP_LIST*/ 67"Protocol mismatch", /*EIPSEC_PROTO_MISMATCH*/ 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) | 74const char *ipsec_strerror(void) |
75{ 76 if (__ipsec_errcode < 0 || __ipsec_errcode > EIPSEC_MAX) 77 __ipsec_errcode = EIPSEC_MAX; 78 79 return ipsec_errlist[__ipsec_errcode]; 80} 81 | 75{ 76 if (__ipsec_errcode < 0 || __ipsec_errcode > EIPSEC_MAX) 77 __ipsec_errcode = EIPSEC_MAX; 78 79 return ipsec_errlist[__ipsec_errcode]; 80} 81 |
82void __ipsec_set_strerror(char *str) | 82void __ipsec_set_strerror(const char *str) |
83{ 84 __ipsec_errcode = EIPSEC_SYSTEM_ERROR; 85 ipsec_errlist[EIPSEC_SYSTEM_ERROR] = str; 86 87 return; 88} | 83{ 84 __ipsec_errcode = EIPSEC_SYSTEM_ERROR; 85 ipsec_errlist[EIPSEC_SYSTEM_ERROR] = str; 86 87 return; 88} |