⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 headers.h

📁 Vitual Ring Routing 管你知不知道
💻 H
📖 第 1 页 / 共 5 页
字号:
    uchar State;                // State: ref VRR_NCE_STATE_
    VRRIf LocIF;                // Our IFid that heard neighbor's VrrHello message.
    uint Flags;                 // Sundry items. See "VRR_NCE_FLAG_"
    Time Timeout;               // For aging, e.g. hold in state fail for required period.
    Time TimeLastHello;         // Time at which Hello last received from this neighbor.
    Link AdjOut;                // Keep wcett state in NCE instead of in MCL LC.
    Link AdjIn;                 // Keep wcett state in NCE instead of in MCL LC.
    uint LastWcettBandwidth;    // Snap last wcett bandwidth calc (max in last sample period).
    uint BitsPerSec;            // Expected throughput in bits/sec based on ETT.
    uint Rssi;                  // Exponentially weighted moving average of RSSI.
    uint CountFailRexmit;       // Number of times NCE failed due to excess rexmit attempts.
    uint CountFailHelloLoss;    // Number of times NCE failed due to excessive missed hellos.
    uint CountFailQoSEvict;     // Number of times NCE failed due to QoS eviction threshold;
    uint CountFailHelloFail;    // Number of times NCE failed because neighbor failed the link.
    uint ETTAthMSRC;            // Last ETT reported by AthMSRC.
    Time LastUnicastCompletion; // Time in ms at which last successful unicast completed.
    uint AveUsedBitsPerSecond;  // Only for 802.11 drivers supporting OID_MSRC_QUERY_SIB_TABLE
    
};

struct NeighborCache {
    KSPIN_LOCK Lock;
    NeighborCacheEntry *FirstNCE;
    NeighborCacheEntry *LastNCE;
    uint Count;                 // Count of NCE in list, excluding NC (SentinelNCE) itself.
    uint CountLinked;           // Count of NCE==LINKED as at time of last NeighborCacheTimeout.

};

__inline NeighborCacheEntry *
SentinelNCE(NeighborCache *NC)
{
    return (NeighborCacheEntry *) &NC->FirstNCE;
}

extern void
NeighborCacheInit(NeighborCache *NC);

extern void
AddRefNCE(NeighborCacheEntry *NCE);

extern void
ReleaseNCE(NeighborCacheEntry *NCE);

extern void
NeighborCacheCleanup(NeighborCache *NC);

extern void
NeighborCacheFlushAddress(NeighborCache *NC, const VirtualAddress VAddr,
                          VRRIf RemIF);

extern boolint
NeighborFindPhysical(NeighborCache *NC, const VirtualAddress VAddr,
                     VRRIf RemIF, PhysicalAddress PAddr);

extern NeighborCacheEntry *
FindNCE(
    NeighborCache *NC,
    const VirtualAddress VAddr,
    VRRIf LocIF,
    VRRIf RemIF,
    uchar States);


NeighborCacheEntry *
CreateNCE(
    NeighborCache *NC,
    const VirtualAddress VAddr,
    VRRIf LocIF,
    VRRIf RemIF);

extern void
SalvagePacketsFromMaintBuf(
    MiniportAdapter *VA,
    VirtualAddress Address,
    VRRIf LocIF,
    VRRIf RemIF);

extern void
FailNCE(
    NeighborCacheEntry *NCE,
    Time Now);

void
FailAllNCE(
    NeighborCache *NC,
    Time Now);

extern void
SaveCompletionTime(
    MiniportAdapter *VA,
    PNDIS_PACKET Packet,         // Packet that was sent.
    NDIS_STATUS Status);         // Final status of send.

//
// Functionality in pback.c
//
// Currently the piggy-back cache uses a simple sorted list
// of options waiting to be sent. We expect the cache size
// to be small - in a lightly-loaded system not many options
// are sent, and in a highly-loaded system many packets are
// sent and so options leave the cache quickly.
//

typedef struct PbackOption PbackOption;

struct PbackOption {
    PbackOption *Next;
    VirtualAddress Dest;
    InternalOption *Opt;
    Time Timeout;
    TxToken Token;
};

typedef struct PbackCache {
    KSPIN_LOCK Lock;
    PbackOption *List;

    uint Number;
    uint HighWater;
    Time AckMaxDupTime;

    uint CountPbackReply;
    uint CountAloneReply;
    uint CountPbackError;
    uint CountAloneError;
    uint CountPbackInfo;
    uint CountAloneInfo;
} PbackCache;

extern void
PbackInit(MiniportAdapter *VA);

extern void
PbackCleanup(MiniportAdapter *VA);

extern void
PbackResetStatistics(MiniportAdapter *VA);

