libenigma
Enigma machine utility library
Loading...
Searching...
No Matches
reflector.h File Reference
#include "common.h"

Go to the source code of this file.

Data Structures

struct  EnigmaReflector
 Represents a reflector configuration for the Enigma machine. More...
 

Macros

#define ENIGMA_REFLECTOR_COUNT   3
 Total number of available reflectors.
 

Functions

int enigma_reflector_generate_indices (EnigmaReflector *, const char *)
 Generate the indices for the reflector.
 
const char * enigma_reflector_get_name (const EnigmaReflector *)
 Get the name of the reflector.
 
const int * enigma_reflector_get_indices (const EnigmaReflector *)
 Get the indices of the reflector.
 
int enigma_reflector_set_name (EnigmaReflector *, const char *)
 Set the name of the reflector.
 
int enigma_reflector_set_indices (EnigmaReflector *, const int *)
 Set the indices of the reflector.
 

Detailed Description

This file defines the standard reflectors used in the Enigma machine.

Macro Definition Documentation

◆ ENIGMA_REFLECTOR_COUNT

#define ENIGMA_REFLECTOR_COUNT   3

Total number of available reflectors.

Function Documentation

◆ enigma_reflector_generate_indices()

int enigma_reflector_generate_indices ( EnigmaReflector reflector,
const char *  alphabet 
)

Generate the indices for the reflector.

Parameters
reflectorThe reflector to generate the indices for.
alphabetThe alphabet to generate the indices from.
Returns
ENIGMA_SUCCESS on success, ENIGMA_FAILURE on failure.

◆ enigma_reflector_get_indices()

const int * enigma_reflector_get_indices ( const EnigmaReflector reflector)

Get the indices of the reflector.

Parameters
reflectorThe reflector to get the indices of.
Returns
The indices of the reflector.

◆ enigma_reflector_get_name()

const char * enigma_reflector_get_name ( const EnigmaReflector reflector)

Get the name of the reflector.

Parameters
reflectorThe reflector to get the name of.
Returns
The name of the reflector.

◆ enigma_reflector_set_indices()

int enigma_reflector_set_indices ( EnigmaReflector reflector,
const int *  indices 
)

Set the indices of the reflector.

Parameters
reflectorThe reflector to set the indices of.
indicesThe indices to set.
Returns
ENIGMA_SUCCESS on success, ENIGMA_FAILURE on failure.

◆ enigma_reflector_set_name()

int enigma_reflector_set_name ( EnigmaReflector reflector,
const char *  name 
)

Set the name of the reflector.

This function sets the name of the reflector (uses strdup, make sure to free this memory when done).

Parameters
reflectorThe reflector to set the name of.
nameThe name to set.
Returns
ENIGMA_SUCCESS on success, ENIGMA_FAILURE on failure.