From fe862efa31302881e12f7e60085ff88b96501d9a Mon Sep 17 00:00:00 2001 From: "David M. Syzdek" Date: Thu, 24 Mar 2022 17:06:00 -0800 Subject: tinyrad: splitting widgets into separate files --- src/tru/tinyrad.c | 30 --------------------- src/tru/tru.h | 5 ++++ src/tru/widget-config.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++ src/tru/widget-dict.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++ src/tru/widget-url.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 211 insertions(+), 30 deletions(-) create mode 100644 src/tru/widget-config.c create mode 100644 src/tru/widget-dict.c create mode 100644 src/tru/widget-url.c (limited to 'src') diff --git a/src/tru/tinyrad.c b/src/tru/tinyrad.c index 79bd639..155f09a 100644 --- a/src/tru/tinyrad.c +++ b/src/tru/tinyrad.c @@ -292,36 +292,6 @@ tru_cleanup( } -int -tru_widget_config( - TinyRadUtilConf * cnf ) -{ - int rc; - TinyRadDict * dict; - if ((rc = tru_load_tinyrad(cnf)) != TRAD_SUCCESS) - return(rc); - tinyrad_get_option(cnf->tr, TRAD_OPT_DICTIONARY, &dict); - tinyrad_conf_print(cnf->tr, dict); - tinyrad_free(dict); - return(TRAD_SUCCESS); -} - - -int -tru_widget_dict( - TinyRadUtilConf * cnf ) -{ - int rc; - TinyRadDict * dict; - if ((rc = tru_load_tinyrad(cnf)) != TRAD_SUCCESS) - return(rc); - tinyrad_get_option(cnf->tr, TRAD_OPT_DICTIONARY, &dict); - tinyrad_dict_print(dict, 0xffff); - tinyrad_free(dict); - return(TRAD_SUCCESS); -} - - int tru_getopt( TinyRadUtilConf * cnf, diff --git a/src/tru/tru.h b/src/tru/tru.h index 75c26c3..d0c54ab 100644 --- a/src/tru/tru.h +++ b/src/tru/tru.h @@ -186,6 +186,11 @@ tru_widget_dict( TinyRadUtilConf * cnf ); +int +tru_widget_url( + TinyRadUtilConf * cnf ); + + int tru_getopt( TinyRadUtilConf * cnf, diff --git a/src/tru/widget-config.c b/src/tru/widget-config.c new file mode 100644 index 0000000..c090c86 --- /dev/null +++ b/src/tru/widget-config.c @@ -0,0 +1,70 @@ +/* + * Tiny RADIUS Client Library + * Copyright (C) 2022 David M. Syzdek . + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of David M. Syzdek nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID M. SYZDEK BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +#define _SRC_TRU_WIDGET_CONFIG_C 1 + +/////////////// +// // +// Headers // +// // +/////////////// +#pragma mark - Headers + +#include "tru.h" + +#include + +#include +#include + + +///////////////// +// // +// Functions // +// // +///////////////// +#pragma mark - Functions + +int +tru_widget_config( + TinyRadUtilConf * cnf ) +{ + int rc; + TinyRadDict * dict; + if ((rc = tru_load_tinyrad(cnf)) != TRAD_SUCCESS) + return(rc); + tinyrad_get_option(cnf->tr, TRAD_OPT_DICTIONARY, &dict); + tinyrad_conf_print(cnf->tr, dict); + tinyrad_free(dict); + return(TRAD_SUCCESS); +} + + +/* end of source */ diff --git a/src/tru/widget-dict.c b/src/tru/widget-dict.c new file mode 100644 index 0000000..1faff32 --- /dev/null +++ b/src/tru/widget-dict.c @@ -0,0 +1,70 @@ +/* + * Tiny RADIUS Client Library + * Copyright (C) 2022 David M. Syzdek . + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of David M. Syzdek nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID M. SYZDEK BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +#define _SRC_TRU_WIDGET_DICT_C 1 + +/////////////// +// // +// Headers // +// // +/////////////// +#pragma mark - Headers + +#include "tru.h" + +#include + +#include +#include + + +///////////////// +// // +// Functions // +// // +///////////////// +#pragma mark - Functions + +int +tru_widget_dict( + TinyRadUtilConf * cnf ) +{ + int rc; + TinyRadDict * dict; + if ((rc = tru_load_tinyrad(cnf)) != TRAD_SUCCESS) + return(rc); + tinyrad_get_option(cnf->tr, TRAD_OPT_DICTIONARY, &dict); + tinyrad_dict_print(dict, 0xffff); + tinyrad_free(dict); + return(TRAD_SUCCESS); +} + + +/* end of source */ diff --git a/src/tru/widget-url.c b/src/tru/widget-url.c new file mode 100644 index 0000000..2e2cd85 --- /dev/null +++ b/src/tru/widget-url.c @@ -0,0 +1,66 @@ +/* + * Tiny RADIUS Client Library + * Copyright (C) 2022 David M. Syzdek . + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of David M. Syzdek nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID M. SYZDEK BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +#define _SRC_TRU_WIDGET_URL_C 1 + +/////////////// +// // +// Headers // +// // +/////////////// +#pragma mark - Headers + +#include "tru.h" + +#include + +#include +#include + + +///////////////// +// // +// Functions // +// // +///////////////// +#pragma mark - Functions + +int +tru_widget_url( + TinyRadUtilConf * cnf ) +{ + int rc; + if ((rc = tru_load_tinyrad(cnf)) != TRAD_SUCCESS) + return(rc); + return(TRAD_SUCCESS); +} + + +/* end of source */ -- cgit v1.2.3