extern void
MsgQueueMessage(MiniportAdapter *VA, VirtualAddress Dest, InternalOption *Opt, 
                VRRIf LocIF, VRRIf RemIF, Time Timeout, TxToken *SRToken);

extern void
MsgLoadSRPfromPCache(MiniportAdapter *VA, SRPacket *SRP);

extern void
MsgFailLink(
    MiniportAdapter *VA,
    VirtualAddress Address,
    VRRIf LocIF,
    VRRIf RemIF);

extern Time
MessageTimeout(MiniportAdapter *VA, Time Now);

extern uint
PbackPacketSize(SRPacket *SRP);


//
// Functionality in wcett.c
//

struct WcettParams {
    uint ProbePeriod; 
    uint LossInterval;
    uint Alpha;
    uint PenaltyFactor;
    Time ProbeTimeout;
    uint Beta;
    uint PktPairProbePeriod;
    uint PktPairMinOverProbes;
};

extern void 
WcettInitLinkMetric(
    MiniportAdapter *VA,
    int SNode,
    Link *Link, 
    Time Now);

extern void
WcettInit(MiniportAdapter *VA);

extern void
WcettPenalize(MiniportAdapter *VA, Link *Adj);

extern Time
WcettSendPktPairProbes(
    MiniportAdapter *VA,
    Time Now);

extern void
WcettReceiveProbe(MiniportAdapter *VA, InternalProbe *Probe, VRRIf InIf);

extern void
WcettReceivePktPairProbeReply(MiniportAdapter *VA,
                              InternalProbeReply *ProbeReply);

extern uint
WcettEncodeBandwidth(uint Bandwidth);

extern uint
WcettDecodeBandwidth(uint Bandwidth);

extern boolint
WcettIsInfinite(uint Metric);

extern uint
WcettConvETT(uint LinkMetric);

extern NDIS_STATUS
WcettAddProbe(
    MiniportAdapter *VA,
    Link *Link);

extern void
WcettUpdateMetric(
    MiniportAdapter *VA,
    Link *Link,
    boolint Penalty);

//
// Functionality in pktpair.c.
//

struct PktPairParams {
    uint Alpha; 
    uint ProbePeriod; 
    uint PenaltyFactor;
}; 

extern void 
PktPairInit(MiniportAdapter *VA);

void
PktPairSendProbeReply(
    MiniportAdapter *VA, 
    InternalProbe *Probe, 
    Time Now, 
    Time OutDelta);

NDIS_STATUS
PktPairCreateProbePacket(
    MiniportAdapter *VA,
    Link *Adjacent,
    Time Timestamp,
    NDIS_PACKET **ReturnPacket,
    uint Seq,
    boolint LargeProbe,
    MetricType ProbeType);

void
PktPairSendProbeComplete(
    MiniportAdapter *VA,
    NDIS_PACKET *Packet,
    NDIS_STATUS Status);


//
// VRR: definitions for VrrHello
//
typedef struct VrrHelloParams VrrHelloParams;
struct VrrHelloParams {
    Time HelloTimeout;
};

extern void VrrHelloInit(
    MiniportAdapter *VA);

extern Time
SendHellos(
    MiniportAdapter *VA,
    Time Now);

extern void
ReceiveHello(
    MiniportAdapter *VA,
    ProtocolAdapter *PA,
    SRPacket *srp);

extern Time
NeighborCacheTimeout(
    MiniportAdapter *VA,
    Time Now);


extern boolint
RandomPhysicalNeighbor(
    MiniportAdapter *VA,
    VirtualAddress NeighborAddress);

extern UCHAR
QoSToNCEStateTransition(
    MiniportAdapter *VA,
    NeighborCacheEntry *NCE);
    
//
// Functionality in crypto.c.
//

#define AES_KEYSIZE_128 (16)

#define CRYPTO_KEY_MAC_LENGTH   16

#if BUILD_CRYPTO // DDK
extern void
CryptoKeyMACModify(MiniportAdapter *VA, uchar Key[VRR_KEY_SIZE]);

extern void
CryptoMAC(uchar CryptoKeyMAC[CRYPTO_KEY_MAC_LENGTH],
          uchar *MAC, uint Length,
          NDIS_PACKET *Packet, uint Offset);
#endif

extern NDIS_STATUS
CryptoEncryptPacket(MiniportAdapter *VA, NDIS_PACKET *OrigPacket,
                    uint Offset,
                    uchar IV[VRR_IV_LENGTH], NDIS_PACKET **pEncryptedPacket);

extern NDIS_STATUS
CryptoDecryptPacket(MiniportAdapter *VA, NDIS_PACKET *OrigPacket,
                    uint OrigOffset, uint DecryptOffset,
                    uchar IV[VRR_IV_LENGTH], NDIS_PACKET **pDecryptedPacket);

