diff options
| author | David M. Syzdek <david@syzdek.net> | 2022-03-24 17:06:00 -0800 |
|---|---|---|
| committer | David M. Syzdek <david@syzdek.net> | 2022-03-24 17:06:00 -0800 |
| commit | fe862efa31302881e12f7e60085ff88b96501d9a (patch) | |
| tree | 2fb5592785ed039840210f4629142f62eb433216 | |
| parent | b37dae2137d5000fb919ecba5840096bf407412e (diff) | |
| download | tinyrad-fe862efa31302881e12f7e60085ff88b96501d9a.tar.gz tinyrad-fe862efa31302881e12f7e60085ff88b96501d9a.tar.bz2 tinyrad-fe862efa31302881e12f7e60085ff88b96501d9a.tar.xz tinyrad-fe862efa31302881e12f7e60085ff88b96501d9a.zip | |
tinyrad: splitting widgets into separate files
| -rw-r--r-- | Makefile.am | 5 | ||||
| -rw-r--r-- | src/tru/tinyrad.c | 30 | ||||
| -rw-r--r-- | src/tru/tru.h | 5 | ||||
| -rw-r--r-- | src/tru/widget-config.c | 70 | ||||
| -rw-r--r-- | src/tru/widget-dict.c | 70 | ||||
| -rw-r--r-- | src/tru/widget-url.c | 66 |
6 files changed, 215 insertions, 31 deletions
diff --git a/Makefile.am b/Makefile.am index f710586..40dceb4 100644 --- a/Makefile.am +++ b/Makefile.am | |||
| @@ -305,8 +305,11 @@ lib_libutils_a_SOURCES = $(noinst_HEADERS) $(include_HEADERS) \ | |||
| 305 | src_tinyrad_DEPENDENCIES = $(lib_LTLIBRARIES) $(noinst_LIBRARIES) | 305 | src_tinyrad_DEPENDENCIES = $(lib_LTLIBRARIES) $(noinst_LIBRARIES) |
| 306 | src_tinyrad_LDADD = $(lib_LTLIBRARIES) $(noinst_LIBRARIES) | 306 | src_tinyrad_LDADD = $(lib_LTLIBRARIES) $(noinst_LIBRARIES) |
| 307 | src_tinyrad_SOURCES = $(noinst_HEADERS) $(include_HEADERS) \ | 307 | src_tinyrad_SOURCES = $(noinst_HEADERS) $(include_HEADERS) \ |
| 308 | src/tru/tru.h \ | ||
| 308 | src/tru/tinyrad.c \ | 309 | src/tru/tinyrad.c \ |
| 309 | src/tru/tru.h | 310 | src/tru/widget-config.c \ |
| 311 | src/tru/widget-dict.c \ | ||
| 312 | src/tru/widget-url.c | ||
| 310 | 313 | ||
| 311 | 314 | ||
| 312 | # macros for src/tinyrad-url | 315 | # macros for src/tinyrad-url |
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 | |||
| @@ -293,36 +293,6 @@ tru_cleanup( | |||
| 293 | 293 | ||
| 294 | 294 | ||
| 295 | int | 295 | int |
| 296 | tru_widget_config( | ||
| 297 | TinyRadUtilConf * cnf ) | ||
| 298 | { | ||
| 299 | int rc; | ||
| 300 | TinyRadDict * dict; | ||
| 301 | if ((rc = tru_load_tinyrad(cnf)) != TRAD_SUCCESS) | ||
| 302 | return(rc); | ||
| 303 | tinyrad_get_option(cnf->tr, TRAD_OPT_DICTIONARY, &dict); | ||
| 304 | tinyrad_conf_print(cnf->tr, dict); | ||
| 305 | tinyrad_free(dict); | ||
| 306 | return(TRAD_SUCCESS); | ||
| 307 | } | ||
| 308 | |||
| 309 | |||
| 310 | int | ||
| 311 | tru_widget_dict( | ||
| 312 | TinyRadUtilConf * cnf ) | ||
| 313 | { | ||
| 314 | int rc; | ||
| 315 | TinyRadDict * dict; | ||
| 316 | if ((rc = tru_load_tinyrad(cnf)) != TRAD_SUCCESS) | ||
| 317 | return(rc); | ||
| 318 | tinyrad_get_option(cnf->tr, TRAD_OPT_DICTIONARY, &dict); | ||
| 319 | tinyrad_dict_print(dict, 0xffff); | ||
| 320 | tinyrad_free(dict); | ||
| 321 | return(TRAD_SUCCESS); | ||
| 322 | } | ||
| 323 | |||
| 324 | |||
| 325 | int | ||
| 326 | tru_getopt( | 296 | tru_getopt( |
| 327 | TinyRadUtilConf * cnf, | 297 | TinyRadUtilConf * cnf, |
| 328 | int argc, | 298 | int argc, |
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 | |||
| @@ -187,6 +187,11 @@ tru_widget_dict( | |||
| 187 | 187 | ||
| 188 | 188 | ||
| 189 | int | 189 | int |
| 190 | tru_widget_url( | ||
| 191 | TinyRadUtilConf * cnf ); | ||
| 192 | |||
| 193 | |||
| 194 | int | ||
| 190 | tru_getopt( | 195 | tru_getopt( |
| 191 | TinyRadUtilConf * cnf, | 196 | TinyRadUtilConf * cnf, |
| 192 | int argc, | 197 | int argc, |
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 @@ | |||
| 1 | /* | ||
| 2 | * Tiny RADIUS Client Library | ||
| 3 | * Copyright (C) 2022 David M. Syzdek <david@syzdek.net>. | ||
| 4 | * All rights reserved. | ||
| 5 | * | ||
| 6 | * Redistribution and use in source and binary forms, with or without | ||
| 7 | * modification, are permitted provided that the following conditions are | ||
| 8 | * met: | ||
| 9 | * | ||
| 10 | * * Redistributions of source code must retain the above copyright | ||
| 11 | * notice, this list of conditions and the following disclaimer. | ||
| 12 | * * Redistributions in binary form must reproduce the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer in the | ||
| 14 | * documentation and/or other materials provided with the distribution. | ||
| 15 | * * Neither the name of David M. Syzdek nor the | ||
| 16 | * names of its contributors may be used to endorse or promote products | ||
| 17 | * derived from this software without specific prior written permission. | ||
| 18 | * | ||
| 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS | ||
| 20 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
| 21 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID M. SYZDEK BE LIABLE FOR | ||
| 23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
| 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
| 26 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 29 | * SUCH DAMAGE. | ||
| 30 | */ | ||
| 31 | #define _SRC_TRU_WIDGET_CONFIG_C 1 | ||
| 32 | |||
| 33 | /////////////// | ||
| 34 | // // | ||
| 35 | // Headers // | ||
| 36 | // // | ||
| 37 | /////////////// | ||
| 38 | #pragma mark - Headers | ||
| 39 | |||
| 40 | #include "tru.h" | ||
| 41 | |||
| 42 | #include <tinyrad_utils.h> | ||
| 43 | |||
| 44 | #include <stdio.h> | ||
| 45 | #include <assert.h> | ||
| 46 | |||
| 47 | |||
| 48 | ///////////////// | ||
| 49 | // // | ||
| 50 | // Functions // | ||
| 51 | // // | ||
| 52 | ///////////////// | ||
| 53 | #pragma mark - Functions | ||
| 54 | |||
| 55 | int | ||
| 56 | tru_widget_config( | ||
| 57 | TinyRadUtilConf * cnf ) | ||
| 58 | { | ||
| 59 | int rc; | ||
| 60 | TinyRadDict * dict; | ||
| 61 | if ((rc = tru_load_tinyrad(cnf)) != TRAD_SUCCESS) | ||
| 62 | return(rc); | ||
| 63 | tinyrad_get_option(cnf->tr, TRAD_OPT_DICTIONARY, &dict); | ||
| 64 | tinyrad_conf_print(cnf->tr, dict); | ||
| 65 | tinyrad_free(dict); | ||
| 66 | return(TRAD_SUCCESS); | ||
| 67 | } | ||
| 68 | |||
| 69 | |||
| 70 | /* 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 @@ | |||
| 1 | /* | ||
| 2 | * Tiny RADIUS Client Library | ||
| 3 | * Copyright (C) 2022 David M. Syzdek <david@syzdek.net>. | ||
| 4 | * All rights reserved. | ||
| 5 | * | ||
| 6 | * Redistribution and use in source and binary forms, with or without | ||
| 7 | * modification, are permitted provided that the following conditions are | ||
| 8 | * met: | ||
| 9 | * | ||
| 10 | * * Redistributions of source code must retain the above copyright | ||
| 11 | * notice, this list of conditions and the following disclaimer. | ||
| 12 | * * Redistributions in binary form must reproduce the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer in the | ||
| 14 | * documentation and/or other materials provided with the distribution. | ||
| 15 | * * Neither the name of David M. Syzdek nor the | ||
| 16 | * names of its contributors may be used to endorse or promote products | ||
| 17 | * derived from this software without specific prior written permission. | ||
| 18 | * | ||
| 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS | ||
| 20 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
| 21 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID M. SYZDEK BE LIABLE FOR | ||
| 23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
| 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
| 26 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 29 | * SUCH DAMAGE. | ||
| 30 | */ | ||
| 31 | #define _SRC_TRU_WIDGET_DICT_C 1 | ||
| 32 | |||
| 33 | /////////////// | ||
| 34 | // // | ||
| 35 | // Headers // | ||
| 36 | // // | ||
| 37 | /////////////// | ||
| 38 | #pragma mark - Headers | ||
| 39 | |||
| 40 | #include "tru.h" | ||
| 41 | |||
| 42 | #include <tinyrad_utils.h> | ||
| 43 | |||
| 44 | #include <stdio.h> | ||
| 45 | #include <assert.h> | ||
| 46 | |||
| 47 | |||
| 48 | ///////////////// | ||
| 49 | // // | ||
| 50 | // Functions // | ||
| 51 | // // | ||
| 52 | ///////////////// | ||
| 53 | #pragma mark - Functions | ||
| 54 | |||
| 55 | int | ||
| 56 | tru_widget_dict( | ||
| 57 | TinyRadUtilConf * cnf ) | ||
| 58 | { | ||
| 59 | int rc; | ||
| 60 | TinyRadDict * dict; | ||
| 61 | if ((rc = tru_load_tinyrad(cnf)) != TRAD_SUCCESS) | ||
| 62 | return(rc); | ||
| 63 | tinyrad_get_option(cnf->tr, TRAD_OPT_DICTIONARY, &dict); | ||
| 64 | tinyrad_dict_print(dict, 0xffff); | ||
| 65 | tinyrad_free(dict); | ||
| 66 | return(TRAD_SUCCESS); | ||
| 67 | } | ||
| 68 | |||
| 69 | |||
| 70 | /* 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 @@ | |||
| 1 | /* | ||
| 2 | * Tiny RADIUS Client Library | ||
| 3 | * Copyright (C) 2022 David M. Syzdek <david@syzdek.net>. | ||
| 4 | * All rights reserved. | ||
| 5 | * | ||
| 6 | * Redistribution and use in source and binary forms, with or without | ||
| 7 | * modification, are permitted provided that the following conditions are | ||
| 8 | * met: | ||
| 9 | * | ||
| 10 | * * Redistributions of source code must retain the above copyright | ||
| 11 | * notice, this list of conditions and the following disclaimer. | ||
| 12 | * * Redistributions in binary form must reproduce the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer in the | ||
| 14 | * documentation and/or other materials provided with the distribution. | ||
| 15 | * * Neither the name of David M. Syzdek nor the | ||
| 16 | * names of its contributors may be used to endorse or promote products | ||
| 17 | * derived from this software without specific prior written permission. | ||
| 18 | * | ||
| 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS | ||
| 20 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
| 21 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID M. SYZDEK BE LIABLE FOR | ||
| 23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
| 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
| 26 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 29 | * SUCH DAMAGE. | ||
| 30 | */ | ||
| 31 | #define _SRC_TRU_WIDGET_URL_C 1 | ||
| 32 | |||
| 33 | /////////////// | ||
| 34 | // // | ||
| 35 | // Headers // | ||
| 36 | // // | ||
| 37 | /////////////// | ||
| 38 | #pragma mark - Headers | ||
| 39 | |||
| 40 | #include "tru.h" | ||
| 41 | |||
| 42 | #include <tinyrad_utils.h> | ||
| 43 | |||
| 44 | #include <stdio.h> | ||
| 45 | #include <assert.h> | ||
| 46 | |||
| 47 | |||
| 48 | ///////////////// | ||
| 49 | // // | ||
| 50 | // Functions // | ||
| 51 | // // | ||
| 52 | ///////////////// | ||
| 53 | #pragma mark - Functions | ||
| 54 | |||
| 55 | int | ||
| 56 | tru_widget_url( | ||
| 57 | TinyRadUtilConf * cnf ) | ||
| 58 | { | ||
| 59 | int rc; | ||
| 60 | if ((rc = tru_load_tinyrad(cnf)) != TRAD_SUCCESS) | ||
| 61 | return(rc); | ||
| 62 | return(TRAD_SUCCESS); | ||
| 63 | } | ||
| 64 | |||
| 65 | |||
| 66 | /* end of source */ | ||
