Merge pull request #114 from BarbarossaTM/feature/compatiblity-layer
Introduce compatibility layer framework
This commit is contained in:
commit
80a590ca33
5 changed files with 59 additions and 1 deletions
3
Makefile
3
Makefile
|
@ -38,7 +38,8 @@ LIBIFUPDOWN_SRC = \
|
|||
libifupdown/execute.c \
|
||||
libifupdown/lifecycle.c \
|
||||
libifupdown/config-parser.c \
|
||||
libifupdown/config-file.c
|
||||
libifupdown/config-file.c \
|
||||
libifupdown/compat.c \
|
||||
|
||||
LIBIFUPDOWN_OBJ = ${LIBIFUPDOWN_SRC:.c=.o}
|
||||
LIBIFUPDOWN_LIB = libifupdown.a
|
||||
|
|
|
@ -261,6 +261,12 @@ ifupdown_main(int argc, char *argv[])
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if(!lif_compat_apply(&collection))
|
||||
{
|
||||
fprintf(stderr, "%s: failed to apply compatibility glue\n", argv0);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (!lif_state_sync(&state, &collection))
|
||||
{
|
||||
fprintf(stderr, "%s: could not sync state\n", argv0);
|
||||
|
|
27
libifupdown/compat.c
Normal file
27
libifupdown/compat.c
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* libifupdown/compat.c
|
||||
* Purpose: compatiblity glue to other implementations
|
||||
*
|
||||
* Copyright (c) 2020 Maximilian Wilhelm <max@sdn.clinic>
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* This software is provided 'as is' and without any warranty, express or
|
||||
* implied. In no event shall the authors be liable for any damages arising
|
||||
* from the use of this software.
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "libifupdown/dict.h"
|
||||
|
||||
extern bool
|
||||
lif_compat_apply(struct lif_dict *collection)
|
||||
{
|
||||
(void) collection;
|
||||
|
||||
/* Mangle interfaces according to some config options here */
|
||||
|
||||
return true;
|
||||
}
|
23
libifupdown/compat.h
Normal file
23
libifupdown/compat.h
Normal file
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* libifupdown/compat.h
|
||||
* Purpose: compatiblity glue to other implementations
|
||||
*
|
||||
* Copyright (c) 2020 Maximilian Wilhelm <max@sdn.clinic>
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* This software is provided 'as is' and without any warranty, express or
|
||||
* implied. In no event shall the authors be liable for any damages arising
|
||||
* from the use of this software.
|
||||
*/
|
||||
|
||||
#ifndef LIBIFUPDOWN__COMPAT_H
|
||||
#define LIBIFUPDOWN__COMPAT_H
|
||||
|
||||
#include "libifupdown/config-file.h"
|
||||
|
||||
extern bool lif_compat_apply (struct lif_dict *collection);
|
||||
|
||||
#endif
|
|
@ -29,6 +29,7 @@
|
|||
#include "libifupdown/tokenize.h"
|
||||
#include "libifupdown/config-file.h"
|
||||
#include "libifupdown/config-parser.h"
|
||||
#include "libifupdown/compat.h"
|
||||
|
||||
#ifndef ARRAY_SIZE
|
||||
# define ARRAY_SIZE(x) (sizeof(x) / sizeof(*x))
|
||||
|
|
Loading…
Reference in a new issue