summaryrefslogtreecommitdiff
path: root/cleopatre/application/spidnetsnmp/agent/mibgroup/spc300-eoc-mib/spc300EoCSlaveGroup/spc300EoCOnlineSlaveGroup/spc300EoCOnlineSlaveSNRTable/spc300EoCOnlineSlaveSNRTable_data_get.c
blob: ebf044063ad1b2eae72eedfb25b4ee6f22fe479b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
/*
 * Note: this file originally auto-generated by mib2c using
 *       version : 12088 $ of $
 *
 * $Id:$
 */
/*
 * standard Net-SNMP includes
 */
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>

/*
 * include our parent header
 */
#include "spc300EoCOnlineSlaveSNRTable.h"


/** @defgroup data_get data_get: Routines to get data
 *
 * TODO:230:M: Implement spc300EoCOnlineSlaveSNRTable get routines.
 * TODO:240:M: Implement spc300EoCOnlineSlaveSNRTable mapping routines (if any).
 *
 * These routine are used to get the value for individual objects. The
 * row context is passed, along with a pointer to the memory where the
 * value should be copied.
 *
 * @{
 */
/**********************************************************************
 **********************************************************************
 ***
 *** Table spc300EoCOnlineSlaveSNRTable
 ***
 **********************************************************************
 **********************************************************************/
/*
 * SPC300EOC-MIB::spc300EoCOnlineSlaveSNRTable is subid 2 of spc300EoCOnlineSlaveGroup.
 * Its status is Current.
 * OID: .1.3.6.1.4.1.22764.3.2.2.3.2, length: 12
 */

/*
 * ---------------------------------------------------------------------
 * * TODO:200:r: Implement spc300EoCOnlineSlaveSNRTable data context functions.
 */


/**
 * set mib index(es)
 *
 * @param tbl_idx mib index structure
 * @param modEoCOnlineCNUMasterIndex_val
 * @param modEoCOnlineCNUIndex_val
 * @param spc300EoCOnlineSlaveSNRGroupIndex_val
 *
 * @retval MFD_SUCCESS     : success.
 * @retval MFD_ERROR       : other error.
 *
 * @remark
 *  This convenience function is useful for setting all the MIB index
 *  components with a single function call. It is assume that the C values
 *  have already been mapped from their native/rawformat to the MIB format.
 */
int
spc300EoCOnlineSlaveSNRTable_indexes_set_tbl_idx
    (spc300EoCOnlineSlaveSNRTable_mib_index * tbl_idx,
     long modEoCOnlineCNUMasterIndex_val, long modEoCOnlineCNUIndex_val,
     long spc300EoCOnlineSlaveSNRGroupIndex_val)
{
    DEBUGMSGTL(("verbose:spc300EoCOnlineSlaveSNRTable:spc300EoCOnlineSlaveSNRTable_indexes_set_tbl_idx", "called\n"));

    /*
     * modEoCOnlineCNUMasterIndex(1)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/R/d/h
     */
    tbl_idx->modEoCOnlineCNUMasterIndex = modEoCOnlineCNUMasterIndex_val;

    /*
     * modEoCOnlineCNUIndex(2)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/R/d/h
     */
    tbl_idx->modEoCOnlineCNUIndex = modEoCOnlineCNUIndex_val;

    /*
     * spc300EoCOnlineSlaveSNRGroupIndex(1)/INTEGER32/ASN_INTEGER/long(long)//l/a/w/e/R/d/h
     */
    tbl_idx->spc300EoCOnlineSlaveSNRGroupIndex =
        spc300EoCOnlineSlaveSNRGroupIndex_val;


    return MFD_SUCCESS;
}                               /* spc300EoCOnlineSlaveSNRTable_indexes_set_tbl_idx */

/**
 * @internal
 * set row context indexes
 *
 * @param reqreq_ctx the row context that needs updated indexes
 *
 * @retval MFD_SUCCESS     : success.
 * @retval MFD_ERROR       : other error.
 *
 * @remark
 *  This function sets the mib indexs, then updates the oid indexs
 *  from the mib index.
 */
int
spc300EoCOnlineSlaveSNRTable_indexes_set
    (spc300EoCOnlineSlaveSNRTable_rowreq_ctx * rowreq_ctx,
     long modEoCOnlineCNUMasterIndex_val, long modEoCOnlineCNUIndex_val,
     long spc300EoCOnlineSlaveSNRGroupIndex_val)
{
    DEBUGMSGTL(("verbose:spc300EoCOnlineSlaveSNRTable:spc300EoCOnlineSlaveSNRTable_indexes_set", "called\n"));

    if (MFD_SUCCESS !=
        spc300EoCOnlineSlaveSNRTable_indexes_set_tbl_idx(&rowreq_ctx->
                                                         tbl_idx,
                                                         modEoCOnlineCNUMasterIndex_val,
                                                         modEoCOnlineCNUIndex_val,
                                                         spc300EoCOnlineSlaveSNRGroupIndex_val))
        return MFD_ERROR;

    /*
     * convert mib index to oid index
     */
    rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid);
    if (0 !=
        spc300EoCOnlineSlaveSNRTable_index_to_oid(&rowreq_ctx->oid_idx,
                                                  &rowreq_ctx->tbl_idx)) {
        return MFD_ERROR;
    }

    return MFD_SUCCESS;
}                               /* spc300EoCOnlineSlaveSNRTable_indexes_set */


