configuration parameter DBWriter.MaxRecordsPerTransaction added to database
[public/netxms.git] / src / server / libnxsrv / iflist.cpp
CommitLineData
fdb6181a
VK
1/*
2** NetXMS - Network Management System
3** Copyright (C) 2003-2011 Victor Kirhenshtein
4**
5** This program is free software; you can redistribute it and/or modify
6** it under the terms of the GNU Lesser General Public License as published by
7** the Free Software Foundation; either version 3 of the License, or
8** (at your option) any later version.
9**
10** This program is distributed in the hope that it will be useful,
11** but WITHOUT ANY WARRANTY; without even the implied warranty of
12** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13** GNU General Public License for more details.
14**
15** You should have received a copy of the GNU Lesser General Public License
16** along with this program; if not, write to the Free Software
17** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18**
19** File: iflist.cpp
20**
21**/
22
23#include "libnxsrv.h"
24
2b8a949b
VK
25/**
26 * Constructor
27 */
fdb6181a
VK
28InterfaceList::InterfaceList(int initialAlloc)
29{
c30c0c0f 30 m_interfaces = new ObjectArray<InterfaceInfo>(initialAlloc, 32, true);
fdb6181a 31 m_data = NULL;
f34e7a6e 32 m_needPrefixWalk = false;
fdb6181a
VK
33}
34
2b8a949b
VK
35/**
36 * Destructor
37 */
fdb6181a
VK
38InterfaceList::~InterfaceList()
39{
c30c0c0f 40 delete m_interfaces;
fdb6181a
VK
41}
42
2b8a949b
VK
43/**
44 * Find interface entry by ifIndex
45 */
c30c0c0f 46InterfaceInfo *InterfaceList::findByIfIndex(UINT32 ifIndex)
b1bd1fb2 47{
c30c0c0f
VK
48 for(int i = 0; i < m_interfaces->size(); i++)
49 if (m_interfaces->get(i)->index == ifIndex)
50 return m_interfaces->get(i);
b1bd1fb2
VK
51 return NULL;
52}
26cfeea3
VK
53
54/**
55 * Find interface entry by physical position
56 */
57InterfaceInfo *InterfaceList::findByPhyPosition(int slot, int port)
58{
59 for(int i = 0; i < m_interfaces->size(); i++)
60 {
61 InterfaceInfo *iface = m_interfaces->get(i);
62 if (iface->isPhysicalPort && (iface->slot == slot) && (iface->port == port))
63 return iface;
64 }
65 return NULL;
66}