munge_enum - Man Page
MUNGE enumeration functions
Synopsis
#include <munge.h> int munge_enum_is_valid (munge_enum_t type, int val); const char * munge_enum_int_to_str (munge_enum_t type, int val); int munge_enum_str_to_int (munge_enum_t type, const char *str); cc `pkg-config --cflags --libs munge` -o foo foo.c
Description
The munge_enum_is_valid() function checks if the given value val is a valid MUNGE enumeration of the specified type type in the software configuration as currently compiled. Some enumerations correspond to options that can only be enabled at compile-time.
The munge_enum_int_to_str() function converts the MUNGE enumeration val of the specified type type into a text string.
The munge_enum_str_to_int() function converts the NUL-terminated case-insensitive string str into the corresponding MUNGE enumeration of the specified type type.
Return Value
The munge_enum_is_valid() function returns non-zero if the given value val is a valid enumeration.
The munge_enum_int_to_str() function returns a NUL-terminated constant text string, or NULL on error; this string should not be freed or modified by the caller.
The munge_enum_str_to_int() function returns a MUNGE enumeration on success (i.e., >= 0), or -1 on error.
Enum Types
The following enumeration types can be specified.
- MUNGE_ENUM_CIPHER
Specify enumerations for the available cipher types.
- MUNGE_ENUM_MAC
Specify enumerations for the available MAC types.
- MUNGE_ENUM_ZIP
Specify enumerations for the available compression types.
Errors
Refer to munge(3) for a complete list of errors.
Example
The following example program illustrates how a list of available cipher types can be queried.
#include <stdio.h> /* for printf() */ #include <stdlib.h> /* for exit() */ #include <munge.h> int main (int argc, char *argv[]) { int i; const char *p; munge_enum_t t = MUNGE_ENUM_CIPHER; for (i = 0; (p = munge_enum_int_to_str (t, i)) != NULL; i++) { if (munge_enum_is_valid (t, i)) { printf ("%2d = %s\n", i, p); } } exit (0); }
Author
Chris Dunlap <cdunlap@llnl.gov>
Copyright
Copyright (C) 2007-2024 Lawrence Livermore National Security, LLC.
Copyright (C) 2002-2007 The Regents of the University of California.
MUNGE is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Additionally for the MUNGE library (libmunge), you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
See Also
munge(1), remunge(1), unmunge(1), munge(3), munge_ctx(3), munge(7), munged(8), mungekey(8).
Referenced By
munge(1), munge(3), munge(7), munge_ctx(3), munged(8), mungekey(8), remunge(1), unmunge(1).
The man pages munge_enum_int_to_str(3), munge_enum_is_valid(3) and munge_enum_str_to_int(3) are aliases of munge_enum(3).