---
name: "munge_enum"
section: "3"
platform: "linux"
package: "munge"
version: "0.5.18-2"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/munge_enum"
---

# munge\_enum(3)

MUNGE enumeration functions

## NAME

munge\_enum\_is\_valid, munge\_enum\_int\_to\_str, munge\_enum\_str\_to\_int - 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 null-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 null-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)](/munge/3.md) 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>
#include <stdlib.h>
#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 (EXIT_SUCCESS);
}
```

## AUTHOR

Chris Dunlap \<cdunlap@llnl.gov\>

## COPYRIGHT

Copyright (C) 2007-2025 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)](/munge/1.md), [**remunge**(1)](/remunge/1.md), [**unmunge**(1)](/unmunge/1.md), [**munge**(3)](/munge/3.md), [**munge\_ctx**(3)](/munge_ctx/3.md), [**munge**(7)](/munge/7.md), [**munged**(8)](/munged/8.md), [**mungekey**(8)](/mungekey/8.md).

**https://github.com/dun/munge**
