.\"**************************************************************************** .\" Written by Chris Dunlap . .\" Copyright (C) 2007-2022 Lawrence Livermore National Security, LLC. .\" Copyright (C) 2002-2007 The Regents of the University of California. .\" UCRL-CODE-155910. .\" .\" This file is part of the MUNGE Uid 'N' Gid Emporium (MUNGE). .\" For details, see . .\" .\" 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. .\" .\" MUNGE is distributed in the hope that it will be useful, but WITHOUT .\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or .\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License .\" and GNU Lesser General Public License for more details. .\" .\" You should have received a copy of the GNU General Public License .\" and GNU Lesser General Public License along with MUNGE. If not, see .\" . .\"**************************************************************************** .TH MUNGE_ENUM 3 "2022-06-22" "munge-0.5.15" "MUNGE Uid 'N' Gid Emporium" .SH NAME munge_enum_is_valid, munge_enum_int_to_str, munge_enum_str_to_int \- MUNGE enumeration functions .SH SYNOPSIS .nf .B #include .sp .BI "int munge_enum_is_valid (munge_enum_t " type ", int " val ); .sp .BI "const char * munge_enum_int_to_str (munge_enum_t " type ", int " val ); .sp .BI "int munge_enum_str_to_int (munge_enum_t " type ", const char *" str ); .sp .B cc `pkg\-config \-\-cflags \-\-libs munge` \-o foo foo.c .fi .SH DESCRIPTION The \fBmunge_enum_is_valid\fR() function checks if the given value \fIval\fR is a valid MUNGE enumeration of the specified type \fItype\fR in the software configuration as currently compiled. Some enumerations correspond to options that can only be enabled at compile-time. .PP The \fBmunge_enum_int_to_str\fR() function converts the MUNGE enumeration \fIval\fR of the specified type \fItype\fR into a text string. .PP The \fBmunge_enum_str_to_int\fR() function converts the NUL-terminated case-insensitive string \fIstr\fR into the corresponding MUNGE enumeration of the specified type \fItype\fR. .SH RETURN VALUE The \fBmunge_enum_is_valid\fR() function returns non-zero if the given value \fIval\fR is a valid enumeration. .PP The \fBmunge_enum_int_to_str\fR() function returns a NUL-terminated constant text string, or NULL on error; this string should not be freed or modified by the caller. .PP The \fBmunge_enum_str_to_int\fR() function returns a MUNGE enumeration on success (i.e., >= 0), or \-1 on error. .SH "ENUM TYPES" The following enumeration types can be specified. .TP .B MUNGE_ENUM_CIPHER Specify enumerations for the available cipher types. .TP .B MUNGE_ENUM_MAC Specify enumerations for the available MAC types. .TP .B MUNGE_ENUM_ZIP Specify enumerations for the available compression types. .SH ERRORS Refer to \fBmunge\fR(3) for a complete list of errors. .SH EXAMPLE The following example program illustrates how a list of available cipher types can be queried. .PP .nf #include /* for printf() */ #include /* for exit() */ #include .sp int main (int argc, char *argv[]) { int i; const char *p; munge_enum_t t = MUNGE_ENUM_CIPHER; .sp 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); } .fi .SH AUTHOR Chris Dunlap .SH COPYRIGHT Copyright (C) 2007-2022 Lawrence Livermore National Security, LLC. .br Copyright (C) 2002-2007 The Regents of the University of California. .PP 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. .PP 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. .SH "SEE ALSO" .BR munge (1), .BR remunge (1), .BR unmunge (1), .BR munge (3), .BR munge_ctx (3), .BR munge (7), .BR munged (8), .BR mungekey (8). .PP \fBhttps://dun.github.io/munge/\fR