t60/ 0000775 0001750 0001750 00000000000 14122227335 010142 5 ustar andy andy t60/src/ 0000775 0001750 0001750 00000000000 14122253554 010733 5 ustar andy andy t60/src/u_t60.h 0000664 0001750 0001750 00000010221 14104006747 012035 0 ustar andy andy
#ifndef _H_u_t60
#define _H_u_t60
/*
* Copyright (c) 2008 - 2012, Andy Bierman, All Rights Reserved.
* Copyright (c) 2012 - 2021, YumaWorks, Inc., All Rights Reserved.
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
/**
* @file u_t60.h
* @brief User SIL header for module t60
*
*** Generated by yangdump-sdk tomcat-integ-2021-08-07.18.36
User SIL header
module t60
revision 2021-08-08
prefix t
namespace http://netconfcentral.org/ns/t60
Created: 2021-08-08T17:01:27Z
CLI parameters:
format uh
indent 4
module t60
output u_t60.h
sil-get2
unified true
*/
#include
#include "procdefs.h"
#include "agt.h"
#include "agt_cb.h"
#include "dlq.h"
#include "ncxtypes.h"
#include "op.h"
#include "rpc.h"
#include "ses.h"
#include "status.h"
#include "val.h"
#include "y_t60.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @addtogroup yang-library YANG Library
*
* Collection of modules supported by the server.
* Generated by yangdump-sdk.
*/
/**
* @addtogroup sil-t60 Module t60
* @ingroup yang-library
*
* @{
*
* YANG instrumentation library.
* Generated by yangdump-sdk.
*/
/* list /top/A */
typedef struct y_t_T_A_ {
dlq_hdr_t qhdr;
uint8 v_a;
uint8 v_b;
uint8 v_c;
xmlChar *v_d;
} y_t_T_A;
/* container /top */
typedef struct y_t_T_top_ {
dlq_hdr_t v_A;
} y_t_T_top;
/**
* @brief Get database object callback for list A (getcb_fn2_t)\n
* Path: list /top/A\n
*
* Fill in 'get2cb' response fields.
*
* @param get2cb GET2 control block for the callback.
* @param k_t_a Local key leaf 'a' in list 'A'\n
* Path: /t:top/t:A/t:a
* @param a_fixed TRUE if this key is fixed in a getnext request.
* @param a_present TRUE if this key is present and 'k_t_a' is valid.\n
* FALSE to get first in a getnext request.
* @param k_t_b Local key leaf 'b' in list 'A'\n
* Path: /t:top/t:A/t:b
* @param b_fixed TRUE if this key is fixed in a getnext request.
* @param b_present TRUE if this key is present and 'k_t_b' is valid.\n
* FALSE to get first in a getnext request.
* @param k_t_c Local key leaf 'c' in list 'A'\n
* Path: /t:top/t:A/t:c
* @param c_fixed TRUE if this key is fixed in a getnext request.
* @param c_present TRUE if this key is present and 'k_t_c' is valid.\n
* FALSE to get first in a getnext request.
* @return return status of the callback.
*/
extern status_t u_t_A_get (
getcb_get2_t *get2cb,
uint8 k_t_a,
boolean a_fixed,
boolean a_present,
uint8 k_t_b,
boolean b_fixed,
boolean b_present,
uint8 k_t_c,
boolean c_fixed,
boolean c_present);
/**
* @brief Get database object callback for container top (getcb_fn2_t)\n
* Path: container /top\n
*
* Fill in 'get2cb' response fields.
*
* @param get2cb GET2 control block for the callback.
* @return return status of the callback.
*/
extern status_t u_t_top_get (
getcb_get2_t *get2cb);
/**
* @brief Phase 1: Initialize the t60 server instrumentation library.
*
* Called by server when module is loaded.
*
* @param modname requested module name to load
* @param revision requested revision date of the module to load.
* This may be NULL if the module has no revision statements.
* @return return status. An error will cause the module load to fail.
*/
extern status_t u_t60_init (
const xmlChar *modname,
const xmlChar *revision);
/**
* @brief Phase 2: Initialize the t60 server instrumentation library.
*
* SIL init phase 2: non-config data structures.
* Called after running config is loaded.
*
* @return return status. An error will cause the
* server initialization to fail.
*/
extern status_t u_t60_init2 (void);
/**
* @brief Cleanup the t60 server instrumentation library.
*
* Called by server when module is unloaded.
*
*/
extern void u_t60_cleanup (void);
/** @} */
#ifdef __cplusplus
} /* end extern 'C' */
#endif
#endif
t60/src/y_t60.c 0000664 0001750 0001750 00000015556 14104006747 012054 0 ustar andy andy
/*
* Copyright (c) 2008 - 2012, Andy Bierman, All Rights Reserved.
* Copyright (c) 2012 - 2021, YumaWorks, Inc., All Rights Reserved.
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
/**
* @file y_t60.c
* @brief YumaPro SIL module for module t60
*
*** Generated by yangdump-sdk tomcat-integ-2021-08-07.18.36
YumaPro SIL module
module t60
revision 2021-08-08
prefix t
namespace http://netconfcentral.org/ns/t60
Created: 2021-08-08T17:01:27Z
CLI parameters:
format yc
indent 4
module t60
output y_t60.c
sil-get2
unified true
Short Name Mappings
A = /top/A
a = /top/A/a
b = /top/A/b
c = /top/A/c
d = /top/A/d
top = /top
*/
#include
#include "procdefs.h"
#include "agt.h"
#include "agt_action.h"
#include "agt_cb.h"
#include "agt_rpc.h"
#include "agt_sil_lib.h"
#include "agt_timer.h"
#include "agt_util.h"
#include "agt_val.h"
#include "cfg.h"
#include "dlq.h"
#include "getcb.h"
#include "ncx.h"
#include "ncx_feature.h"
#include "ncxmod.h"
#include "ncxtypes.h"
#include "obj.h"
#include "rpc.h"
#include "status.h"
#include "val.h"
#include "val_child.h"
#include "val_util.h"
#include "xml_val.h"
#include "u_t60.h"
#include "y_t60.h"
/**
* @addtogroup yang-library YANG Library
*
* Collection of modules supported by the server.
* Generated by yangdump-sdk.
*/
/**
* @addtogroup sil-t60 Module t60
* @ingroup yang-library
*
* @{
*
* YANG instrumentation library.
* Generated by yangdump-sdk.
*/
/* module static variables */
static ncx_module_t *t60_mod;
static obj_template_t *top_obj;
/**
* @brief Initialize module static variables
*
* Called by server when module is loaded.
*/
static void y_t_init_static_vars (void)
{
t60_mod = NULL;
top_obj = NULL;
} /* y_t_init_static_vars */
/**
* @brief Get database object callback for list A (getcb_fn2_t)\n
* Path: list /top/A\n
*
* Fill in 'get2cb' response fields.
*
* @param scb session control block making the request.
* @param msg message in progress for this retrieval request.
* @param get2cb GET2 control block for the callback.
* @return return status of the callback.
*/
static status_t A_get (
ses_cb_t *scb,
xml_msg_hdr_t *msg,
getcb_get2_t *get2cb)
{
if (LOGDEBUG) {
log_debug("\nEnter A_get");
}
(void)scb;
(void)msg;
val_value_t *keyval = NULL;
/* local key t60:a */
uint8 k_t_a = 0;
boolean a_fixed = FALSE;
boolean a_present = FALSE;
keyval = getcb_find_key_lvl(get2cb,
y_t_M_t,
y_t_N_a,
(uint32)3);
if (keyval) {
k_t_a = VAL_UINT8(keyval);
a_fixed = VAL_IS_FIXED_VALUE(keyval);
a_present = TRUE;
}
/* local key t60:b */
uint8 k_t_b = 0;
boolean b_fixed = FALSE;
boolean b_present = FALSE;
keyval = getcb_find_key_lvl(get2cb,
y_t_M_t,
y_t_N_b,
(uint32)3);
if (keyval) {
k_t_b = VAL_UINT8(keyval);
b_fixed = VAL_IS_FIXED_VALUE(keyval);
b_present = TRUE;
}
/* local key t60:c */
uint8 k_t_c = 0;
boolean c_fixed = FALSE;
boolean c_present = FALSE;
keyval = getcb_find_key_lvl(get2cb,
y_t_M_t,
y_t_N_c,
(uint32)3);
if (keyval) {
k_t_c = VAL_UINT8(keyval);
c_fixed = VAL_IS_FIXED_VALUE(keyval);
c_present = TRUE;
}
return u_t_A_get(
get2cb,
k_t_a,
a_fixed,
a_present,
k_t_b,
b_fixed,
b_present,
k_t_c,
c_fixed,
c_present);
} /* A_get */
/**
* @brief Get database object callback for container top (getcb_fn2_t)\n
* Path: container /top\n
*
* Fill in 'get2cb' response fields.
*
* @param scb session control block making the request.
* @param msg message in progress for this retrieval request.
* @param get2cb GET2 control block for the callback.
* @return return status of the callback.
*/
static status_t top_get (
ses_cb_t *scb,
xml_msg_hdr_t *msg,
getcb_get2_t *get2cb)
{
if (LOGDEBUG) {
log_debug("\nEnter top_get");
}
(void)scb;
(void)msg;
return u_t_top_get(get2cb);
} /* top_get */
/**
* @brief Phase 1: Initialize the t60 server instrumentation library.
*
* Called by server when module is loaded.
*
* @param modname requested module name to load
* @param revision requested revision date of the module to load.
* This may be NULL if the module has no revision statements.
* @return return status. An error will cause the module load to fail.
*/
status_t y_t60_init (
const xmlChar *modname,
const xmlChar *revision)
{
status_t res = NO_ERR;
if (LOGDEBUG) {
log_debug("\nEnter y_t60_init");
}
y_t_init_static_vars();
/* change if custom handling done */
if (xml_strcmp(modname, y_t_M_t)) {
return ERR_NCX_UNKNOWN_MODULE;
}
if (revision && xml_strcmp(revision, y_t_R_t)) {
return ERR_NCX_WRONG_VERSION;
}
res = ncxmod_load_module(
y_t_M_t,
y_t_R_t,
agt_get_savedevQ(),
&t60_mod);
if (res != NO_ERR) {
return res;
}
top_obj = ncx_find_object(
t60_mod,
y_t_N_top);
if (top_obj == NULL) {
return ERR_NCX_DEF_NOT_FOUND;
}
res = agt_cb_register_get_callback(
y_t_M_t,
(const xmlChar *)"/t:top",
y_t_R_t,
top_get);
if (res != NO_ERR) {
return res;
}
res = agt_cb_register_get_callback(
y_t_M_t,
(const xmlChar *)"/t:top/t:A",
y_t_R_t,
A_get);
if (res != NO_ERR) {
return res;
}
res = u_t60_init(modname, revision);
return res;
} /* y_t60_init */
/**
* @brief Phase 2: Initialize the t60 server instrumentation library.
*
* SIL init phase 2: non-config data structures.
* Called after running config is loaded.
*
* @return return status. An error will cause the
* server initialization to fail.
*/
status_t y_t60_init2 (void)
{
status_t res = NO_ERR;
if (LOGDEBUG) {
log_debug("\nEnter y_t60_init2");
}
res = u_t60_init2();
return res;
} /* y_t60_init2 */
/**
* @brief Cleanup the t60 server instrumentation library.
*
* Called by server when module is unloaded.
*
*/
void y_t60_cleanup (void)
{
if (LOGDEBUG) {
log_debug("\nEnter y_t60_cleanup");
}
agt_cb_unregister_callbacks(
y_t_M_t,
(const xmlChar *)"/t:top");
agt_cb_unregister_callbacks(
y_t_M_t,
(const xmlChar *)"/t:top/t:A");
u_t60_cleanup();
} /* y_t60_cleanup */
/** @} */
/* END SIL y_t60.c */
t60/src/u_t60.c 0000664 0001750 0001750 00000043725 14122243204 012036 0 ustar andy andy
/*
* Copyright (c) 2008 - 2012, Andy Bierman, All Rights Reserved.
* Copyright (c) 2012 - 2021, YumaWorks, Inc., All Rights Reserved.
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
/**
* @file u_t60.c
* @brief User SIL module for module t60
*
*** Generated by yangdump-sdk tomcat-integ-2021-08-07.18.36
User SIL module
module t60
revision 2021-08-08
prefix t
namespace http://netconfcentral.org/ns/t60
Created: 2021-08-08T17:01:27Z
CLI parameters:
format uc
indent 4
module t60
output u_t60.c
sil-get2
unified true
Short Name Mappings
A = /top/A
a = /top/A/a
b = /top/A/b
c = /top/A/c
d = /top/A/d
top = /top
module: t60
+--ro top
+--ro A* [a b c]
+--ro a uint8
+--ro b uint8
+--ro c uint8
+--ro d? string
*/
#include
#include "procdefs.h"
#include "agt.h"
#include "agt_action.h"
#include "agt_cb.h"
#include "agt_rpc.h"
#include "agt_sil_lib.h"
#include "agt_timer.h"
#include "agt_util.h"
#include "agt_val.h"
#include "cfg.h"
#include "dlq.h"
#include "getcb.h"
#include "ncx.h"
#include "ncx_feature.h"
#include "ncxmod.h"
#include "ncxtypes.h"
#include "obj.h"
#include "rpc.h"
#include "status.h"
#include "val.h"
#include "val_child.h"
#include "val_util.h"
#include "xml_val.h"
#include "u_t60.h"
#include "y_t60.h"
/**
* @addtogroup yang-library YANG Library
*
* Collection of modules supported by the server.
* Generated by yangdump-sdk.
*/
/**
* @addtogroup sil-t60 Module t60
* @ingroup yang-library
*
* @{
*
* YANG instrumentation library.
* Generated by yangdump-sdk.
*/
/* put your static variables here */
#define NO_ENTRY 0
#define FIRST_ENTRY 1
#define LAST_ENTRY 3
/**
* @brief Get the next key tuple for an entry to return
*
* In this example there are 3 keys all with values
* from 1 to 3.
*
* In reality the client may send a request for a
* non-existent entry (a hole) instead of the previous
* entry. This example uses a simple dense value set so
* there are no holes in the possible tuples that can be
* provided for processing.
*
* The GET-NEXT algorithm works like an odometer,
* where each key leaf represents a digit.
* If a major index increments, then all the indices
* after it start over (at 1 in this example), unless
* they are fixed key leafs. A fixed key comes from
* a subtree or XPath filter that specifies some but
* not all of the key values. The GET2 function is
* expected to check for fixed keys and iterate through
* the entires only incrementing the non-fixed keys.
*
* A real getnext function would probably return
* a pointer to the internal data structure found.
* This example is just returning the key values.
*
* @param getnext true to getnext; false for get exact
* Parameters from the u_ GET2 callback.\n
* If getnext=true then the next entry is requested.\n
* If getnext=false then check the number of keys
* provided. If all keys are provided, then this is a
* real GET-EXACT request. If zero or partial keys
* are provided, then this is a GET-NEXT request.
* @param lastentry address of lastentry return flag
* @param k_t_a pointer to first key 'a' and also return 'a'
* @param a_fixed == true if 'a' is fixed key
* @param a_present == true if 'a' is present (could also check
* if k_t_a is NULL)
* @param k_t_b pointer to second key 'b' and also return 'b'
* @param b_fixed == true if 'b' is fixed key
* @param b_present == true if 'b' is present (could also check
* if k_t_b is NULL)
* @param k_t_c pointer to third key 'c' and also return 'c'
* @param c_fixed == true if 'c' is fixed key
* @param c_present == true if 'c' is present (could also check
* if k_t_c is NULL)
* @retval *k_t_a found key 'a' if return true
* @retval *k_t_b found key 'b' if return true
* @retval *k_t_c found key 'c' if return true
* @retval *lastentry true if there are no more entries
* matching the filters.\n
* false if there might be more entries left
* @return true if next is being returned\n
* false if ERR_NCX_NO_INSTANCE
*/
static boolean getnext_A (boolean getnext,
boolean *lastentry,
uint8 *k_t_a,
boolean a_fixed,
boolean a_present,
uint8 *k_t_b,
boolean b_fixed,
boolean b_present,
uint8 *k_t_c,
boolean c_fixed,
boolean c_present)
{
*lastentry = false;
if (!getnext) {
/* the first getnext is really a GET with either no keys
* or 1 or more fixed keys.
*/
if (!a_present && !b_present && !c_present) {
if (LOGDEBUG2) {
log_debug2("\ngetnext_A: got first tuple [%u, %u, %u]",
FIRST_ENTRY, FIRST_ENTRY, FIRST_ENTRY);
}
/* get first entry */
*k_t_a = FIRST_ENTRY;
*k_t_b = FIRST_ENTRY;
*k_t_c = FIRST_ENTRY;
return true;
} /* else at least one key is present; keep looking */
}
/* check corner-case where all keys are fixed
* in that case no point looking for a next
*/
if (a_fixed && b_fixed && c_fixed) {
/* If first or real GET then all fixed is OK
* If all keys fixed for GETNEXT then no entry possible
*/
return !getnext;
}
/* using the key leafs to indicate no value.
* the 'foo_prenset' flags could also be used
* in case the value does not have any unused values
*/
uint8 a = NO_ENTRY;
uint8 b = NO_ENTRY;
uint8 c = NO_ENTRY;
/* Get the starting set of keys to get the next for
* If the key is present, check the value range now
*/
if (a_present) {
a = *k_t_a;
if ((a == NO_ENTRY) || (a > LAST_ENTRY)) {
return false;
}
}
if (b_present) {
b = *k_t_b;
if ((b == NO_ENTRY) || (b > LAST_ENTRY)) {
return false;
}
}
if (c_present) {
c = *k_t_c;
if ((c == NO_ENTRY) || (c > LAST_ENTRY)) {
return false;
}
}
/* check GET-EXACT corner-case */
if (!getnext && (a_present && b_present && c_present)) {
/* got all keys for a GET so return OK */
if (LOGDEBUG2) {
log_debug2("\ngetnext_A: GET exact tuple [%u, %u, %u]",
a, b, c);
}
*lastentry = true;
return true;
}
/* alway increment or reset 'c'
* use flags for 'a' and 'b' to iterate through the
* loop and start on the key that is changing.
* If next 'c' not found then retry starting with same a and inc_b
* If next 'b' not found then retry starting with inc_a and reset b,c
*/
boolean inc_a = false;
boolean inc_b = false;
/** find the next, given the current keys */
while (1) {
if ((a == NO_ENTRY) || inc_a) {
if (a_fixed || (a >= LAST_ENTRY)) {
return false;
}
a++;
if (!b_fixed) {
b = FIRST_ENTRY;
}
if (!c_fixed) {
c = FIRST_ENTRY;
}
/* return this tuple within range */
break;
}
if ((b == NO_ENTRY) || inc_b) {
if (b_fixed || (b >= LAST_ENTRY)) {
if (c_fixed || (c >= LAST_ENTRY)) {
inc_a = true;
inc_b = false;
continue;
} else {
c++;
break;
}
} else {
b++;
if (!c_fixed) {
c = FIRST_ENTRY;
}
break;
}
}
if (c_fixed || (c >= LAST_ENTRY)) {
inc_a = false;
inc_b = true;
continue;
} else if (c == NO_ENTRY) {
c = FIRST_ENTRY;
} else {
c++;
}
break;
}
if (LOGDEBUG2) {
log_debug2("\ngetnext_A: got tuple [%u, %u, %u]", a, b, c);
}
*k_t_a = a;
*k_t_b = b;
*k_t_c = c;
/* this may not be easy to tell for a real data structure
* in that case set *lastentry to false if unknown.
* The server will retry and the next call can return NO_INSTANCE
* Set *lastentry to true will cause the server to stop checking
* for more 'A' list entries
*/
if ((a == LAST_ENTRY) && (b == LAST_ENTRY) && (c == LAST_ENTRY)) {
*lastentry = true;
}
return true;
} /* getnext_A */
/**
* @brief Get database object callback for list A (getcb_fn2_t)\n
* Path: list /top/A\n
*
* Fill in 'get2cb' response fields.
*
* @param get2cb GET2 control block for the callback.
* @param k_t_a Local key leaf 'a' in list 'A'\n
* Path: /t:top/t:A/t:a
* @param a_fixed TRUE if this key is fixed in a getnext request.
* @param a_present TRUE if this key is present and 'k_t_a' is valid.\n
* FALSE to get first in a getnext request.
* @param k_t_b Local key leaf 'b' in list 'A'\n
* Path: /t:top/t:A/t:b
* @param b_fixed TRUE if this key is fixed in a getnext request.
* @param b_present TRUE if this key is present and 'k_t_b' is valid.\n
* FALSE to get first in a getnext request.
* @param k_t_c Local key leaf 'c' in list 'A'\n
* Path: /t:top/t:A/t:c
* @param c_fixed TRUE if this key is fixed in a getnext request.
* @param c_present TRUE if this key is present and 'k_t_c' is valid.\n
* FALSE to get first in a getnext request.
* @return return status of the callback.
*/
status_t u_t_A_get (
getcb_get2_t *get2cb,
uint8 k_t_a,
boolean a_fixed,
boolean a_present,
uint8 k_t_b,
boolean b_fixed,
boolean b_present,
uint8 k_t_c,
boolean c_fixed,
boolean c_present)
{
if (LOGDEBUG) {
log_debug("\nEnter u_t_A_get");
}
boolean getnext = FALSE;
/* check the callback mode type */
getcb_mode_t cbmode = GETCB_GET2_CBMODE(get2cb);
switch (cbmode) {
case GETCB_GET_VALUE:
break;
case GETCB_GETNEXT_VALUE:
getnext = TRUE;
break;
default:
/* USE SET_ERROR FOR PROGRAMMING BUGS ONLY */
return SET_ERROR(ERR_INTERNAL_VAL);
}
obj_template_t *obj = GETCB_GET2_OBJ(get2cb);
status_t res = NO_ERR;
uint32 entries_done = 0;
uint32 max_entries = GETCB_GET2_MAX_ENTRIES(get2cb);
if (max_entries == 0) {
max_entries = 6;
}
boolean done = false;
while (!done) {
/* For GET, find the entry that matches the key values
* For GETNEXT, find the entry that matches the next key value
* If the 'present' flag is false then return first key instance
* If the 'fixed' flag is true then no GETNEXT advance for the key
* Create a new return key val_value_t, then getcb_add_return_key
*/
boolean lastentry = false;
boolean gotnext = getnext_A(getnext,
&lastentry,
&k_t_a,
a_fixed,
a_present,
&k_t_b,
b_fixed,
b_present,
&k_t_c,
c_fixed,
c_present);
if (!gotnext) {
return (entries_done > 0) ? NO_ERR : ERR_NCX_NO_INSTANCE;
}
/* optional: check if any content-match nodes are present */
boolean match_test_done = FALSE;
val_value_t *match_val = GETCB_GET2_FIRST_MATCH(get2cb);
for (; match_val; match_val =
GETCB_GET2_NEXT_MATCH(get2cb, match_val)) {
/**** CHECK CONTENT NODES AGAINST THIS ENTRY ***/
if (LOGDEBUG) {
log_debug("\nGot content-match node '%s'\n",
VAL_NAME(match_val));
val_dump_value(match_val, 2, LOG_DEBUG_DEBUG);
}
/* if the match test fails then need to setup next getnext
* and skip the entry just returned from getnext_A
* in that case, invoke the following code
*
* getnext=true;
* a_present = true;
* b_present = true;
* c_present = true;
* continue;
*/
}
/* the flag applies to all entries so need to check
* for all entries or none of them
*/
GETCB_GET2_MATCH_TEST_DONE(get2cb) = match_test_done;
/* add the return keys [a, b, c] */
val_value_t *chval = agt_make_uint_leaf(obj, y_t_N_a, k_t_a, &res);
if (chval == NULL) {
return res;
}
if (a_fixed) {
VAL_SET_FIXED_VALUE(chval);
}
getcb_add_return_key(get2cb, chval);
chval = agt_make_uint_leaf(obj, y_t_N_b, k_t_b, &res);
if (chval == NULL) {
return res;
}
if (b_fixed) {
VAL_SET_FIXED_VALUE(chval);
}
getcb_add_return_key(get2cb, chval);
chval = agt_make_uint_leaf(obj, y_t_N_c, k_t_c, &res);
if (chval == NULL) {
return res;
}
if (c_fixed) {
VAL_SET_FIXED_VALUE(chval);
}
getcb_add_return_key(get2cb, chval);
/* For GETNEXT, set the more_data flag to TRUE unless last entry */
GETCB_GET2_MORE_DATA(get2cb) = !lastentry;
if (!GETCB_GET2_KEYS_ONLY(get2cb)) {
/* go through all the requested terminal child objects */
obj_template_t *childobj =
getcb_first_requested_child(get2cb, obj);
for (; childobj; childobj =
getcb_next_requested_child(get2cb, childobj)) {
const xmlChar *name = obj_get_name(childobj);
/* Retrieve the value of this terminal node and
* add with getcb_add_return_val */
if (!xml_strcmp(name, y_t_N_d)) {
/* leaf d (string) */
xmlChar buff[64];
snprintf((char *)buff, 64, "[%u, %u, %u]",
k_t_a, k_t_b, k_t_c);
chval = agt_make_leaf(obj, y_t_N_d, buff, &res);
if (chval == NULL) {
return res;
}
getcb_add_return_val(get2cb, chval);
}
}
}
if (lastentry) {
done = true;
} else {
/* save the entry as a a getbulk struct and check
* if more entries allowed
*/
getcb_finish_getbulk_entry(get2cb);
if (++entries_done < max_entries) {
/* setup next call to getnext_A */
a_present = true;
b_present = true;
c_present = true;
getnext = true;
} else {
/* hit max_entries so stop looking for more entries */
done = true;
}
}
}
return res;
} /* u_t_A_get */
/**
* @brief Get database object callback for container top (getcb_fn2_t)\n
* Path: container /top\n
*
* Fill in 'get2cb' response fields.
*
* @param get2cb GET2 control block for the callback.
* @return return status of the callback.
*/
status_t u_t_top_get (
getcb_get2_t *get2cb)
{
if (LOGDEBUG) {
log_debug("\nEnter u_t_top_get");
}
/* check the callback mode type */
getcb_mode_t cbmode = GETCB_GET2_CBMODE(get2cb);
switch (cbmode) {
case GETCB_GET_VALUE:
break;
case GETCB_GETNEXT_VALUE:
return ERR_NCX_NO_INSTANCE;
default:
/* USE SET_ERROR FOR PROGRAMMING BUGS ONLY */
return SET_ERROR(ERR_INTERNAL_VAL);
}
/* an NP container always exists so no test for node_exists
* by the SIL or SIL-SA callback is needed
*/
obj_template_t *obj = GETCB_GET2_OBJ(get2cb);
status_t res = NO_ERR;
/* no terminal child nodes to check */
(void)obj; /* remove if obj is used */
return res;
} /* u_t_top_get */
/**
* @brief Phase 1: Initialize the t60 server instrumentation library.
*
* Called by server when module is loaded.
*
* @param modname requested module name to load
* @param revision requested revision date of the module to load.
* This may be NULL if the module has no revision statements.
* @return return status. An error will cause the module load to fail.
*/
status_t u_t60_init (
const xmlChar *modname,
const xmlChar *revision)
{
status_t res = NO_ERR;
if (LOGDEBUG) {
log_debug("\nEnter u_t60_init");
}
ncx_module_t *t60_mod = NULL;
t60_mod = ncx_find_module(modname, revision);
if (t60_mod == NULL) {
return ERR_NCX_OPERATION_FAILED;
}
/* put your module initialization code here */
return res;
} /* u_t60_init */
/**
* @brief Phase 2: Initialize the t60 server instrumentation library.
*
* SIL init phase 2: non-config data structures.
* Called after running config is loaded.
*
* @return return status. An error will cause the
* server initialization to fail.
*/
status_t u_t60_init2 (void)
{
status_t res = NO_ERR;
if (LOGDEBUG) {
log_debug("\nEnter u_t60_init2");
}
/* put your init2 code here */
return res;
} /* u_t60_init2 */
/**
* @brief Cleanup the t60 server instrumentation library.
*
* Called by server when module is unloaded.
*
*/
void u_t60_cleanup (void)
{
if (LOGDEBUG) {
log_debug("\nEnter u_t60_cleanup");
}
/* put your cleanup code here */
} /* u_t60_cleanup */
/** @} */
/* END SIL u_t60.c */
t60/src/Makefile 0000664 0001750 0001750 00000022642 14104006746 012400 0 ustar andy andy MODULE_NAME=t60
# SIL Makefile for YumaPro Server Instrumentation Library
#
############### SOURCE PROFILE ##############################
SUBDIR_NM=$(MODULE_NAME)
SUBDIR_CPP=
############### TARGET PROFILE ##############################
ifdef MAC
INSTALL_PREFIX ?= /usr/local
else
INSTALL_PREFIX ?= /usr
endif
TARGET=../bin
LIB_INST=../lib
ifdef YUMAPRO_HOME
WORK_INST=$(YUMAPRO_HOME)/target/lib
else
WORK_INST=
endif
ifdef LIB64
REAL_INST=$(DESTDIR)$(INSTALL_PREFIX)/lib64/yumapro
REAL_BASE=$(DESTDIR)$(INSTALL_PREFIX)/lib64
else
REAL_INST=$(DESTDIR)$(INSTALL_PREFIX)/lib/yumapro
REAL_BASE=$(DESTDIR)$(INSTALL_PREFIX)/lib
endif
#################### MAKE RULES ########################
all: sil_dummy sil_lib
#################### PLATFORM DEFINITIONS ############
CINCBASE=$(DESTDIR)$(INSTALL_PREFIX)/include
CINC = $(USER_INC) -I.
ifdef FORCE_YUMAPRO_HOME
CINC += -I$(YUMAPRO_HOME)/src/platform -I$(YUMAPRO_HOME)/src/ncx \
-I$(YUMAPRO_HOME)/src/agt
else
ifdef NO_GNU
CINC += -I$(CINCBASE)/yumapro/platform -I$(CINCBASE)/yumapro/ncx \
-I$(CINCBASE)/yumapro/agt
else
CINC += -iquote $(CINCBASE)/yumapro/platform -iquote $(CINCBASE)/yumapro/ncx \
-iquote $(CINCBASE)/yumapro/agt
endif # NO_GNU
endif # FORCE_YUMAPRO_HOME
CINC += -I$(CINCBASE) -I$(CINCBASE)/libxml2 -I$(CINCBASE)/libxml2/libxml
ifdef FREEBSD
CINC += -I${SYSROOT}/usr/local/include -I${SYSROOT}/usr/local/include/libxml2 \
-I${SYSROOT}/usr/local/include/libxml2/libxml
endif
ifdef COVERITY
ifneq "$(INSTALL_PREFIX)" "/usr"
CINC += -I${SYSROOT}/usr/include -I${SYSROOT}/usr/include/libxml2 \
-I${SYSROOT}/usr/include/libxml2/libxml
endif
endif # COVERITY
ifdef MAC
# MACOSX version
XCODE ?= /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include
CFLAGS += -DMACOSX=1
CINC += -I$(XCODE) \
-I$(XCODE)/libxml2 \
-I$(XCODE)/libxml2/libxml \
-I$(XCODE)/openssl
endif
ifdef DESTDIR
OWNER=
else
ifdef MAC
OWNER=-oroot
else
ifdef CYGWIN
OWNER=
else
OWNER= --owner=root
endif
endif
endif
### GCC + [LINUX or MACOSX]
CDEFS=
ifdef USE_WERROR
WERROR= -Werror
else
WERROR= -Werror=incompatible-pointer-types
endif
ifdef NO_YPACK
PACK_WARN=
CDEFS += -DNO_YPACK=1
else
PACK_WARN=-Wno-address-of-packed-member
endif
CWARN=-Wall -Wno-long-long -Wformat-y2k -Winit-self \
-Wswitch-default -Wextra -Wundef -Wshadow -Wpointer-arith \
-Wwrite-strings -Wbad-function-cast -Wcast-qual \
-Waggregate-return -Wstrict-prototypes -Wold-style-definition \
-Wmissing-prototypes -Wmissing-declarations \
-Winvalid-pch -Wredundant-decls -Wnested-externs -Winline \
-std=gnu99 $(WERROR) $(PACK_WARN)
YDPARMS= --indent=4 --module=$(SUBDIR_NM)
# -Wunreachable-code removed due to -O3
# -O3 changed to -O2 due to code bloat from inline functions
CDEFS += -DDEBUG=1 -DLINUX=1 -DGCC=1
ifndef NOFLOAT
CDEFS += -DHAS_FLOAT=1
endif
ifdef DEBUG2
CDEFS += -DDEBUG2=1
endif
ifdef DEBUG3
CDEFS += -DDEBUG3=1
endif
ifdef DEBUG4
CDEFS += -DDEBUG4=1
endif
ifdef FREEBSD
CDEFS += -DFREEBSD=1
endif
ifdef KEY
CDEFS += -DKEY=$(KEY)
endif
ifndef NOFLOAT
CDEFS += -DHAS_FLOAT=1
endif
ifdef LIB64
CDEFS += -DLIB64=1
endif
ifdef PATCH_RELEASE
CDEFS += -DPATCH_RELEASE=1
endif
ifdef UCLINUX
CDEFS += -DUCLINUX=1
endif
ifdef BITBAKE
CDEFS += -DBITBAKE=1
endif
ifdef STATIC_SERVER
CDEFS += -DSTATIC_SERVER=1
endif # STATIC_SERVER
ifdef WITH_YCONTROL
CDEFS += -DWITH_YCONTROL=1
endif
# production (0) or debug (1) build
ifdef DEBUG
CFLAGS += -ggdb3
else
CFLAGS += -O2
endif
ifdef PTHREADS
CFLAGS += -DPTHREADS=1
CFLAGS += -pthread
endif
CFLAGS += $(CDEFS) $(CWARN)
ifndef CYGWIN
ifndef UCLINUX
ifndef STATIC
CFLAGS += -fPIC
endif # STATIC
endif # UCLINUX
endif # CYGWIN
# memory leak debugging mode
ifdef MEMTRACE
CFLAGS += -DMEMORY_DEBUG=1
endif
ifdef RELEASE
CFLAGS += -DRELEASE=$(RELEASE)
endif
ifdef LIB64
CFLAGS += -DLIB64=1
endif
ifdef MAC
GRP=
else
ifdef DESTDIR
GRP=
else
ifdef CYGWIN
GRP=
else
GRP=--group=root
endif # CYGWIN
endif # DESTDIR
endif # MAC
ifdef STATIC
LIBSUFFIX=a
else
ifdef MAC
ifdef COVERITY
LIBSUFFIX=so
else
LIBSUFFIX=dylib
endif # COVERITY
else
LIBSUFFIX=so
endif # MAC
endif # STATIC
ifdef CPP98
CXXFLAGS += -std=c++98 -Wno-c++0x-compat -DCPP98
$(info Compiling in C++98 mode)
else ifdef UCLINUX
CFLAGS += -D__USE_UNIX98=1
CXXFLAGS += -std=c++98 -Wno-c++0x-compat -DCPP98
$(info Compiling in UCLINUX C++98 mode)
else
CXXFLAGS += -std=c++0x
$(info Compiling in C++11 mode)
endif # CPP98
ifdef EXTRA_CFLAGS
CFLAGS += $(EXTRA_CFLAGS)
endif
ifdef CLANG
CC = clang
CCPP = clang++
endif
ifdef CLANG_ASAN
CC= clang -O1 -fsanitize=address -fno-omit-frame-pointer
CCPP= clang++ -O1 -fsanitize=address -fno-omit-frame-pointer
LINK= clang++ -g -fsanitize=address
endif
ifdef BITBAKE
CCPP = $(CXX)
endif
ifdef COVERITY
CC = gcc
endif
ifdef WINDOWS
CC ?= i586-mingw32msvc-gcc
CCPP ?= i586-mingw32msvc-g++
LINK ?= i586-mingw32msvc-g++
RANLIB ?= i586-mingw32msvc-ranlib
else
ifdef CROSS_TARGET
CC = $(CROSS_TARGET)gcc
CCPP = $(CROSS_TARGET)g++
AR = $(CROSS_TARGET)ar
RANLIB = $(CROSS_TARGET)ranlib
LD = $(CROSS_TARGET)ld
else
ifdef UCLINUX
CC = $(CROSS_COMPILE_APPS)gcc
CCPP = $(CROSS_COMPILE_APPS)g++
AR = $(CROSS_COMPILE_APPS)ar
RANLIB = $(CROSS_COMPILE_APPS)ranlib
LD = $(CROSS_COMPILE_APPS)ld
else
ifdef PACKAGE_BUILD
CC ?= gcc
CCPP ?= g++
else
ifdef GPROFILE
CC ?= gcc
CCPP ?= g++
else
ifdef CLANG
CC ?= clang
else
CC ?= gcc
CCPP ?= g++
endif # CLANG
endif # GPROFILE
endif # PACKAGE_BUILD
endif # UCLINUX
endif # CROSS_TARGET
endif # WINDOWS
# use this version if C++ is supported
# LINK ?= $(CCPP)
# use this version if C is supported
LINK ?= $(CC)
AR ?= $(CROSS_TARGET)ar
RANLIB ?= $(CROSS_TARGET)ranlib
LINT=splint
LINTFLAGS= '-weak -macrovarprefix "m_"'
##LIBFLAGS=-lsocket
#LFLAGS=-v --no-as-needed
LFLAGS=-lm
LPATH=$(USER_LIB) -L$(LIB_INST)
CEES = $(wildcard *.c)
HEES = $(wildcard *.h)
################ OBJS RULE #############
OBJS = $(patsubst %.c,$(TARGET)/%.o,$(CEES))
################ DEPS RULE #############
DEPS = $(patsubst %.c,%.D,$(wildcard *.c))
######################## PLATFORM DEFINITIONS #############
PLATFORM_CPP=
######################### MAKE DEPENDENCIES ###############
COMPILE.c= $(CC) $(CFLAGS) $(CPPFLAGS) $(PLATFORM_CPP) \
$(CINC) $(SUBDIR_CPP) $(TARGET_ARCH) -c
$(TARGET)/%.o: %.c
$(CC) $(CFLAGS) $(CPPFLAGS) $(PLATFORM_CPP) \
$(CINC) $(SUBDIR_CPP) $(TARGET_ARCH) -c -o $@ $<
# Common library rule
$(LIB_INST)/lib%.a: $(OBJS)
$(AR) cr $@ $(OBJS)
$(RANLIB) $@
# dependency rule to make temp .D files from .c sources
# all the .D files are collected and appended to the
# appropriate Makefile when 'make depend' is run
# this rule is kept here to make sure it matches COMPILE.c
%.D: %.c
$(CC) -MM -MG -MT $(TARGET)/$(patsubst %.c,%.o,$<) \
-Wall -Wcomment $(CPPFLAGS) $(PLATFORM_CPP) $(CINC) \
$(SUBDIR_CPP) $(TARGET_ARCH) -c $< > $@
################## MAKE DEPENDENCIES #####################
# following depend rule is the GNU version! Other versions TBD
depend: dependencies
dependencies: $(DEPS)
@if [ ! -f Makefile ]; then \
echo "Error: Makefile missing!"; \
exit 1; \
fi
@rm -f dependencies
@for i in $(DEPS); do \
if [ -f $$i ] ; then \
(cat $$i >> dependencies; echo "" >> dependencies) ; \
else \
(echo "*** Warning: Dependency file $i.D is missing! (Skipping...) ***"; \
echo "# Warning: Missing file $$i !!!") ; \
fi; \
done
@echo "" >> dependencies
# delete the .D files to force make depend to rebuild them each time
# that target is built
# @rm -f $(DEPS)
test:
install:
mkdir -p $(REAL_INST)
install $(LIB_INST)/lib$(SUBDIR_NM).$(LIBSUFFIX) $(REAL_INST)
uninstall:
rm -f $(REAL_INST)/lib$(SUBDIR_NM).$(LIBSUFFIX)
work:
ifdef YUMAPRO_HOME
mkdir -p $(WORK_INST)
install $(LIB_INST)/lib$(SUBDIR_NM).$(LIBSUFFIX) $(WORK_INST)
endif
sil_lib: $(LIB_INST)/lib$(SUBDIR_NM).$(LIBSUFFIX)
# this dummy rule keeps make from deleting the $(OBJS) as
# intermediate files
sil_dummy: dependencies $(OBJS)
clean:
rm -f $(OBJS) $(LIB_INST)/lib$(SUBDIR_NM).*
superclean:
rm -f *~ $(DEPS) dependencies $(OBJS) $(LIB_INST)/lib$(SUBDIR_NM).*
rm -rf ../output/*
ifndef MAC
$(LIB_INST)/lib$(SUBDIR_NM).so: $(OBJS)
$(LINK) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -shared -rdynamic -Wl,-soname,lib$(SUBDIR_NM).so -o $@ $(OBJS)
else
ifdef COVERITY
$(LIB_INST)/lib$(SUBDIR_NM).so: $(OBJS)
$(LINK) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -shared -rdynamic -Wl,-soname,lib$(SUBDIR_NM).so -o $@ $(OBJS)
else
$(LIB_INST)/lib$(SUBDIR_NM).so: $(OBJS)
$(LINK) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -shared -bundle -std=gnu99 \
-current_version 1.0 -undefined dynamic_lookup \
-o $@ -install_name lib$(SUBDIR_NM).so $(OBJS)
endif # COVERITY
endif # MAC
code:
yangdump-sdk format=h $(YDPARMS) output=$(SUBDIR_NM).h
yangdump-sdk format=c $(YDPARMS) output=$(SUBDIR_NM).c
splitcode:
yangdump-sdk format=yh $(YDPARMS) output=y_$(SUBDIR_NM).h
yangdump-sdk format=yc $(YDPARMS) output=y_$(SUBDIR_NM).c
yangdump-sdk format=uh $(YDPARMS) output=u_$(SUBDIR_NM).h
yangdump-sdk format=uc $(YDPARMS) output=u_$(SUBDIR_NM).c
.PHONY: all superclean clean test install uninstall \
distclean depend lint code splitcode work sil_lib sil_dummy
# prevent the make program from choking on all the symbols
# that get generated from autogenerated make rules
.NOEXPORT:
include dependencies
t60/src/y_t60.h 0000664 0001750 0001750 00000005221 14104006747 012045 0 ustar andy andy
#ifndef _H_y_t60
#define _H_y_t60
/*
* Copyright (c) 2008 - 2012, Andy Bierman, All Rights Reserved.
* Copyright (c) 2012 - 2021, YumaWorks, Inc., All Rights Reserved.
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
/**
* @file y_t60.h
* @brief YumaPro SIL header for module t60
*
*** Generated by yangdump-sdk tomcat-integ-2021-08-07.18.36
YumaPro SIL header
module t60
revision 2021-08-08
prefix t
namespace http://netconfcentral.org/ns/t60
Created: 2021-08-08T17:01:27Z
CLI parameters:
format yh
indent 4
module t60
output y_t60.h
sil-get2
unified true
*/
#include
#include "procdefs.h"
#include "dlq.h"
#include "ncxtypes.h"
#include "op.h"
#include "status.h"
#include "val.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @addtogroup yang-library YANG Library
*
* Collection of modules supported by the server.
* Generated by yangdump-sdk.
*/
/**
* @addtogroup sil-t60 Module t60
* @ingroup yang-library
*
* @{
*
* YANG instrumentation library.
* Generated by yangdump-sdk.
*/
#define y_t_M_t (const xmlChar *)"t60"
#define y_t_R_t (const xmlChar *)"2021-08-08"
#define y_t_N_A (const xmlChar *)"A"
#define y_t_N_a (const xmlChar *)"a"
#define y_t_N_b (const xmlChar *)"b"
#define y_t_N_c (const xmlChar *)"c"
#define y_t_N_d (const xmlChar *)"d"
#define y_t_N_top (const xmlChar *)"top"
/**
* @brief Phase 1: Initialize the t60 server instrumentation library.
*
* Called by server when module is loaded.
*
* @param modname requested module name to load
* @param revision requested revision date of the module to load.
* This may be NULL if the module has no revision statements.
* @return return status. An error will cause the module load to fail.
*/
extern status_t y_t60_init (
const xmlChar *modname,
const xmlChar *revision);
/**
* @brief Phase 2: Initialize the t60 server instrumentation library.
*
* SIL init phase 2: non-config data structures.
* Called after running config is loaded.
*
* @return return status. An error will cause the
* server initialization to fail.
*/
extern status_t y_t60_init2 (void);
/**
* @brief Cleanup the t60 server instrumentation library.
*
* Called by server when module is unloaded.
*
*/
extern void y_t60_cleanup (void);
/** @} */
#ifdef __cplusplus
} /* end extern 'C' */
#endif
#endif
t60/bin/ 0000775 0001750 0001750 00000000000 14122253526 010713 5 ustar andy andy t60/lib/ 0000775 0001750 0001750 00000000000 14122253526 010711 5 ustar andy andy t60/Makefile 0000664 0001750 0001750 00000003244 14104006746 011606 0 ustar andy andy # Makefile for SIL library top directory
#
# very top SIL directory
##################### LIBRARIES ########################
#
# DIRS:
# This is an ordered list
# Put only the directories that build object files in the list
# make all targets
DIRS = src
#################### PLATFORM DEFINITIONS ############
all: silall
################################ MAKE RULES #################################
#
clean: silclean
superclean: silsuperclean
distclean: sildistclean
install: silinstall
uninstall: siluninstall
doc:
DOXY_UTIL=/usr/share/yumapro/util doxygen /usr/share/yumapro/util/Doxyfile.sil
@echo ""
@echo "Documentation created in $(PWD)/output directory"
@echo "file://$(PWD)/output/html/index.html"
@echo ""
@echo "Run 'make opendoc' to open the doxygen documentation in the default browser"
opendoc:
xdg-open file://$(PWD)/output/html/index.html
silall:
for dir in $(DIRS); do\
cd $$dir && $(MAKE) && cd ..;\
done
silclean:
for dir in $(DIRS); do\
cd $$dir && $(MAKE) clean && cd ..;\
done
silsuperclean:
for dir in $(DIRS); do\
cd $$dir && $(MAKE) superclean && cd ..;\
done
sildistclean:
for dir in $(DIRS); do\
cd $$dir && $(MAKE) distclean && cd ..;\
done
silinstall:
for dir in $(DIRS); do\
cd $$dir && $(MAKE) install && cd ..;\
done
siluninstall:
for dir in $(DIRS); do\
cd $$dir && $(MAKE) uninstall && cd ..;\
done
.PHONY: all clean superclean install distclean sildistclean \
silall silclean silsuperclean silinstall siluninstall doc opendoc
# prevent the make program from choking on all the symbols
# that get generated from autogenerated make rules
.NOEXPORT:
t60/t60.yang 0000664 0001750 0001750 00000000542 14122227335 011434 0 ustar andy andy module t60 {
yang-version 1.1;
namespace "http://netconfcentral.org/ns/t60";
prefix "t";
revision 2021-08-08;
container top {
config false;
list A {
key "a b c";
leaf a { type uint8; }
leaf b { type uint8; }
leaf c { type uint8; }
leaf d { type string; }
}
}
}