Skip to content

Commit

Permalink
feat: add console config abstraction
Browse files Browse the repository at this point in the history
  • Loading branch information
R. Nicolás Savinelli committed Apr 17, 2022
1 parent 189a881 commit df064f7
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
8 changes: 8 additions & 0 deletions lib/inc/common/cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ char *puerto(void);
*/
char *ip(void);

// -----------------------------------------------------------
// Console
// ------------------------------------------------------------

char *puerto_kernel(void);

char *ip_kernel(void);

// -----------------------------------------------------------
// Kernel
// ------------------------------------------------------------
Expand Down
9 changes: 8 additions & 1 deletion lib/inc/lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,18 @@
// No error
#define SUCCESS 1

// FLEX + BISON
#define YYACCEPT 0
#define YYABORT 1
#define YYNOMEM 2

enum
{
LOG_INITIALIZATION_ERROR = -255,
CONFIGURATION_INITIALIZATION_ERROR,
SERVER_RUNTIME_ERROR
SERVER_RUNTIME_ERROR,
NO_INPUT_FILE_NAME_ERROR,
NO_PROCESS_SIZE_ERROR,
};

// Not Equals
Expand Down
18 changes: 18 additions & 0 deletions lib/src/common/cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,24 @@ inline char *ip(void)
return config_string(IP_KEY);
}

// -----------------------------------------------------------
// Console
// ------------------------------------------------------------

#define PUERTO_KERNEL_KEY "PUERTO_KERNEL"

inline char *puerto_kernel(void)
{
return config_string(PUERTO_KERNEL_KEY);
}

#define IP_KERNEL_KEY "IP_KERNEL"

inline char *ip_kernel(void)
{
return config_string(IP_KERNEL_KEY);
}

// -----------------------------------------------------------
// Kernel
// ------------------------------------------------------------
Expand Down

0 comments on commit df064f7

Please sign in to comment.