阅读:2719回复:3
如何在passthru构造自己的IP包和Indicate?
1。在MPInitialize中初始一个Timer。
2。当MPSend收到某特殊数据,即if(...)成立,调用 NdisMSetPeriodicTimer, 每0.1秒,系统调用 MacTimerFunction一次。 3。在MacTimerFunction中,构造MAC ,IP, UDP and data,并调用PtReceive。 不知小弟表达是否清楚。 问题1.应用层收不到数据,问题出在什么地方? 2.本地连接状态的小green灯也不闪,小green灯由哪层控制? 小弟已无技可使.真郁闷,快救小弟一命啊 ! 20分立马兑现. NDIS_STATUS MPInitialize(....) { NdisMInitializeTimer(&pAdapt->Timer , pAdapt->MiniportHandle, MacTimerFunction, pAdapt); } NDIS_STATUS MPSend(....) { if(...) { NdisMSetPeriodicTimer(&pAdapt->Timer,100); } } VOID MacTimerFunction( IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3 ) { PADAPT pAdapt = (PADAPT)FunctionContext; NDIS_HANDLE ProtocolBindingContext; NDIS_HANDLE MacReceiveContext; PUCHAR HeaderBuffer; UINT HeaderBufferSize; PUCHAR LookAheadBuffer; UINT LookAheadBufferSize; UINT PacketSize; ProtocolBindingContext=pAdapt; MacReceiveContext=pAdapt->MacReceiveContext; HeaderBuffer=pAdapt->HeaderBuffer; HeaderBufferSize=0xE; LookAheadBuffer = HeaderBuffer+0xE; LookAheadBufferSize=0x2e; PacketSize=0x2e; // fill the header of MAC ,IP, UDP and data .... PtReceive(ProtocolBindingContext, MacReceiveContext, HeaderBuffer, HeaderBufferSize, LookAheadBuffer, LookAheadBufferSize, PacketSize); } |
|
沙发#
发布于:2001-09-11 08:23
为什么要调用ptreceive呢?调用NdisMIndicateReceivePacket就行了。
|
|
|
板凳#
发布于:2001-09-11 09:22
调用ptreceive和NdisMEthIndicateReceive并没有区别,其他函数
未起作用。 如果NdisMEthIndicateReceive不成功, NdisMIndicateReceivePacket,也不可能成功。 不知Dino是否有过这方面尝试? 请赐教。嘿嘿,20分现在还不能给。 |
|
地板#
发布于:2001-09-12 10:30
.....
NdisAllocateBuffer(&StatusBuffer, &MyBuffer, pAdapt->BufferPoolHandle, pAdapt->receive, 1518); NdisChainBufferAtBack(MyPacket,MyBuffer); NdisMoveMemory(pAdapt->receive, pAdapt->szBuffer, pAdapt->packetsize); NdisAdjustBufferLength(MyBuffer,pAdapt->packetsize); NDIS_SET_PACKET_STATUS(MyPacket,NDIS_STATUS_RESOURCES); NdisMIndicateReceivePacket(pAdapt->MiniportHandle, &MyPacket, 1); ...... 不知以上步骤是否正确处理? 还缺什么样? pAdapt->szBuffer 中应包括哪些数据? 还请高手赐教. |
|