encoder: further simplifications

Get rid of unique header files for each encoder, consolidate them to
where they are actually needed: encoding.h.

This also simplifies the generation of the base64u decoder, as its
header file does not need to be generated any longer.

Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
This commit is contained in:
Ralf Ramsauer 2017-03-11 15:11:17 -08:00
parent b517121f1c
commit 6b438e7517
10 changed files with 18 additions and 89 deletions

View File

@ -32,15 +32,11 @@ $(SERVER): $(COMMONOBJS) $(SERVEROBJS)
@echo CC $< @echo CC $<
@$(CC) $(CFLAGS) $< -o $@ @$(CC) $(CFLAGS) $< -o $@
base64u.o client.o iodined.o: base64u.h base64u.o client.o iodined.o:
base64u.c: base64.c base64u.c: base64.c
@echo Making $@ @echo Making $@
@echo '/* No use in editing, produced by Makefile! */' > $@ @echo '/* No use in editing, produced by Makefile! */' > $@
@sed -e 's/\([Bb][Aa][Ss][Ee]64\)/\1u/g ; s/0123456789+/0123456789_/' < base64.c >> $@ @sed -e 's/\([Bb][Aa][Ss][Ee]64\)/\1u/g ; s/0123456789+/0123456789_/' < base64.c >> $@
base64u.h: base64.h
@echo Making $@
@echo '/* No use in editing, produced by Makefile! */' > $@
@sed -e 's/\([Bb][Aa][Ss][Ee]64\)/\1u/g ; s/0123456789+/0123456789_/' < base64.h >> $@
clean: clean:
@echo "Cleaning src/" @echo "Cleaning src/"

View File

@ -33,7 +33,6 @@
#include <string.h> #include <string.h>
#include "encoding.h" #include "encoding.h"
#include "base128.h"
#define BLKSIZE_RAW 7 #define BLKSIZE_RAW 7
#define BLKSIZE_ENC 8 #define BLKSIZE_ENC 8

View File

@ -1,22 +0,0 @@
/*
* Copyright (C) 2009 J.A.Bezemer@opensourcepartners.nl
*
* 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.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef __BASE128_H__
#define __BASE128_H__
const struct encoder base128_ops;
#endif

View File

@ -21,7 +21,6 @@
#include <string.h> #include <string.h>
#include "encoding.h" #include "encoding.h"
#include "base32.h"
#define BLKSIZE_RAW 5 #define BLKSIZE_RAW 5
#define BLKSIZE_ENC 8 #define BLKSIZE_ENC 8

View File

@ -1,25 +0,0 @@
/*
* Copyright (c) 2006-2014 Erik Ekman <yarrick@kryo.se>,
* 2006-2009 Bjorn Andersson <flex@kryo.se>
*
* 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.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef __BASE32_H__
#define __BASE32_H__
int b32_5to8(int);
int b32_8to5(int);
extern const struct encoder base32_ops;
#endif

View File

@ -21,7 +21,6 @@
#include <string.h> #include <string.h>
#include "encoding.h" #include "encoding.h"
#include "base64.h"
#define BLKSIZE_RAW 3 #define BLKSIZE_RAW 3
#define BLKSIZE_ENC 4 #define BLKSIZE_ENC 4

View File

@ -1,23 +0,0 @@
/*
* Copyright (c) 2006-2014 Erik Ekman <yarrick@kryo.se>,
* 2006-2009 Bjorn Andersson <flex@kryo.se>
*
* 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.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef __BASE64_H__
#define __BASE64_H__
extern const struct encoder base64_ops;
#endif

View File

@ -47,10 +47,6 @@
#include "common.h" #include "common.h"
#include "encoding.h" #include "encoding.h"
#include "base32.h"
#include "base64.h"
#include "base64u.h"
#include "base128.h"
#include "dns.h" #include "dns.h"
#include "login.h" #include "login.h"
#include "tun.h" #include "tun.h"

View File

@ -1,6 +1,12 @@
/* /*
* Copyright (c) 2006-2014 Erik Ekman <yarrick@kryo.se>, * Copyright (c) 2006-2014 Erik Ekman
* 2006-2009 Bjorn Andersson <flex@kryo.se> * 2006-2009 Bjorn Andersson
* Copyright (c) 2017 Ralf Ramsauer
*
* Authors:
* Bjorn Andersson <flex@kryo.se>
* Erok Ekman <yarrick@kryo.se>,
* Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -40,4 +46,12 @@ int unpack_data(char *, size_t, char *, size_t, const struct encoder *);
int inline_dotify(char *, size_t); int inline_dotify(char *, size_t);
int inline_undotify(char *, size_t); int inline_undotify(char *, size_t);
#endif /* _ENCODING_H_ */ extern const struct encoder base32_ops;
extern const struct encoder base64_ops;
extern const struct encoder base64u_ops;
extern const struct encoder base128_ops;
int b32_5to8(int);
int b32_8to5(int);
#endif

View File

@ -51,10 +51,6 @@
#include "dns.h" #include "dns.h"
#include "encoding.h" #include "encoding.h"
#include "base32.h"
#include "base64.h"
#include "base64u.h"
#include "base128.h"
#include "user.h" #include "user.h"
#include "login.h" #include "login.h"
#include "tun.h" #include "tun.h"