aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--include/tinyrad.h1
-rw-r--r--lib/libtinyrad/ldict.c14
2 files changed, 15 insertions, 0 deletions
diff --git a/include/tinyrad.h b/include/tinyrad.h
index f6869be..1583b44 100644
--- a/include/tinyrad.h
+++ b/include/tinyrad.h
@@ -233,6 +233,7 @@
233#define TRAD_DICT_OPT_ATTR_NAME 11 // used by TinyRadDictAttr and TinyRadDictValue 233#define TRAD_DICT_OPT_ATTR_NAME 11 // used by TinyRadDictAttr and TinyRadDictValue
234#define TRAD_DICT_OPT_OID 12 // used by TinyRadDictAttr and TinyRadDictValue 234#define TRAD_DICT_OPT_OID 12 // used by TinyRadDictAttr and TinyRadDictValue
235#define TRAD_DICT_OPT_PATHS 13 // used by TinyRadDict 235#define TRAD_DICT_OPT_PATHS 13 // used by TinyRadDict
236#define TRAD_DICT_OPT_READONLY 14 // used by TinyRadDict
236 237
237#define TRAD_OID_TYPE_NONE 0 238#define TRAD_OID_TYPE_NONE 0
238#define TRAD_OID_TYPE_ATTRIBUTE 1 239#define TRAD_OID_TYPE_ATTRIBUTE 1
diff --git a/lib/libtinyrad/ldict.c b/lib/libtinyrad/ldict.c
index f0f73bd..beaf459 100644
--- a/lib/libtinyrad/ldict.c
+++ b/lib/libtinyrad/ldict.c
@@ -759,6 +759,7 @@ tinyrad_dict_get_option(
759 void * outvalue ) 759 void * outvalue )
760{ 760{
761 unsigned uval; 761 unsigned uval;
762 int i;
762 int rc; 763 int rc;
763 764
764 TinyRadDebugTrace(); 765 TinyRadDebugTrace();
@@ -781,6 +782,13 @@ tinyrad_dict_get_option(
781 return(rc); 782 return(rc);
782 break; 783 break;
783 784
785 case TRAD_DICT_OPT_READONLY:
786 TinyRadDebug(TRAD_DEBUG_ARGS, " == %s( dict, TRAD_DICT_OPT_READONLY, outvalue )", __func__);
787 i = tinyrad_dict_is_readonly(dict);
788 TinyRadDebug(TRAD_DEBUG_ARGS, " <= outvalue: %u", ((i == TRAD_NO) ? "TRAD_NO" : "TRAD_YES"));
789 *((int *)outvalue) = i;
790 break;
791
784 case TRAD_DICT_OPT_REF_COUNT: 792 case TRAD_DICT_OPT_REF_COUNT:
785 TinyRadDebug(TRAD_DEBUG_ARGS, " == %s( dict, TRAD_DICT_OPT_REF_COUNT, outvalue )", __func__); 793 TinyRadDebug(TRAD_DEBUG_ARGS, " == %s( dict, TRAD_DICT_OPT_REF_COUNT, outvalue )", __func__);
786 uval = (unsigned)tinyrad_obj_retain_count(&dict->obj); 794 uval = (unsigned)tinyrad_obj_retain_count(&dict->obj);
@@ -870,6 +878,12 @@ tinyrad_dict_set_option(
870 dict->paths = strs; 878 dict->paths = strs;
871 break; 879 break;
872 880
881 case TRAD_DICT_OPT_READONLY:
882 TinyRadDebug(TRAD_DEBUG_ARGS, " == %s( dict, TRAD_DICT_OPT_READONLY, %s )", __func__, ( (*((const int*)invalue) != TRAD_NO) ? "TRAD_YES" : "TRAD_NO" ) );
883 if (*((const int*)invalue) != TRAD_NO)
884 atomic_fetch_add(&dict->readonly, TRAD_YES);
885 break;
886
873 default: 887 default:
874 TinyRadDebug(TRAD_DEBUG_ARGS, " == %s( dict, %i, invalue )", __func__, option); 888 TinyRadDebug(TRAD_DEBUG_ARGS, " == %s( dict, %i, invalue )", __func__, option);
875 return(TRAD_EOPTERR); 889 return(TRAD_EOPTERR);