1 /* 2 * This file contains common for NDIS5/NDIS6 definition, 3 * related to OID support 4 * 5 * Copyright (c) 2008-2017 Red Hat, Inc. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met : 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and / or other materials provided with the distribution. 15 * 3. Neither the names of the copyright holders nor the names of their contributors 16 * may be used to endorse or promote products derived from this software 17 * without specific prior written permission. 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND 19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 * ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE 22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 */ 30 #ifndef PARANDIS_COMMON_OID_H 31 #define PARANDIS_COMMON_OID_H 32 33 #include "ndis56common.h" 34 35 /********************************************************** 36 Wrapper for all the data, related to any OID request 37 ***********************************************************/ 38 typedef struct _tagOidDesc 39 { 40 NDIS_OID Oid; // oid code 41 ULONG ulToDoFlags; // combination of eOidHelperFlags 42 PVOID InformationBuffer; // buffer received from NDIS 43 UINT InformationBufferLength; // its length 44 PUINT pBytesWritten; // OUT for query/method 45 PUINT pBytesNeeded; // OUT for query/set/method when length of buffer is wrong 46 PUINT pBytesRead; // OUT for set/method 47 PVOID Reserved; // Reserved for pending requests 48 } tOidDesc; 49 50 typedef NDIS_STATUS (*OIDHANDLERPROC)(PARANDIS_ADAPTER *pContext, tOidDesc *pOid); 51 52 typedef struct _tagOidWhatToDo 53 { 54 NDIS_OID oid; // oid number 55 int nEntryLevel; // do print on entry level 56 int nExitFailLevel; // do print on exit if failed 57 int nExitOKLevel; // do print on exit if OK 58 UINT Flags; 59 OIDHANDLERPROC OidSetProc; // procedure to call on SET 60 const char *name; // printable name 61 }tOidWhatToDo; 62 63 64 typedef enum _tageOidHelperFlags { 65 ohfQuery = 1, // can be queried 66 ohfSet = 2, // can be set 67 ohfQuerySet = ohfQuery | ohfSet, 68 ohfQueryStatOnly = 4, // redirect query stat to query 69 ohfQueryStat = ohfQueryStatOnly | ohfQuery, 70 ohfQuery3264 = 8 | ohfQuery, // convert 64 to 32 on query 71 ohfQueryStat3264 = 8 | ohfQueryStat, // convert 64 to 32 on query stat 72 ohfSetLessOK = 16, // on set: if buffer is smaller, cleanup and copy 73 ohfSetMoreOK = 32 // on set: if buffer is larger, copy anyway 74 } eOidHelperFlags; 75 76 77 78 79 /********************************************************** 80 Common procedures related to OID support 81 ***********************************************************/ 82 NDIS_STATUS ParaNdis_OidQueryCommon(PARANDIS_ADAPTER *pContext, tOidDesc *pOid); 83 NDIS_STATUS ParaNdis_OidQueryCopy(tOidDesc *pOid, PVOID pInfo, ULONG ulSize, BOOLEAN bFreeInfo); 84 static NDIS_STATUS ParaNdis_OidQuery(PARANDIS_ADAPTER *pContext, tOidDesc *pOid); 85 NDIS_STATUS ParaNdis_OnOidSetMulticastList(PARANDIS_ADAPTER *pContext, tOidDesc *pOid); 86 NDIS_STATUS ParaNdis_OnSetPacketFilter(PARANDIS_ADAPTER *pContext, tOidDesc *pOid); 87 NDIS_STATUS ParaNdis_OnAddWakeupPattern(PARANDIS_ADAPTER *pContext, tOidDesc *pOid); 88 NDIS_STATUS ParaNdis_OnRemoveWakeupPattern(PARANDIS_ADAPTER *pContext, tOidDesc *pOid); 89 NDIS_STATUS ParaNdis_OnEnableWakeup(PARANDIS_ADAPTER *pContext, tOidDesc *pOid); 90 NDIS_STATUS ParaNdis_OnSetLookahead(PARANDIS_ADAPTER *pContext, tOidDesc *pOid); 91 NDIS_STATUS ParaNdis_OnSetVlanId(PARANDIS_ADAPTER *pContext, tOidDesc *pOid); 92 NDIS_STATUS ParaNdis_OidSetCopy(tOidDesc *pOid, PVOID pDest, ULONG ulSize); 93 void ParaNdis_FillPowerCapabilities(PNDIS_PNP_CAPABILITIES pCaps); 94 void ParaNdis_GetOidSupportRules(NDIS_OID oid, tOidWhatToDo *pRule, const tOidWhatToDo *Table); 95 96 97 const char *ParaNdis_OidName(NDIS_OID oid); 98 /********************************************************** 99 Procedures to be implemented in NDIS5/NDIS6 specific modules 100 ***********************************************************/ 101 void ParaNdis_GetSupportedOid(PVOID *pOidsArray, PULONG pLength); 102 NDIS_STATUS ParaNdis_OnSetPower(PARANDIS_ADAPTER *pContext, tOidDesc *pOid); 103 104 #endif 105