sreeramkr
asked on
passing the ipaddress
I am in the process of developing a NIC miniport driver. Is there any way of finding out the ipaddress, subnet mask and the default gateway from the driver.. Is there an ndis call which returns these entities to the driver..
Please write in as much detail as possible
Please write in as much detail as possible
Checked it out, but I am not a windows expert, and definitely not windows 2000. (Haven't even seen it yet). Sorry
ASKER
is tehre anyway i can get help?
by trapping the OID_GEN_NETWORK_LAYER_ADDR ESSES you can find the nic ip address. read about this OID in the DDK.
ASKER
Hi chen,
Thanks for the reply. I have trapped that in setinformation handler. I am giving the details here. check out and tell me whether it is correct. Becoz there is little that is given in ddk on that.
case OID_GEN_NETWORK_LAYER_ADDR ESSES:
NetworkAddressList = (NETWORK_ADDRESS_LIST *)InformationBuffer;
if(InformationBufferLength ==4)
{
for(i=0;i<(NetworkAddressL ist->Addre ssCount);i ++)
{
if(NetworkAddressList->Add ressCount! =0 &&
NetworkAddressList->Addres s[i].Addre ssType == NDIS_PROTOCOL_ID_TCP_IP
)
{
for(j=0;j<InformationBuffe rLength;j+ +)
{
Adapter->IpAddress.Address [j]=Networ kAddressLi st->Addres s[i].Addre ss[j];
}
Adapter->IpAddress.Address Type=Netwo rkAddressL ist->Addre ss[i].Addr essType;
Adapter->IpAddress.Address Length=Net workAddres sList->Add ress[i].Ad dressLengt h;
*NumBytesRead=InformationB ufferLengt h;
Status=NDIS_STATUS_SUCCESS ;
break;
}
}
}
else
Status=NDIS_STATUS_NOT_SUP PORTED;
break;
does it suceed? tell me whats wrong with this.
waiting for ur reply.
regards
sreeram
Thanks for the reply. I have trapped that in setinformation handler. I am giving the details here. check out and tell me whether it is correct. Becoz there is little that is given in ddk on that.
case OID_GEN_NETWORK_LAYER_ADDR
NetworkAddressList = (NETWORK_ADDRESS_LIST *)InformationBuffer;
if(InformationBufferLength
{
for(i=0;i<(NetworkAddressL
{
if(NetworkAddressList->Add
NetworkAddressList->Addres
)
{
for(j=0;j<InformationBuffe
{
Adapter->IpAddress.Address
}
Adapter->IpAddress.Address
Adapter->IpAddress.Address
*NumBytesRead=InformationB
Status=NDIS_STATUS_SUCCESS
break;
}
}
}
else
Status=NDIS_STATUS_NOT_SUP
break;
does it suceed? tell me whats wrong with this.
waiting for ur reply.
regards
sreeram
chen_levkovich changed the proposed answer to a comment
to find the ip from the buffer :
1) if (NetworkAddressList->Addre ssCount = 0) and (NetworkAddressList->Addre ssType = NDIS_PROTOCOL_ID_TCP_IP) then this call is for clearing the IP
2) else if (NetworkAddressList->Addre ss[0].Addr essType == NDIS_PROTOCOL_ID_TCP_IP) then the ip addres is in NetworkAddressList->Addres s[0].Addre ss[4] (4 bytes ofcourse)
very very important :
if the undelaying nic return error don't pass it. You need to return ALWAIS success (or tcp/ip will stop to send this oid). of course when an error is returned by the nic you'll have to set the buffer.
Check also the returned value in the PtRequestComplete function (when the oporation is delayed)
Bye
Chen Levkovich
chen@arx.com
1) if (NetworkAddressList->Addre
2) else if (NetworkAddressList->Addre
very very important :
if the undelaying nic return error don't pass it. You need to return ALWAIS success (or tcp/ip will stop to send this oid). of course when an error is returned by the nic you'll have to set the buffer.
Check also the returned value in the PtRequestComplete function (when the oporation is delayed)
Bye
Chen Levkovich
chen@arx.com
ASKER
Hi,
Atlast I am getting it. Can you please be elaborate on this. I mean with respect to my comment above (showing how i trapped ip adderss in setinformation handler). Can you please how put the above code correctly please
regards
sreeram
Atlast I am getting it. Can you please be elaborate on this. I mean with respect to my comment above (showing how i trapped ip adderss in setinformation handler). Can you please how put the above code correctly please
regards
sreeram
chen_levkovich changed the proposed answer to a comment
read my last answer to understand this code :
this in the MPSetInformation function
case OID_GEN_NETWORK_LAYER_ADDR
if ((Status == NDIS_STATUS_NOT_SUPPORTED)
{
Status = NDIS_STATUS_SUCCESS;
*BytesRead = InformationBufferLength;
*BytesNeeded = 0;
}
NetworkAddressList = (NETWORK_ADDRESS_LIST *)InformationBuffer;
if (NetworkAddressList->Addre
{
if(NetworkAddressList->Add
{
Adapter->IpAddress.Address
}
}
else
{
if (NetworkAddressList->Addre
{
Adapter->IpAddress.Address
}
}
break;
this in the PtRequestComplete function
if (Oid == OID_GEN_NETWORK_LAYER_ADDR
{
if ((Status == NDIS_STATUS_NOT_SUPPORTED)
{
Status = NDIS_STATUS_SUCCESS ;
switch(NdisRequest->Reques
{
case NdisRequestQueryInformatio
break;
case NdisRequestSetInformation:
NdisRequest->DATA.SET_INFO
NdisRequest->DATA.SET_INFO
break;
}
}
}
ASKER
Hi,
I am really perplexed with PtRequestcomplete and MpSetInformation. I dont know abut PtRequestComplete.
Actually I tell the ndis to look for setinformation function by giving a function name in the driver entry so that NDIS looks into that function when it wants to set something.
So i gave a set information function. Now in the query information(as per characteristics provided in the driver entry) which is also same as set information. I say in supported_oids to look for oid_network_layer_address. This oid is mandatory in set information as per DDK help.
now in my setinformation function i want to fill up the network address. I did as shown above. is it correct? if not then how can i fill it up? I know u have given me the code but am confused with mpsetinformation and ptrequestcomplete function. Which one to use in my set information function. mpsetinformation looks promising but if i use that code should i have to do some other handling?
do reply me
sreeram
I am really perplexed with PtRequestcomplete and MpSetInformation. I dont know abut PtRequestComplete.
Actually I tell the ndis to look for setinformation function by giving a function name in the driver entry so that NDIS looks into that function when it wants to set something.
So i gave a set information function. Now in the query information(as per characteristics provided in the driver entry) which is also same as set information. I say in supported_oids to look for oid_network_layer_address.
now in my setinformation function i want to fill up the network address. I did as shown above. is it correct? if not then how can i fill it up? I know u have given me the code but am confused with mpsetinformation and ptrequestcomplete function. Which one to use in my set information function. mpsetinformation looks promising but if i use that code should i have to do some other handling?
do reply me
sreeram
chen_levkovich changed the proposed answer to a comment
Hi !
The first code igave u is to be placed in the setinformation this code read the ip address.
but in order to continue getting this oid u have to be soure that u return success to tcp/ip. in order to do so u must return a success value. this is done by
if ((Status == NDIS_STATUS_NOT_SUPPORTED) || (Status == NDIS_STATUS_INVALID_OID))
{
Status = NDIS_STATUS_SUCCESS;
*BytesRead = InformationBufferLength;
*BytesNeeded = 0;
}
in the setinformation function and by
if (Oid == OID_GEN_NETWORK_LAYER_ADDR ESSES)
{
if ((Status == NDIS_STATUS_NOT_SUPPORTED) || (Status == NDIS_STATUS_INVALID_OID))
{
Status = NDIS_STATUS_SUCCESS ;
switch(NdisRequest->Reques tType)
{
case NdisRequestQueryInformatio n:
break;
case NdisRequestSetInformation:
NdisRequest->DATA.SET_INFO RMATION.By tesRead = NdisRequest->DATA.SET_INFO RMATION.In formationB ufferLengt h;
NdisRequest->DATA.SET_INFO RMATION.By tesNeeded = 0;
break;
}
}
}
the the ptrequestcomplete function.
because nic often return pending in the setinformation function u got to check the returned value in the ptrequestcomplete function
chen levkovich
chen@arx.com
The first code igave u is to be placed in the setinformation this code read the ip address.
but in order to continue getting this oid u have to be soure that u return success to tcp/ip. in order to do so u must return a success value. this is done by
if ((Status == NDIS_STATUS_NOT_SUPPORTED)
{
Status = NDIS_STATUS_SUCCESS;
*BytesRead = InformationBufferLength;
*BytesNeeded = 0;
}
in the setinformation function and by
if (Oid == OID_GEN_NETWORK_LAYER_ADDR
{
if ((Status == NDIS_STATUS_NOT_SUPPORTED)
{
Status = NDIS_STATUS_SUCCESS ;
switch(NdisRequest->Reques
{
case NdisRequestQueryInformatio
break;
case NdisRequestSetInformation:
NdisRequest->DATA.SET_INFO
NdisRequest->DATA.SET_INFO
break;
}
}
}
the the ptrequestcomplete function.
because nic often return pending in the setinformation function u got to check the returned value in the ptrequestcomplete function
chen levkovich
chen@arx.com
ASKER
Hi,
I am again sorry for asking you the same thing. I have the code like this. the queryinformation and the set information. I dont understand ptrequestcomplete and the otehr. why are they different and where do they have to be inserted? please see my code both for queryinformation and setinformation and gimme ur comments of what and where i have to change. sorry for the trouble
regards
sreeram
code---------------------- ---------- ---------- ---------- -----
NDIS_STATUS
QueryInformation(
IN NDIS_HANDLE MiniportAdapterContext,
IN NDIS_OID Oid,
IN PVOID InformationBuffer,
IN ULONG InformationBufferLength,
OUT PULONG NumBytesWritten,
OUT PULONG NumBytesNeeded
)
{
// order is important here because the OIDs should be in order
// of increasing value
static
NDIS_OID SupportedGlobalOids[] =
{
OID_GEN_SUPPORTED_LIST,
OID_GEN_HARDWARE_STATUS,
OID_GEN_MEDIA_SUPPORTED,
OID_GEN_MEDIA_IN_USE,
OID_GEN_MAXIMUM_LOOKAHEAD,
OID_GEN_MAXIMUM_FRAME_SIZE ,
OID_GEN_LINK_SPEED,
OID_GEN_TRANSMIT_BUFFER_SP ACE,
OID_GEN_RECEIVE_BUFFER_SPA CE,
OID_GEN_TRANSMIT_BLOCK_SIZ E,
OID_GEN_RECEIVE_BLOCK_SIZE ,
OID_GEN_VENDOR_ID,
OID_GEN_VENDOR_DESCRIPTION ,
OID_GEN_VENDOR_DRIVER_VERS ION,
OID_GEN_CURRENT_PACKET_FIL TER,
OID_GEN_CURRENT_LOOKAHEAD,
OID_GEN_DRIVER_VERSION,
OID_GEN_MAXIMUM_TOTAL_SIZE ,
OID_GEN_PROTOCOL_OPTIONS,
OID_GEN_MAC_OPTIONS,
// OID_GEN_MEDIA_CONNECT_STAT US,
OID_GEN_MAXIMUM_SEND_PACKE TS,
OID_GEN_NETWORK_LAYER_ADDR ESSES,
OID_GEN_XMIT_OK,
OID_GEN_RCV_OK,
OID_GEN_XMIT_ERROR,
OID_GEN_RCV_ERROR,
OID_GEN_RCV_NO_BUFFER,
// OID_GEN_RX_CRC_ERROR,
OID_GEN_TRANSMIT_QUEUE_LEN GTH,
OID_802_3_PERMANENT_ADDRES S,
OID_802_3_CURRENT_ADDRESS,
OID_802_3_MULTICAST_LIST,
OID_802_3_MAXIMUM_LIST_SIZ E,
/* for ndis 4 packet priority
OID_802_3_MAC_OPTIONS,
*/
OID_802_3_RCV_ERROR_ALIGNM ENT,
OID_802_3_XMIT_ONE_COLLISI ON,
OID_802_3_XMIT_MORE_COLLIS IONS,
};
// String describing our adapter
char VendorDescriptor[] = VENDORDESCRIPTOR;
UCHAR VendorId[4];
NDIS_MEDIUM Medium = NdisMedium802_3;
PACB100_Adapter Adapter; // my adapter
NDIS_HARDWARE_STATUS HardwareStatus;
ULONG GenericUlong;
USHORT GenericUShort;
UCHAR GenericArray[6];
NDIS_STATUS Status = NDIS_STATUS_SUCCESS;
PVOID MoveSource = (PVOID)(&GenericUlong);
ULONG MoveBytes = sizeof(GenericUlong);
Adapter=(PACB100_Adapter)( MiniportAd apterConte xt);
HardwareStatus = Adapter->HardwareStatus;
*NumBytesWritten=0;
*NumBytesNeeded=0;
switch(Oid)
{
case OID_GEN_MAC_OPTIONS:
//check whether uint or ulong
GenericUlong=(ULONG)(NDIS_ MAC_OPTION _TRANSFERS _NOT_PEND| NDIS_MAC_O PTION_NO_L OOPBACK);
break;
case OID_GEN_SUPPORTED_LIST:
MoveSource=(PVOID)(ACB100S upportedGl obalOids);
MoveBytes=sizeof(ACB100Sup portedGlob alOids);
break;
case OID_GEN_HARDWARE_STATUS:
MoveSource=(PVOID)(&Hardwa reStatus); //..check... on what basis?
MoveBytes=sizeof(NDIS_HARD WARE_STATU S);
break;
case OID_GEN_MEDIA_SUPPORTED:
case OID_GEN_MEDIA_IN_USE:
MoveSource=(PVOID)(&Medium ); //..ok
MoveBytes=sizeof(NDIS_MEDI UM);
break;
case OID_GEN_MAXIMUM_LOOKAHEAD:
case OID_GEN_MAXIMUM_FRAME_SIZE :
GenericUlong=MAX_ETH_PACKE T_SIZE - ETHERNET_HEADER_SIZE; //...never understood!
break;
case OID_GEN_LINK_SPEED:
GenericUlong = ((ULONG) Adapter->CurrentLineSpeed) ; //100mbps
break;
case OID_GEN_CURRENT_LOOKAHEAD:
case OID_GEN_MAXIMUM_TOTAL_SIZE :
case OID_GEN_TRANSMIT_BLOCK_SIZ E:
case OID_GEN_RECEIVE_BLOCK_SIZE :
GenericUlong=(ULONG) MAX_ETH_PACKET_SIZE;
break;
case OID_GEN_TRANSMIT_BUFFER_SP ACE:
//NumTx_Frames have to be read fromt he application where user has the ability to change
GenericUlong = (ULONG) MAX_ETH_PACKET_SIZE *
Adapter->NumTxFrames;
break;
case OID_GEN_RECEIVE_BUFFER_SPA CE:
GenericUlong = (ULONG) MAX_ETH_PACKET_SIZE *
Adapter -> NumRxFrames;
break;
case OID_GEN_VENDOR_ID:
NdisMoveMemory(VendorId, Adapter->PermanentAddress, 4);
// VendorId[3] = 0x0;
MoveSource = (PVOID) VendorId;
MoveBytes = sizeof(VendorId);
break;
case OID_GEN_VENDOR_DESCRIPTION :
MoveSource = (PVOID) VendorDescriptor;
MoveBytes = sizeof(VendorDescriptor);
break;
case OID_GEN_VENDOR_DRIVER_VERS ION:
GenericUShort = (USHORT)ACB100_VENDOR_DRIV ER_VERSION ;
MoveSource = (PVOID)(&GenericUShort);
MoveBytes = sizeof(GenericUShort);
case OID_GEN_DRIVER_VERSION:
GenericUShort = (USHORT) ACB100_DRIVER_VERSION;
MoveSource = (PVOID)(&GenericUShort);
MoveBytes = sizeof(GenericUShort);
break;
case OID_802_3_CURRENT_ADDRESS:
case OID_802_3_PERMANENT_ADDRES S:
ETH_COPY_NETWORK_ADDRESS(
(PCHAR) GenericArray,
Adapter->PermanentAddress) ;
MoveSource = (PVOID) (GenericArray);
MoveBytes = ETHERNET_ADDRESS_LENGTH;
break;
//if supported multi cast only
case OID_802_3_MAXIMUM_LIST_SIZ E:
GenericUlong = (ULONG) MAX_MULTICAST_LIST;
break;
case OID_GEN_MAXIMUM_SEND_PACKE TS:
GenericUlong = (ULONG) MAX_SEND_PACKETS;
break;
default:
switch (Oid)
{
case OID_GEN_XMIT_OK:
GenericUlong = (ULONG) (Adapter->FramesTxGood);
break;
case OID_GEN_RCV_OK:
GenericUlong = (ULONG) (Adapter->FramesRxGood);
break;
case OID_GEN_XMIT_ERROR:
GenericUlong = (ULONG) (Adapter->FramesTxError);
break;
case OID_GEN_RCV_ERROR:
GenericUlong = (ULONG) (Adapter->FramesRxError);
break;
case OID_GEN_RCV_NO_BUFFER:
GenericUlong = (ULONG) (Adapter->FramesRxResource Error);
break;
case OID_GEN_TRANSMIT_QUEUE_LEN GTH:
GenericUlong = (ULONG) (Adapter->NumTxFrames);
break;
case OID_802_3_RCV_ERROR_ALIGNM ENT:
GenericUlong = (ULONG) (Adapter->FramesRxAlignErr or);
break;
case OID_802_3_XMIT_ONE_COLLISI ON:
GenericUlong = (ULONG) Adapter->TryOnce;
break;
case OID_802_3_XMIT_MORE_COLLIS IONS:
GenericUlong = (ULONG) Adapter->TryManyTimes;
break;
default:
Status = NDIS_STATUS_NOT_SUPPORTED;
break;
}
}
if (Status == NDIS_STATUS_SUCCESS)
{
if (MoveBytes > InformationBufferLength)
{
// Not enough room in InformationBuffer. Punt
*NumBytesNeeded = MoveBytes;
Status = NDIS_STATUS_BUFFER_TOO_SHO RT;
}
else
{
// Copy result into InformationBuffer
*NumBytesWritten = MoveBytes;
if (MoveBytes > 0)
NdisMoveMemory(Information Buffer, MoveSource, MoveBytes);
}
}
return (Status);
} /* end of D100QueryInformation */
NDIS_STATUS
ACB100SetInformation(
IN NDIS_HANDLE MiniportAdapterContext,
IN NDIS_OID Oid,
IN PVOID InformationBuffer,
IN ULONG InformationBufferLength,
OUT PULONG NumBytesRead,
OUT PULONG NumBytesNeeded
)
{
NDIS_STATUS Status;
ULONG PacketFilter;
PACB100_Adapter Adapter;
NETWORK_ADDRESS_LIST *NetworkAddressList;
LONG i;
UINT j;
Adapter = (PACB100_Adapter)(Miniport AdapterCon text);
*NumBytesRead = 0;
*NumBytesNeeded = 0;
switch (Oid)
{
case OID_802_3_MULTICAST_LIST:
*NumBytesRead=0;
Status=NDIS_STATUS_NOT_SUP PORTED;
case OID_GEN_CURRENT_LOOKAHEAD:
// Verify the Length
if (InformationBufferLength != 4)
return (NDIS_STATUS_INVALID_LENGT H);
*NumBytesRead = 4;
Status = NDIS_STATUS_SUCCESS;
break;
case OID_GEN_CURRENT_PACKET_FIL TER:
// Verify the Length
if (InformationBufferLength != 4)
return (NDIS_STATUS_INVALID_LENGT H);
// Now call the filter package to set the packet filter.
NdisMoveMemory((PVOID)&Pac ketFilter, InformationBuffer, sizeof(ULONG));
// Verify bits, if any bits are set that we don't support, leave
if (PacketFilter &
~(NDIS_PACKET_TYPE_DIRECTE D |
NDIS_PACKET_TYPE_BROADCAST ))
{
// Status = NDIS_STATUS_NOT_SUPPORTED;
// *NumBytesRead = 4;
// break;
}
Status=NDIS_STATUS_SUCCESS ;
*NumBytesRead = InformationBufferLength;
break;
case OID_GEN_NETWORK_LAYER_ADDR ESSES:
NetworkAddressList = (NETWORK_ADDRESS_LIST *)InformationBuffer;
//if( InformationBufferLength!=s izeof(Netw orkAddress List) ) // may not be correct...check!
{
for(i=0;i<(NetworkAddressL ist->Addre ssCount);i ++)
{
if(NetworkAddressList->Add ressCount! =0 &&
NetworkAddressList->Addres s[i].Addre ssType == NDIS_PROTOCOL_ID_TCP_IP
)
{
for(j=0;j<NetworkAddressLi st->Addres s->Address Length;j++ )
{
DbgPrint("%3d.", NetworkAddressList->Addres s[i].Addre ss[j]);
if(! (j&3) )DbgPrint("\n");
DbgPrint("just for heck\n");
// Adapter->IpAddress.Address [j]=Networ kAddressLi st->Addres s[i].Addre ss[j];
}
//Adapter->IpAddress.Addre ssType=Net workAddres sList->Add ress[i].Ad dressType;
//Adapter->IpAddress.Addre ssLength=N etworkAddr essList->A ddress[i]. AddressLen gth;
*NumBytesRead=InformationB ufferLengt h;
Status=NDIS_STATUS_SUCCESS ;
break;
}
}
}
//else
// Status=NDIS_STATUS_NOT_SUP PORTED;
break;
default:
Status=NDIS_STATUS_NOT_SUP PORTED;
break;
}
return Status;
}
please pass ur comments
I am again sorry for asking you the same thing. I have the code like this. the queryinformation and the set information. I dont understand ptrequestcomplete and the otehr. why are they different and where do they have to be inserted? please see my code both for queryinformation and setinformation and gimme ur comments of what and where i have to change. sorry for the trouble
regards
sreeram
code----------------------
NDIS_STATUS
QueryInformation(
IN NDIS_HANDLE MiniportAdapterContext,
IN NDIS_OID Oid,
IN PVOID InformationBuffer,
IN ULONG InformationBufferLength,
OUT PULONG NumBytesWritten,
OUT PULONG NumBytesNeeded
)
{
// order is important here because the OIDs should be in order
// of increasing value
static
NDIS_OID SupportedGlobalOids[] =
{
OID_GEN_SUPPORTED_LIST,
OID_GEN_HARDWARE_STATUS,
OID_GEN_MEDIA_SUPPORTED,
OID_GEN_MEDIA_IN_USE,
OID_GEN_MAXIMUM_LOOKAHEAD,
OID_GEN_MAXIMUM_FRAME_SIZE
OID_GEN_LINK_SPEED,
OID_GEN_TRANSMIT_BUFFER_SP
OID_GEN_RECEIVE_BUFFER_SPA
OID_GEN_TRANSMIT_BLOCK_SIZ
OID_GEN_RECEIVE_BLOCK_SIZE
OID_GEN_VENDOR_ID,
OID_GEN_VENDOR_DESCRIPTION
OID_GEN_VENDOR_DRIVER_VERS
OID_GEN_CURRENT_PACKET_FIL
OID_GEN_CURRENT_LOOKAHEAD,
OID_GEN_DRIVER_VERSION,
OID_GEN_MAXIMUM_TOTAL_SIZE
OID_GEN_PROTOCOL_OPTIONS,
OID_GEN_MAC_OPTIONS,
// OID_GEN_MEDIA_CONNECT_STAT
OID_GEN_MAXIMUM_SEND_PACKE
OID_GEN_NETWORK_LAYER_ADDR
OID_GEN_XMIT_OK,
OID_GEN_RCV_OK,
OID_GEN_XMIT_ERROR,
OID_GEN_RCV_ERROR,
OID_GEN_RCV_NO_BUFFER,
// OID_GEN_RX_CRC_ERROR,
OID_GEN_TRANSMIT_QUEUE_LEN
OID_802_3_PERMANENT_ADDRES
OID_802_3_CURRENT_ADDRESS,
OID_802_3_MULTICAST_LIST,
OID_802_3_MAXIMUM_LIST_SIZ
/* for ndis 4 packet priority
OID_802_3_MAC_OPTIONS,
*/
OID_802_3_RCV_ERROR_ALIGNM
OID_802_3_XMIT_ONE_COLLISI
OID_802_3_XMIT_MORE_COLLIS
};
// String describing our adapter
char VendorDescriptor[] = VENDORDESCRIPTOR;
UCHAR VendorId[4];
NDIS_MEDIUM Medium = NdisMedium802_3;
PACB100_Adapter Adapter; // my adapter
NDIS_HARDWARE_STATUS HardwareStatus;
ULONG GenericUlong;
USHORT GenericUShort;
UCHAR GenericArray[6];
NDIS_STATUS Status = NDIS_STATUS_SUCCESS;
PVOID MoveSource = (PVOID)(&GenericUlong);
ULONG MoveBytes = sizeof(GenericUlong);
Adapter=(PACB100_Adapter)(
HardwareStatus = Adapter->HardwareStatus;
*NumBytesWritten=0;
*NumBytesNeeded=0;
switch(Oid)
{
case OID_GEN_MAC_OPTIONS:
//check whether uint or ulong
GenericUlong=(ULONG)(NDIS_
break;
case OID_GEN_SUPPORTED_LIST:
MoveSource=(PVOID)(ACB100S
MoveBytes=sizeof(ACB100Sup
break;
case OID_GEN_HARDWARE_STATUS:
MoveSource=(PVOID)(&Hardwa
MoveBytes=sizeof(NDIS_HARD
break;
case OID_GEN_MEDIA_SUPPORTED:
case OID_GEN_MEDIA_IN_USE:
MoveSource=(PVOID)(&Medium
MoveBytes=sizeof(NDIS_MEDI
break;
case OID_GEN_MAXIMUM_LOOKAHEAD:
case OID_GEN_MAXIMUM_FRAME_SIZE
GenericUlong=MAX_ETH_PACKE
break;
case OID_GEN_LINK_SPEED:
GenericUlong = ((ULONG) Adapter->CurrentLineSpeed)
break;
case OID_GEN_CURRENT_LOOKAHEAD:
case OID_GEN_MAXIMUM_TOTAL_SIZE
case OID_GEN_TRANSMIT_BLOCK_SIZ
case OID_GEN_RECEIVE_BLOCK_SIZE
GenericUlong=(ULONG) MAX_ETH_PACKET_SIZE;
break;
case OID_GEN_TRANSMIT_BUFFER_SP
//NumTx_Frames have to be read fromt he application where user has the ability to change
GenericUlong = (ULONG) MAX_ETH_PACKET_SIZE *
Adapter->NumTxFrames;
break;
case OID_GEN_RECEIVE_BUFFER_SPA
GenericUlong = (ULONG) MAX_ETH_PACKET_SIZE *
Adapter -> NumRxFrames;
break;
case OID_GEN_VENDOR_ID:
NdisMoveMemory(VendorId, Adapter->PermanentAddress,
// VendorId[3] = 0x0;
MoveSource = (PVOID) VendorId;
MoveBytes = sizeof(VendorId);
break;
case OID_GEN_VENDOR_DESCRIPTION
MoveSource = (PVOID) VendorDescriptor;
MoveBytes = sizeof(VendorDescriptor);
break;
case OID_GEN_VENDOR_DRIVER_VERS
GenericUShort = (USHORT)ACB100_VENDOR_DRIV
MoveSource = (PVOID)(&GenericUShort);
MoveBytes = sizeof(GenericUShort);
case OID_GEN_DRIVER_VERSION:
GenericUShort = (USHORT) ACB100_DRIVER_VERSION;
MoveSource = (PVOID)(&GenericUShort);
MoveBytes = sizeof(GenericUShort);
break;
case OID_802_3_CURRENT_ADDRESS:
case OID_802_3_PERMANENT_ADDRES
ETH_COPY_NETWORK_ADDRESS(
(PCHAR) GenericArray,
Adapter->PermanentAddress)
MoveSource = (PVOID) (GenericArray);
MoveBytes = ETHERNET_ADDRESS_LENGTH;
break;
//if supported multi cast only
case OID_802_3_MAXIMUM_LIST_SIZ
GenericUlong = (ULONG) MAX_MULTICAST_LIST;
break;
case OID_GEN_MAXIMUM_SEND_PACKE
GenericUlong = (ULONG) MAX_SEND_PACKETS;
break;
default:
switch (Oid)
{
case OID_GEN_XMIT_OK:
GenericUlong = (ULONG) (Adapter->FramesTxGood);
break;
case OID_GEN_RCV_OK:
GenericUlong = (ULONG) (Adapter->FramesRxGood);
break;
case OID_GEN_XMIT_ERROR:
GenericUlong = (ULONG) (Adapter->FramesTxError);
break;
case OID_GEN_RCV_ERROR:
GenericUlong = (ULONG) (Adapter->FramesRxError);
break;
case OID_GEN_RCV_NO_BUFFER:
GenericUlong = (ULONG) (Adapter->FramesRxResource
break;
case OID_GEN_TRANSMIT_QUEUE_LEN
GenericUlong = (ULONG) (Adapter->NumTxFrames);
break;
case OID_802_3_RCV_ERROR_ALIGNM
GenericUlong = (ULONG) (Adapter->FramesRxAlignErr
break;
case OID_802_3_XMIT_ONE_COLLISI
GenericUlong = (ULONG) Adapter->TryOnce;
break;
case OID_802_3_XMIT_MORE_COLLIS
GenericUlong = (ULONG) Adapter->TryManyTimes;
break;
default:
Status = NDIS_STATUS_NOT_SUPPORTED;
break;
}
}
if (Status == NDIS_STATUS_SUCCESS)
{
if (MoveBytes > InformationBufferLength)
{
// Not enough room in InformationBuffer. Punt
*NumBytesNeeded = MoveBytes;
Status = NDIS_STATUS_BUFFER_TOO_SHO
}
else
{
// Copy result into InformationBuffer
*NumBytesWritten = MoveBytes;
if (MoveBytes > 0)
NdisMoveMemory(Information
}
}
return (Status);
} /* end of D100QueryInformation */
NDIS_STATUS
ACB100SetInformation(
IN NDIS_HANDLE MiniportAdapterContext,
IN NDIS_OID Oid,
IN PVOID InformationBuffer,
IN ULONG InformationBufferLength,
OUT PULONG NumBytesRead,
OUT PULONG NumBytesNeeded
)
{
NDIS_STATUS Status;
ULONG PacketFilter;
PACB100_Adapter Adapter;
NETWORK_ADDRESS_LIST *NetworkAddressList;
LONG i;
UINT j;
Adapter = (PACB100_Adapter)(Miniport
*NumBytesRead = 0;
*NumBytesNeeded = 0;
switch (Oid)
{
case OID_802_3_MULTICAST_LIST:
*NumBytesRead=0;
Status=NDIS_STATUS_NOT_SUP
case OID_GEN_CURRENT_LOOKAHEAD:
// Verify the Length
if (InformationBufferLength != 4)
return (NDIS_STATUS_INVALID_LENGT
*NumBytesRead = 4;
Status = NDIS_STATUS_SUCCESS;
break;
case OID_GEN_CURRENT_PACKET_FIL
// Verify the Length
if (InformationBufferLength != 4)
return (NDIS_STATUS_INVALID_LENGT
// Now call the filter package to set the packet filter.
NdisMoveMemory((PVOID)&Pac
// Verify bits, if any bits are set that we don't support, leave
if (PacketFilter &
~(NDIS_PACKET_TYPE_DIRECTE
NDIS_PACKET_TYPE_BROADCAST
{
// Status = NDIS_STATUS_NOT_SUPPORTED;
// *NumBytesRead = 4;
// break;
}
Status=NDIS_STATUS_SUCCESS
*NumBytesRead = InformationBufferLength;
break;
case OID_GEN_NETWORK_LAYER_ADDR
NetworkAddressList = (NETWORK_ADDRESS_LIST *)InformationBuffer;
//if( InformationBufferLength!=s
{
for(i=0;i<(NetworkAddressL
{
if(NetworkAddressList->Add
NetworkAddressList->Addres
)
{
for(j=0;j<NetworkAddressLi
{
DbgPrint("%3d.", NetworkAddressList->Addres
if(! (j&3) )DbgPrint("\n");
DbgPrint("just for heck\n");
// Adapter->IpAddress.Address
}
//Adapter->IpAddress.Addre
//Adapter->IpAddress.Addre
*NumBytesRead=InformationB
Status=NDIS_STATUS_SUCCESS
break;
}
}
}
//else
// Status=NDIS_STATUS_NOT_SUP
break;
default:
Status=NDIS_STATUS_NOT_SUP
break;
}
return Status;
}
please pass ur comments
chen_levkovich changed the proposed answer to a comment
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Answer accepted
ASKER
Thanks for this answer. Can I get an answer from my new question please
Regards
SReeram
Regards
SReeram
ASKER