1
2MUNGE_ENUM(3) MUNGE Uid 'N' Gid Emporium MUNGE_ENUM(3)
3
4
5
7 munge_enum_is_valid, munge_enum_int_to_str, munge_enum_str_to_int -
8 MUNGE enumeration functions
9
10
12 #include <munge.h>
13
14 int munge_enum_is_valid (munge_enum_t type, int val);
15
16 const char * munge_enum_int_to_str (munge_enum_t type, int val);
17
18 int munge_enum_str_to_int (munge_enum_t type, const char *str);
19
20 cc `pkg-config --cflags --libs munge` -o foo foo.c
21
22
24 The munge_enum_is_valid() function checks if the given value val is a
25 valid MUNGE enumeration of the specified type type in the software con‐
26 figuration as currently compiled. Some enumerations correspond to op‐
27 tions that can only be enabled at compile-time.
28
29 The munge_enum_int_to_str() function converts the MUNGE enumeration val
30 of the specified type type into a text string.
31
32 The munge_enum_str_to_int() function converts the NUL-terminated case-
33 insensitive string str into the corresponding MUNGE enumeration of the
34 specified type type.
35
36
38 The munge_enum_is_valid() function returns non-zero if the given value
39 val is a valid enumeration.
40
41 The munge_enum_int_to_str() function returns a NUL-terminated constant
42 text string, or NULL on error; this string should not be freed or modi‐
43 fied by the caller.
44
45 The munge_enum_str_to_int() function returns a MUNGE enumeration on
46 success (i.e., >= 0), or -1 on error.
47
48
50 The following enumeration types can be specified.
51
52 MUNGE_ENUM_CIPHER
53 Specify enumerations for the available cipher types.
54
55 MUNGE_ENUM_MAC
56 Specify enumerations for the available MAC types.
57
58 MUNGE_ENUM_ZIP
59 Specify enumerations for the available compression types.
60
61
63 Refer to munge(3) for a complete list of errors.
64
65
67 The following example program illustrates how a list of available ci‐
68 pher types can be queried.
69
70 #include <stdio.h> /* for printf() */
71 #include <stdlib.h> /* for exit() */
72 #include <munge.h>
73
74 int
75 main (int argc, char *argv[])
76 {
77 int i;
78 const char *p;
79 munge_enum_t t = MUNGE_ENUM_CIPHER;
80
81 for (i = 0; (p = munge_enum_int_to_str (t, i)) != NULL; i++) {
82 if (munge_enum_is_valid (t, i)) {
83 printf ("%2d = %s\n", i, p);
84 }
85 }
86 exit (0);
87 }
88
89
91 Chris Dunlap <cdunlap@llnl.gov>
92
93
95 Copyright (C) 2007-2022 Lawrence Livermore National Security, LLC.
96 Copyright (C) 2002-2007 The Regents of the University of California.
97
98 MUNGE is free software: you can redistribute it and/or modify it under
99 the terms of the GNU General Public License as published by the Free
100 Software Foundation, either version 3 of the License, or (at your op‐
101 tion) any later version.
102
103 Additionally for the MUNGE library (libmunge), you can redistribute it
104 and/or modify it under the terms of the GNU Lesser General Public Li‐
105 cense as published by the Free Software Foundation, either version 3 of
106 the License, or (at your option) any later version.
107
108
110 munge(1), remunge(1), unmunge(1), munge(3), munge_ctx(3), munge(7),
111 munged(8), mungekey(8).
112
113 https://dun.github.io/munge/
114
115
116
117munge-0.5.15 2022-06-22 MUNGE_ENUM(3)