libkdenetwork Library API Documentation

libgpgme-copy/gpgme/util.h

00001 /* util.h 
00002    Copyright (C) 2000 Werner Koch (dd9jn)
00003    Copyright (C) 2001, 2002, 2003 g10 Code GmbH
00004 
00005    This file is part of GPGME.
00006  
00007    GPGME is free software; you can redistribute it and/or modify it
00008    under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; either version 2 of the License, or
00010    (at your option) any later version.
00011  
00012    GPGME is distributed in the hope that it will be useful, but
00013    WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015    General Public License for more details.
00016  
00017    You should have received a copy of the GNU General Public License
00018    along with GPGME; if not, write to the Free Software Foundation,
00019    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
00020 
00021 #ifndef UTIL_H
00022 #define UTIL_H
00023 
00024 #include "gpgme.h"
00025 
00026 
00027 #define DIM(v) (sizeof(v)/sizeof((v)[0]))
00028 
00029 
00030 /*-- {posix,w32}-util.c --*/
00031 const char *_gpgme_get_gpg_path (void);
00032 const char *_gpgme_get_gpgsm_path (void);
00033 
00034 
00035 /*-- replacement functions in <funcname>.c --*/
00036 #ifdef HAVE_CONFIG_H
00037 #ifndef HAVE_STPCPY
00038 char *stpcpy (char *a, const char *b);
00039 #endif
00040 
00041 #if !HAVE_VASPRINTF
00042 #include <stdarg.h>
00043 int vasprintf (char **result, const char *format, va_list args);
00044 int asprintf (char **result, const char *format, ...);
00045 #endif
00046 #endif
00047 
00048 
00049 /*-- conversion.c --*/
00050 /* Convert two hexadecimal digits from STR to the value they
00051    represent.  Returns -1 if one of the characters is not a
00052    hexadecimal digit.  */
00053 int _gpgme_hextobyte (const char *str);
00054 
00055 /* Decode the C formatted string SRC and store the result in the
00056    buffer *DESTP which is LEN bytes long.  If LEN is zero, then a
00057    large enough buffer is allocated with malloc and *DESTP is set to
00058    the result.  Currently, LEN is only used to specify if allocation
00059    is desired or not, the caller is expected to make sure that *DESTP
00060    is large enough if LEN is not zero.  */
00061 gpgme_error_t _gpgme_decode_c_string (const char *src, char **destp,
00062                       size_t len);
00063 
00064 /* Decode the percent escaped string SRC and store the result in the
00065    buffer *DESTP which is LEN bytes long.  If LEN is zero, then a
00066    large enough buffer is allocated with malloc and *DESTP is set to
00067    the result.  Currently, LEN is only used to specify if allocation
00068    is desired or not, the caller is expected to make sure that *DESTP
00069    is large enough if LEN is not zero.  */
00070 gpgme_error_t _gpgme_decode_percent_string (const char *src, char **destp,
00071                         size_t len);
00072 
00073 
00074 /* Parse the string TIMESTAMP into a time_t.  The string may either be
00075    seconds since Epoch or in the ISO 8601 format like
00076    "20390815T143012".  Returns 0 for an empty string or seconds since
00077    Epoch. Leading spaces are skipped. If ENDP is not NULL, it will
00078    point to the next non-parsed character in TIMESTRING. */
00079 time_t _gpgme_parse_timestamp (const char *timestamp, char **endp);
00080 
00081 
00082 gpgme_error_t _gpgme_map_gnupg_error (char *err);
00083 
00084 
00085 /* Retrieve the environment variable NAME and return a copy of it in a
00086    malloc()'ed buffer in *VALUE.  If the environment variable is not
00087    set, return NULL in *VALUE.  */
00088 gpgme_error_t _gpgme_getenv (const char *name, char **value);
00089 
00090 #endif /* UTIL_H */
KDE Logo
This file is part of the documentation for libkdenetwork Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Oct 17 09:52:22 2007 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003