/*---------------------------------------------------------------------
 * SPC300EOC-MIB::spc300EoCOnlineSlaveSNREntry.spc300EoCOnlineSlaveSNRGroupData
 * spc300EoCOnlineSlaveSNRGroupData is subid 2 of spc300EoCOnlineSlaveSNREntry.
 * Its status is Current, and its access level is ReadOnly.
 * OID: .1.3.6.1.4.1.22764.3.2.2.3.2.1.2
 * Description:
Values for SNR given for each carrier in current carrier group
 *
 * Attributes:
 *   accessible 1     isscalar 0     enums  0      hasdefval 0
 *   readable   1     iscolumn 1     ranges 0      hashint   0
 *   settable   0
 *
 *
 * Its syntax is OCTETSTR (based on perltype OCTETSTR)
 * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char)
 * This data type requires a length.
 */
/**
 * Extract the current value of the spc300EoCOnlineSlaveSNRGroupData data.
 *
 * Set a value using the data context for the row.
 *
 * @param rowreq_ctx
 *        Pointer to the row request context.
 * @param spc300EoCOnlineSlaveSNRGroupData_val_ptr_ptr
 *        Pointer to storage for a char variable
 * @param spc300EoCOnlineSlaveSNRGroupData_val_ptr_len_ptr
 *        Pointer to a size_t. On entry, it will contain the size (in bytes)
 *        pointed to by spc300EoCOnlineSlaveSNRGroupData.
 *        On exit, this value should contain the data size (in bytes).
 *
 * @retval MFD_SUCCESS         : success
 * @retval MFD_SKIP            : skip this node (no value for now)
 * @retval MFD_ERROR           : Any other error
*
 * @note If you need more than (*spc300EoCOnlineSlaveSNRGroupData_val_ptr_len_ptr) bytes of memory,
 *       allocate it using malloc() and update spc300EoCOnlineSlaveSNRGroupData_val_ptr_ptr.
 *       <b>DO NOT</b> free the previous pointer.
 *       The MFD helper will release the memory you allocate.
 *
 * @remark If you call this function yourself, you are responsible
 *         for checking if the pointer changed, and freeing any
 *         previously allocated memory. (Not necessary if you pass
 *         in a pointer to static memory, obviously.)
 */
int
spc300EoCOnlineSlaveSNRGroupData_get
    (spc300EoCOnlineSlaveSNRTable_rowreq_ctx * rowreq_ctx,
     char **spc300EoCOnlineSlaveSNRGroupData_val_ptr_ptr,
     size_t *spc300EoCOnlineSlaveSNRGroupData_val_ptr_len_ptr)
{
   /** we should have a non-NULL pointer and enough storage */
    netsnmp_assert((NULL != spc300EoCOnlineSlaveSNRGroupData_val_ptr_ptr)
                   && (NULL !=
                       *spc300EoCOnlineSlaveSNRGroupData_val_ptr_ptr));
    netsnmp_assert(NULL !=
                   spc300EoCOnlineSlaveSNRGroupData_val_ptr_len_ptr);


    DEBUGMSGTL(("verbose:spc300EoCOnlineSlaveSNRTable:spc300EoCOnlineSlaveSNRGroupData_get", "called\n"));

    netsnmp_assert(NULL != rowreq_ctx);

    /*
     * TODO:231:o: |-> Extract the current value of the spc300EoCOnlineSlaveSNRGroupData data.
     * copy (* spc300EoCOnlineSlaveSNRGroupData_val_ptr_ptr ) data and (* spc300EoCOnlineSlaveSNRGroupData_val_ptr_len_ptr ) from rowreq_ctx->data
     */
    /*
     * make sure there is enough space for spc300EoCOnlineSlaveSNRGroupData data
     */
    if ((NULL == (*spc300EoCOnlineSlaveSNRGroupData_val_ptr_ptr)) ||
        ((*spc300EoCOnlineSlaveSNRGroupData_val_ptr_len_ptr) <
         (rowreq_ctx->data.spc300EoCOnlineSlaveSNRGroupData_len *
          sizeof(rowreq_ctx->data.spc300EoCOnlineSlaveSNRGroupData[0])))) {
        /*
         * allocate space for spc300EoCOnlineSlaveSNRGroupData data
         */
        (*spc300EoCOnlineSlaveSNRGroupData_val_ptr_ptr) =
            malloc(rowreq_ctx->data.spc300EoCOnlineSlaveSNRGroupData_len *
                   sizeof(rowreq_ctx->data.
                          spc300EoCOnlineSlaveSNRGroupData[0]));
        if (NULL == (*spc300EoCOnlineSlaveSNRGroupData_val_ptr_ptr)) {
            snmp_log(LOG_ERR, "could not allocate memory\n");
            return MFD_ERROR;
        }
    }
    (*spc300EoCOnlineSlaveSNRGroupData_val_ptr_len_ptr) =
        rowreq_ctx->data.spc300EoCOnlineSlaveSNRGroupData_len *
        sizeof(rowreq_ctx->data.spc300EoCOnlineSlaveSNRGroupData[0]);
    memcpy((*spc300EoCOnlineSlaveSNRGroupData_val_ptr_ptr),
           rowreq_ctx->data.spc300EoCOnlineSlaveSNRGroupData,
           rowreq_ctx->data.spc300EoCOnlineSlaveSNRGroupData_len *
           sizeof(rowreq_ctx->data.spc300EoCOnlineSlaveSNRGroupData[0]));

    return MFD_SUCCESS;
}                               /* spc300EoCOnlineSlaveSNRGroupData_get */



/** @} */