//
// NDIS-related helper functions, in ndishack.c.
//

typedef struct PacketContext {
    union {
        void (*TransmitComplete)(MiniportAdapter *VA, NDIS_PACKET *Packet, NDIS_STATUS Status);
        void (*ReceiveComplete)(MiniportAdapter *VA, SRPacket *srp, NDIS_STATUS Status);
    };
    NDIS_PACKET *OrigPacket;
    NDIS_BUFFER *OrigBuffer;
    void *CloneData;
    union {
        SRPacket *srp;
        MaintBufPacket *MBP;
    };
    ProtocolAdapter *PA;
} PacketContext;

__inline PacketContext *
PC(NDIS_PACKET *Packet)
{
    return (PacketContext *)Packet->ProtocolReserved;
}

extern NDIS_STATUS
NdisClonePacket(NDIS_PACKET *OrigPacket,
                NDIS_HANDLE PacketPool, NDIS_HANDLE BufferPool,
                uint OrigHeaderLength, uint CloneHeaderLength,
                uint LookAhead,
                void **pOrigHeader,
                NDIS_PACKET **pClonePacket, void **pCloneHeader);

extern void
NdisFreePacketClone(NDIS_PACKET *ClonePacket);

extern NDIS_STATUS
NdisMakeEmptyPacket(NDIS_HANDLE PacketPool, NDIS_HANDLE BufferPool,
                    uint Size,
                    NDIS_PACKET **pPacket, void **pData);

//
// Hack around problems and limitations in the NDIS interface,
// by relying on knowledge of internal NDIS data structures.
//

__inline PNDIS_BUFFER
NdisFirstBuffer(PNDIS_PACKET Packet)
{
    return Packet->Private.Head;
}

extern void
NdisAdjustBuffer(NDIS_BUFFER *Buffer, void *Address, uint Length);

extern NDIS_HANDLE
NdisProtocolFromBindContext(NDIS_HANDLE BindContext);

extern void **
NdisReservedFieldInProtocol(NDIS_HANDLE Protocol);

//
// Functionality in node.c.
//

//
// The Node Table Entry represents a single VRR node.
// Note that a single NTE may appear twice in our VSet,
// once on LHS and once on RHS, iff the VSet is wrapped.
//
struct NodeTableEntry {         // NTE:
    NodeTableEntry *Next;
    NodeTableEntry *Prev;
    uint RefCnt;                // Reference counting on struct NTE.
    VirtualAddress Address;
    uchar State;                // Used only in hello message. Ref "#define VRR_NTE_STATE_"
                                // Definitive state is in VA->Driver[Initialized|Active] etc.
    uchar Flags;                // State of NTE. Ref "#define VRR_NTE_FLAG_"
    uint ReconnectAttempts;     // Probes to neighbor of suspect connectivity. 
    Time Timeout;               // Time at which State expires.
};

struct NodeTable {
    KSPIN_LOCK Lock;
    NodeTableEntry *FirstNTE;
    NodeTableEntry *LastNTE;

    AddressList *VSetLeft;      // VRR addresses of VSet members to our left.
    AddressList *VSetRight;     // VRR addresses of VSet members to our right.

    uint Count;                 // Total NTE count.
    uint CountLeft;             // Count of NTE to LHS of self on the list, excluding SentinelNTE.
    uint CountRight;            // Count of NTE to RHS of self on the list, excluding SentinelNTE.

    NodeTableEntry *Self;       // NTE representing the VA that owns this Node Table.
    uint DHTQueryVSet;          // Non-zero if unsolicited DHT_QUERY_VSET required.

};

struct AddressList {
    struct AddressList *Next;
    VirtualAddress Address;
};

struct ProbeListEntry {        // PLE:
    ProbeListEntry *Next;
    ProbeListEntry *Prev;
    
    VirtualAddress Address;    // Address of node to which we are sending SetupRequests.
    uint RexmitCount;          // Number of remaining retries.
    Time Timeout;
    uchar SRDirection;         // Forced direction around ring perimeter or VRR_SR_DIRECT_EITHER.
    AddressList *SRcAntiRoute; // Source AntiRoute: addresses to be avoided because they Nacked our SetupReq.
    uint FrameSeqNo;           // Used to identify both SR and corresponding SRNack.
};

struct ProbeList {             // PL:
    //KSPIN_LOCK Lock;     // N.B. Use NT->Lock for probe list.
    ProbeListEntry *FirstPLE;
    ProbeListEntry *LastPLE;
    uint Count;
};

__inline ProbeListEntry *
SentinelPLE(ProbeList *PL)
{
    return (ProbeListEntry *) &PL->FirstPLE;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -