and added files
[bcm963xx.git] / userapps / opensource / net-snmp / agent / mibgroup / mibII / atm / atmMibHelper.c
1 /****************************************************************************
2 *
3 *     Copyright (c) 2001 Broadcom Corporation
4 *           All Rights Reserved
5 *
6 *     No portions of this material may be reproduced in any form without the
7 *     written permission of:
8 *
9 *           Broadcom Corporation
10 *           16251 Laguna Canyon Road
11 *           Irvine, California  92618
12 *
13 *     All information contained in this document is Broadcom Corporation
14 *     company private, proprietary, and trade secret.
15 *
16 *****************************************************************************/
17 /**
18 *
19 *  @file    atmMibHelper.c
20 *
21 *  @brief   Helper functions for the ATM MIB
22 *
23 ****************************************************************************/
24
25 /* ---- Include Files ---------------------------------------------------- */
26
27 #include <stddef.h>
28 #include <stdio.h>
29 #include <stdlib.h>
30
31 #include <net-snmp/net-snmp-config.h>
32 #include <net-snmp/net-snmp-includes.h>
33 #include <net-snmp/agent/net-snmp-agent-includes.h>
34 #include <net-snmp/agent/auto_nlist.h>
35
36 #include "../interfaces.h"
37 #include "atmMibHelper.h"
38 #include "atmMibDefs.h"
39
40 #include <bcmtypes.h>
41 #include <bcmatmapi.h>
42 #include <atmapidrv.h>
43
44 #ifdef BUILD_SNMP_ATM_MIB
45
46 /* ---- Public Variables ------------------------------------------------- */
47 /* ---- Private Constants and Types -------------------------------------- */
48
49 #define ATMMIB_STATUS_OK         0
50 #define ATMMIB_STATUS_ERR        1
51
52 /* ---- Private Variables ------------------------------------------------ */
53
54 static oid defAtmTrafficDescriptor[ATM_TRAFDESC_OIDLEN]  = { 1, 3, 6, 1, 2, 1, 37, 1, 1, 2 }   ;
55
56 /* ---- Private Function Prototypes -------------------------------------- */
57 static int     getConfVccCount( void );
58 static void    trafDescCopyDriverData( ATM_TRAFDESC_TABLE* tableRow, ATM_TRAFFIC_DESCR_PARM_ENTRY* driverTableRow );
59 static void    trafDescSetDefValues( ATM_TRAFDESC_TABLE* tableRow );
60 static void    trafDescMapType( ATM_TRAFDESC_TABLE* tableRow, ATM_TRAFFIC_DESCR_PARM_ENTRY* driverTableRow );
61 static void    vclCopyDriverData( ATM_VCL_TABLE* tableRow, PATM_VCC_ADDR pAddrs, ATM_VCC_CFG* vccCfg );
62 static void    aal5vccCopyDriverData( AAL5_VCC_TABLE* tableRow, PATM_VCC_ADDR pAddrs, ATM_VCC_STATS* stats );
63 static void    aal5vccSetDefValues( AAL5_VCC_TABLE* tableRow );
64 static void    vclSetDefValues( ATM_VCL_TABLE* tableRow );
65 static int     mapAalType( UINT32 driverAalType );
66
67 /* ---- Functions -------------------------------------------------------- */
68 int     getVccAddrs( int numAddrs, PATM_VCC_ADDR pAddrs );
69 int     getAal5CpcsIfIndex( void );
70 int     getAtmCellIfIndex( void );
71
72 #ifdef ATMIFCONFTBL
73 /* Fill out the ATM interface configuration table */
74 void  atmMibHelper_fillAtmIfConfTable( ATM_INTERFACE_CONF_TABLE* pTable )
75 {
76    /* Assuming only one ATM interface (ATM_INTERFACE_COUNT = 1) */
77
78    ATM_INTERFACE_CONF_TABLE* p = pTable;
79
80    p->pTableBeginning = pTable;
81    p->ifIndex = getAtmCellIfIndex();
82
83    p->atmInterfaceMaxVpcs                           = ATM_INTF_MAX_VPCS;
84    p->atmInterfaceMaxVccs                           = ATM_INTF_MAX_VCCS;
85    p->atmInterfaceConfVpcs                          = ATM_INTF_CONF_VPCS;
86    p->atmInterfaceConfVccs                          = getConfVccCount();
87    p->atmInterfaceMaxActiveVpiBits                  = ATM_INTF_MAX_ACTIVE_VPI_BITS;
88    p->atmInterfaceMaxActiveVciBits                  = ATM_INTF_MAX_ACTIVE_VCI_BITS;
89    p->atmInterfaceIlmiVpi                           = ATM_INTF_ILMI_VPI;
90 #ifdef BUILD_SNMP_AUTOCONFIG
91    p->atmInterfaceIlmiVci                           = ATM_INTF_ILMI_VCI;
92 #else
93    p->atmInterfaceIlmiVci                           = ATM_INTF_ILMI_VCI_UNSUPPORTED;
94 #endif
95    p->atmInterfaceAddressType                       = ATM_INTF_ADDRTYPE_OTHER;
96    strncpy( p->atmInterfaceAdminAddress, "", strlen("") );
97    strncpy( p->atmInterfaceMyNeighborIpAddress, "", strlen("") );
98    strncpy( p->atmInterfaceMyNeighborIfName, "", strlen("") );
99    p->atmInterfaceCurrentMaxVpiBits                 = ATM_INTF_CURRENT_MAX_VPI_BITS;
100    p->atmInterfaceCurrentMaxVciBits                 = ATM_INTF_CURRENT_MAX_VCI_BITS;
101    strncpy( p->atmInterfaceSubscrAddress, "", strlen("") );
102
103    p->next = NULL;
104 }
105 #endif /* ATMIFCONFTBL */
106
107
108 #ifdef ATMIFTCTBL
109 /* Fill out the ATM interface TC table */
110 void  atmMibHelper_fillAtmIfTCTable( ATM_INTERFACE_TC_TABLE* pTable )
111 {
112    /* Assuming only one ATM interface (ATM_INTERFACE_COUNT = 1) */
113
114    ATM_INTERFACE_TC_TABLE* p = pTable;
115    p->pTableBeginning = pTable;
116    p->ifIndex = getAtmCellIfIndex();
117
118    p->atmInterfaceOCDEvents      = ATM_INTF_TC_OCD             ;
119    p->atmInterfaceTCAlarmState   = ATM_INTF_TC_ALMST_NOALARM   ;
120
121    p->next = NULL;
122 }
123 #endif /* ATMIFTCTBL */
124
125
126 #ifdef ATMTRAFFDESCTBL
127 /* Fill out the ATM interface traffic descriptor table */
128 int   atmMibHelper_fillAtmTrafDescTable( ATM_TRAFDESC_TABLE* pTable )
129 {
130    ATM_TRAFDESC_TABLE* p = pTable;
131    int nRet = 0;
132    int i;
133    UINT32 ulTdtSize = 0;
134    int errStatus = ATMMIB_STATUS_ERR;
135    ATM_TRAFFIC_DESCR_PARM_ENTRY* pTdt = NULL;
136    ATM_TRAFFIC_DESCR_PARM_ENTRY* pTdte = NULL;
137
138    /* Small portion taken from TdteHandler and TdteHandlerShow in atmctl.c */
139    BcmAtm_GetTrafficDescrTableSize( &ulTdtSize );
140    pTdt = (PATM_TRAFFIC_DESCR_PARM_ENTRY) malloc( ulTdtSize * sizeof(ATM_TRAFFIC_DESCR_PARM_ENTRY) );
141    if( pTdt )
142    {
143       pTdt->ulStructureId = ID_ATM_TRAFFIC_DESCR_PARM_ENTRY;
144       nRet = (int) BcmAtm_GetTrafficDescrTable( pTdt, ulTdtSize );
145       if( nRet == 0 )
146       {
147          pTdte = pTdt;
148          for ( i = 1; i <= ulTdtSize; i++, pTdte++ )
149          {
150             p->pTableBeginning = pTable;
151             trafDescCopyDriverData( p, pTdte );
152             if ( i == ulTdtSize )
153             {
154                /* the last row */
155                p->next = NULL;
156                errStatus = ATMMIB_STATUS_OK;
157             }
158             else
159             {
160             p->next  = (p+1);
161             p++;
162          }
163          }
164       }
165       else
166       {
167          ATMMIBLOG_ERROR(("atmMibHelper_fillAtmTrafDescTable: Could not get traffic description table"));
168       }
169    }
170    else
171    {
172       ATMMIBLOG_ERROR(("atmMibHelper_fillAtmTrafDescTable: Could not allocate memory for the traffic description table"));
173    }
174
175    free( pTdt );
176
177    return( errStatus );
178 }
179 #endif /* ATMTRAFFDESCTBL */
180
181 #ifdef ATMVCLTBL
182 /* Fill out the ATM VCL table */
183 int atmMibHelper_fillAtmVclTable( ATM_VCL_TABLE* pTable )
184 {
185    /* Assuming only one ATM interface (ATM_INTERFACE_COUNT = 1) */
186
187    int errStatus = ATMMIB_STATUS_ERR;
188    int nRet = 0;
189    PATM_VCC_ADDR pAddrs = NULL;
190    ATM_VCL_TABLE* p = pTable;
191    int vccCount = 0;
192    ATM_VCC_CFG Cfg;
193    int i;
194    PATM_VCC_ADDR freePointer;
195
196    vccCount = getConfVccCount();
197
198    if ( vccCount > 0 )
199    {
200       /* Allocate memory for an ATM_VCC_ADDR stuct for each configured VCC. */
201       pAddrs = (PATM_VCC_ADDR)malloc( vccCount * (sizeof(ATM_VCC_ADDR) + sizeof(UINT8)) );
202       freePointer = pAddrs;
203       if ( pAddrs )
204       {
205          if ( getVccAddrs( vccCount, pAddrs ) == 0 )
206          {
207             for ( i = 1; i <= vccCount; i++, pAddrs++ )
208             {
209                memset( &Cfg, 0x00, sizeof(Cfg) );
210                Cfg.ulStructureId = ID_ATM_VCC_CFG;
211
212                nRet = (int) BcmAtm_GetVccCfg( pAddrs, &Cfg );
213                if ( nRet == 0 )
214                {
215                   p->pTableBeginning = pTable;
216                   p->ifIndex = getAtmCellIfIndex();
217                             vclCopyDriverData( p, pAddrs, &Cfg );
218                   if ( i == vccCount )
219                   {
220                      /* the last row */
221                      p->next = NULL;
222                      errStatus = ATMMIB_STATUS_OK;
223                   }
224                   else
225                   {
226                   p->next = (p+1);
227                   p++;
228                }
229                }
230                else
231                {
232                   ATMMIBLOG_ERROR(("atmMibHelper_fillAtmVclTable: Could not get VCC configuration"));
233                   break;
234                }
235             }
236       }
237       else
238       {
239             ATMMIBLOG_ERROR(("atmMibHelper_fillAtmVclTable: Could not get VCC address"));
240    }
241
242       free( freePointer );
243    }
244    else
245    {
246          ATMMIBLOG_ERROR(("atmMibHelper_fillAtmVclTable: Could not allocate memory"));
247    }
248 }
249
250    return( errStatus );
251 }
252 #endif /* ATMVCLTBL */
253
254
255 #ifdef AAL5VCCTBL
256 /* Fill out the AAL5 VCC table */
257 int atmMibHelper_fillAal5VccTable( AAL5_VCC_TABLE* pTable )
258 {
259    /* Assuming only one AAL5 CPCS interface */
260
261    int errStatus = ATMMIB_STATUS_ERR;
262    int nRet = 0;
263    PATM_VCC_ADDR pAddrs = NULL;
264    AAL5_VCC_TABLE* p = pTable;
265    int vccCount = 0;
266    ATM_VCC_STATS Stats;
267    int i;
268    PATM_VCC_ADDR freePointer;
269
270
271    vccCount = getConfVccCount();
272
273    if ( vccCount > 0 )
274    {
275       /* Allocate memory for an ATM_VCC_ADDR stuct for each configured VCC. */
276       pAddrs = (PATM_VCC_ADDR)malloc( vccCount * (sizeof(ATM_VCC_ADDR) + sizeof(UINT8)) );
277       freePointer = pAddrs;
278       if ( pAddrs )
279       {
280          if ( getVccAddrs( vccCount, pAddrs ) == 0 )
281          {
282             for ( i = 1; i <= vccCount; i++, pAddrs++ )
283             {
284                memset( &Stats, 0x00, sizeof(Stats) );
285                Stats.ulStructureId = ID_ATM_VCC_STATS;
286
287                nRet = (int) BcmAtm_GetVccStatistics( pAddrs, &Stats, 0 );
288                if ( nRet == 0 )
289                {
290                   p->pTableBeginning = pTable;
291                   p->aal5ifIndex = getAal5CpcsIfIndex();
292                             aal5vccCopyDriverData( p, pAddrs, &Stats );
293                   if ( i == vccCount )
294                   {
295                      /* The last row */
296                      p->next = NULL;
297                      errStatus = ATMMIB_STATUS_OK;
298                   }
299                   else
300                   {
301                   p->next = (p+1);
302                   p++;
303                }
304                }
305                else
306                {
307                   ATMMIBLOG_ERROR(("atmMibHelper_fillAal5VccTable: Could not get AAL5 VCC statistics"));
308                   break;
309                }
310             }
311          }
312          else
313          {
314             ATMMIBLOG_ERROR(("atmMibHelper_fillAtmVclTable: Could not get VCC address"));
315       }
316
317       free( freePointer );
318    }
319    else
320    {
321          ATMMIBLOG_ERROR(("atmMibHelper_fillAtmVclTable: Could not allocate memory"));
322       }
323    }
324
325    return( errStatus );
326 }
327 #endif /* AAL5VCCTBL */
328
329 /* Get the number of traffic indexes */
330 int atmMibHelper_getTrafDescIndexCount( void )
331 {
332    int ulTdtSize = 0;
333
334    BcmAtm_GetTrafficDescrTableSize( (UINT32*)&ulTdtSize );
335
336    return( ulTdtSize );
337 }
338
339
340 /* Get the number of ATM interfaces */
341 int atmMibHelper_getAtmIfCount( void )
342 {
343 #if ( ATM_INTERFACE_COUNT != 1 )
344 #error Currently only one ATM interface supported by the ATM MIB
345 #endif
346    return( ATM_INTERFACE_COUNT );
347 }
348
349
350 int atmMibHelper_getTotalVccCount( void )
351 {
352    return ( getConfVccCount() );
353 }
354
355 /* Get the (first) ATM cell interface index */
356 int getAtmCellIfIndex( void )
357 {
358    /* This should be the index for the ATM cell layer in the ifTable */
359    return( Interface_Index_By_Name(ATM_CELL_LAYER_IFNAME, strlen(ATM_CELL_LAYER_IFNAME)) );
360 }
361
362 /* Get the (first) AAL5 CPCS interface index */
363 int getAal5CpcsIfIndex( void )
364 {
365    /* This should be the index for the AAL5 CPCS layer in the ifTable */
366    return( Interface_Index_By_Name(AAL5_CPCS_LAYER_IFNAME, strlen(AAL5_CPCS_LAYER_IFNAME)) );
367 }
368
369 /* Get the number of configured VCCs */
370 int getConfVccCount( void )
371 {
372    UINT32 ulNumAddrs = 0;
373    UINT32 ulInterfaceId = 0;
374    UINT32 ulAddrsReturned = 0;
375    UINT32 i = 0;
376
377    /* Small portion taken from GetVccAddrsToUse in atmctl.c */
378    for( i = 0; i < PHY_NUM_PORTS; i++ )
379    {
380       ulInterfaceId = (UINT32) i;
381       BcmAtm_GetInterfaceId( (UINT8) i, &ulInterfaceId );
382       BcmAtm_GetVccAddrs( ulInterfaceId, NULL, 0, &ulAddrsReturned );
383       ulNumAddrs += ulAddrsReturned;
384    }
385
386    return( ulNumAddrs );
387 }
388
389
390 #ifdef ATMTRAFFDESCTBL
391 /* Map the traffic descriptor type from a value provided by the ATM driver (0-15)
392 ** to a oid value for the traffic descriptor type (e.g. { 1, 3, 6, 1, 2, 1, 37, 1, 1, 2 } ) */
393 void trafDescMapType( ATM_TRAFDESC_TABLE* tableRow, ATM_TRAFFIC_DESCR_PARM_ENTRY* driverTableRow )
394 {
395    /* Set the default traffic descriptor */
396    memcpy(  tableRow->atmTrafficDescrType, defAtmTrafficDescriptor, sizeof(defAtmTrafficDescriptor) );
397
398    /* The ATM driver returns values from 1 to 15 for the traffic descriptor type.
399    ** Modify only the last entry in the oid array. */
400    tableRow->atmTrafficDescrType[ATM_TRAFDESC_OIDLEN-1] = driverTableRow->ulTrafficDescrType;
401 }
402
403 /* Copy the data from the driver table to the ATM traffic descriptor table */
404 void trafDescCopyDriverData( ATM_TRAFDESC_TABLE* tableRow, ATM_TRAFFIC_DESCR_PARM_ENTRY* driverTableRow )
405 {
406    /* First, set the default values */
407    trafDescSetDefValues( tableRow );
408
409    /* Change only the values that can be obtained from the ATM driver.
410    ** Don't change the other values (i.e. keep the defaults) */
411    tableRow->atmTrafficDescrParamIndex = driverTableRow->ulTrafficDescrIndex;
412    trafDescMapType( tableRow, driverTableRow );
413    tableRow->atmTrafficDescrParam1   = driverTableRow->ulTrafficDescrParm1;
414    tableRow->atmTrafficDescrParam2   = driverTableRow->ulTrafficDescrParm2;
415    tableRow->atmTrafficDescrParam3   = driverTableRow->ulTrafficDescrParm3;
416    tableRow->atmTrafficDescrParam4   = driverTableRow->ulTrafficDescrParm4;
417    tableRow->atmTrafficDescrParam5   = driverTableRow->ulTrafficDescrParm5;
418    tableRow->atmServiceCategory      = driverTableRow->ulServiceCategory;
419    tableRow->atmTrafficFrameDiscard  = driverTableRow->ulTrafficFrameDiscard;
420 }
421
422 /* Set the default values for the ATM traffic descriptor table */
423 void trafDescSetDefValues( ATM_TRAFDESC_TABLE* tableRow )
424 {
425    memcpy(  tableRow->atmTrafficDescrType, defAtmTrafficDescriptor, sizeof(defAtmTrafficDescriptor) );
426    tableRow->atmTrafficDescrParam1   = ATM_TRAFDESC_PARAM;
427    tableRow->atmTrafficDescrParam2   = ATM_TRAFDESC_PARAM;
428    tableRow->atmTrafficDescrParam3   = ATM_TRAFDESC_PARAM;
429    tableRow->atmTrafficDescrParam4   = ATM_TRAFDESC_PARAM;
430    tableRow->atmTrafficDescrParam5   = ATM_TRAFDESC_PARAM;
431    tableRow->atmTrafficQoSClass      = 0;
432    tableRow->atmTrafficDescrRowStatus= ATM_TRAFDESC_ROWSTATUS_ACTIVE;
433    tableRow->atmServiceCategory      = ATM_TRAFDESC_SERVICE_CAT_UBR;
434    tableRow->atmTrafficFrameDiscard = 1;
435 }
436 #endif /* ATMTRAFFDESCTBL */
437
438
439 int getVccAddrs( int numAddrs, PATM_VCC_ADDR pAddrs )
440 {
441    int nRet = 0;
442    UINT8 *pucPorts = NULL;
443    UINT32 ulInterfaceId = 0;
444    UINT32 ulAddrsReturned = 0;
445    UINT32 i = 0;
446
447    /* Get the addresses of all configured VCCs. */
448    if( pAddrs )
449    {
450       UINT32 ulAddrsIndex = 0;
451
452       pucPorts = (UINT8 *) (pAddrs + numAddrs);
453       for( i = 0; i < PHY_NUM_PORTS; i++ )
454       {
455          ulInterfaceId = (UINT32) i;
456          BcmAtm_GetInterfaceId( (UINT8) i, &ulInterfaceId );
457          if( BcmAtm_GetVccAddrs(ulInterfaceId, pAddrs + ulAddrsIndex,
458          numAddrs - ulAddrsIndex, &ulAddrsReturned) == STS_SUCCESS)
459          {
460             memset( pucPorts + ulAddrsIndex, i, ulAddrsReturned );
461             ulAddrsIndex += ulAddrsReturned;
462          }
463       }
464    }
465    else
466    {
467       nRet = 1;
468    }
469
470    return( nRet );
471 }
472
473
474 #ifdef ATMVCLTBL
475 /* Copy the driver data to the user structure for the ATM VCL table */
476 void vclCopyDriverData( ATM_VCL_TABLE* tableRow, PATM_VCC_ADDR pAddrs, ATM_VCC_CFG* vccCfg )
477 {
478         /* First, set the default values */
479         vclSetDefValues( tableRow );
480
481    /* Change only the values that can be obtained from the ATM driver.
482    ** Don't change the other values (i.e. keep the defaults) */
483         tableRow->atmVclVpi                                             = pAddrs->usVpi;
484         tableRow->atmVclVci                                             = pAddrs->usVci;
485         tableRow->atmVclAdminStatus                           = vccCfg->ulAtmVclAdminStatus;
486         tableRow->atmVclOperStatus                                    = vccCfg->ulAtmVclOperStatus;
487         tableRow->atmVclLastChange                                    = vccCfg->ulAtmVclLastChange;
488         tableRow->atmVccAalType                                       = mapAalType( vccCfg->ulAalType );
489         tableRow->atmVclTransmitTrafficDescrIndex = vccCfg->ulAtmVclTransmitTrafficDescrIndex;
490         tableRow->atmVclReceiveTrafficDescrIndex  = tableRow->atmVclTransmitTrafficDescrIndex;
491    tableRow->atmVccAal5EncapsType            = vccCfg->u.Aal5Cfg.ulAtmVccEncapsType;
492 }
493
494 /* Set the default values for the ATM VCL table */
495 void vclSetDefValues( ATM_VCL_TABLE* tableRow )
496 {
497    tableRow->atmVccAalType                                            = ATM_VCL_AALTYPE_AAL5;
498         tableRow->atmVccAal5CpcsTransmitSduSize   = ATM_VCL_SDUSIZE;
499    tableRow->atmVccAal5CpcsReceiveSduSize    = ATM_VCL_SDUSIZE;
500         tableRow->atmVccAalType                                       = ATM_VCL_AALTYPE_AAL5;
501    tableRow->atmVclCrossConnectIdentifier    = 0;
502    tableRow->atmVclRowStatus                 = ATM_VCL_ROWSTATUS_ACTIVE;
503    tableRow->atmVclCastType                  = ATM_VCL_CAST_TYPE_P2P;
504    tableRow->atmVclConnKind                  = ATM_VCL_CONN_KIND_PVC;
505 }
506
507 /* Map the AAL type provided by the driver to a value understood by the MIB
508 ** (used for the ATM VCL table) */
509 int mapAalType( UINT32 driverAalType )
510 {
511    int aalType = ATM_VCL_AALTYPE_AAL5;
512
513    switch ( driverAalType )
514    {
515       case AAL_2:
516          aalType = ATM_VCL_AALTYPE_AAL2;
517          break;
518       case AAL_5:
519          aalType = ATM_VCL_AALTYPE_AAL5;
520          break;
521       default:
522          aalType = ATM_VCL_AALTYPE_UNKNOWN;
523          break;
524    }
525
526    return( aalType );
527 }
528 #endif /* ATMVCLTBL */
529
530
531 #ifdef AAL5VCCTBL
532 /* Copy the driver data to the user structure for the AAL5 VCC table */
533 void aal5vccCopyDriverData( AAL5_VCC_TABLE* tableRow, PATM_VCC_ADDR pAddrs, ATM_VCC_STATS* stats )
534 {
535         /* First, set the default values */
536         aal5vccSetDefValues( tableRow );
537
538    /* Change only the values that can be obtained from the ATM driver.
539    ** Keep the defaults for the other values */
540    tableRow->aal5VccVpi                      = pAddrs->usVpi;
541    tableRow->aal5VccVci                      = pAddrs->usVci;
542    tableRow->aal5VccCrcErrors                = stats->u.AtmVccAal5Stats.ulAal5VccCrcErrors;
543    tableRow->aal5VccOverSizedSDUs            = stats->u.AtmVccAal5Stats.ulAal5VccOverSizedSdus;
544    tableRow->aal5VccSarTimeOuts              = stats->u.AtmVccAal5Stats.ulAal5VccSarTimeOuts;
545 }
546
547 /* Set the default values for the AAL5 VCC table */
548 void aal5vccSetDefValues( AAL5_VCC_TABLE* tableRow )
549 {
550    tableRow->aal5VccCrcErrors       = 0;
551    tableRow->aal5VccOverSizedSDUs   = 0;
552    tableRow->aal5VccSarTimeOuts     = 0;
553 }
554
555 #endif /* AAL5VCCTBL */
556
557 #endif /* BUILD_SNMP_ATM_MIB */
558
559 int getAtmIntfOperStatus(void)
560 {
561   ATM_INTERFACE_CFG Cfg;
562   UINT32 ulInterfaceId;
563   int port = 0;
564
565   BcmAtm_GetInterfaceId( (UINT8) port, &ulInterfaceId );
566   Cfg.ulStructureId = ID_ATM_INTERFACE_CFG;
567
568   if (BcmAtm_GetInterfaceCfg( ulInterfaceId, &Cfg ) == STS_SUCCESS) 
569     {
570       if (Cfg.ulIfOperStatus == OPRSTS_UP)
571         return IF_OPER_STATUS_UP;
572       else 
573         return IF_OPER_STATUS_DOWN;
574     }
575   return IF_OPER_STATUS_UNKNOWN;
576 }
577
578 int getAtmIntfAdminStatus(void)
579 {
580   ATM_INTERFACE_CFG Cfg;
581   UINT32 ulInterfaceId;
582   int port = 0;
583
584   BcmAtm_GetInterfaceId( (unsigned char) port, &ulInterfaceId );
585   Cfg.ulStructureId = ID_ATM_INTERFACE_CFG;
586
587   if (BcmAtm_GetInterfaceCfg( ulInterfaceId, &Cfg ) == STS_SUCCESS) 
588     return (Cfg.ulIfAdminStatus);
589
590   return IF_ADMIN_STATUS_DOWN;
591 }
592
593 int setAtmIntfAdminStatus(int status)
594 {
595   ATM_INTERFACE_CFG Cfg;
596   UINT32 ulInterfaceId;
597   int port = 0;
598   int ret = -1;
599
600   Cfg.ulStructureId = ID_ATM_INTERFACE_CFG;
601   ret = BcmAtm_GetInterfaceId( (UINT8) port, &ulInterfaceId );
602   if (ret == 0) 
603     {
604       /* Change the state to the specified value. */
605       Cfg.ulIfAdminStatus = status; 
606       ret = (int)BcmAtm_SetInterfaceCfg(ulInterfaceId, &Cfg );
607       if (ret != 0)
608         ret = -1;
609     }
610   return ret;
611 }