8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / lib / sun_fc / common / HandlePort.h
blob0584330134ff9c0cdc1316175fe37021996ce07b
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef _HANDLEPORT_H
27 #define _HANDLEPORT_H
31 // Forward Declarations
32 class Handle;
33 class HandlePort;
34 class HandleNPIVPort;
36 #include "Lockable.h"
37 #include "Handle.h"
38 #include "HBA.h"
39 #include "HBAPort.h"
40 #include "HandleNPIVPort.h"
41 #include <hbaapi.h>
42 #include <hbaapi-sun.h>
44 /**
45 * @memo Represents this handles state for each HBA port.
47 * @doc
48 * This is required to track the state change value for
49 * a given port for this open handle. This class is used exclusivly
50 * by instances of the Handle class.
52 class HandlePort : public Lockable {
53 public:
54 HandlePort(Handle *handle, HBA *hba, HBAPort *port);
56 void refresh();
57 void validate(uint64_t newState);
58 bool match(uint64_t portWWN);
59 bool match(int index);
62 HBA_PORTATTRIBUTES getPortAttributes();
63 HBA_PORTATTRIBUTES getDiscoveredAttributes(
64 HBA_UINT32 discoveredport);
65 HBA_PORTATTRIBUTES getDiscoveredAttributes(uint64_t wwn);
66 HBA_PORTNPIVATTRIBUTES getPortNPIVAttributes();
67 uint32_t createNPIVPort(uint64_t vnodewwn,
68 uint64_t vportwwn, uint32_t vindex);
69 uint32_t deleteNPIVPort(uint64_t vportwwn);
70 HandleNPIVPort* getHandleNPIVPortByIndex(int index);
71 HandleNPIVPort* getHandleNPIVPort(uint64_t wwn);
72 private:
73 uint64_t lastState;
74 bool active;
75 Handle *handle;
76 HBAPort *port;
77 HBA *hba;
78 std::map<uint64_t, HandleNPIVPort*> npivportHandles;
81 #endif /* _HANDLEPORT_H */