Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IO80211Family Headers #13

Draft
wants to merge 27 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
6108378
A lot of fixes - verified to work.
CharlieJiangXXX Dec 7, 2021
22ec677
Make member variables public.
CharlieJiangXXX Dec 7, 2021
5eb3998
Add padding.
CharlieJiangXXX Dec 7, 2021
4ee49ef
More variables.
CharlieJiangXXX Dec 11, 2021
df45555
Add IO80211VirtualInterfaceNamer and functions dealing with data pack…
CharlieJiangXXX Dec 15, 2021
bbec0fa
Add some private error codes and clarify params of TransportRadioPowe…
CharlieJiangXXX Dec 17, 2021
a052ac0
Add more friends.
CharlieJiangXXX Dec 17, 2021
be01bca
The PackData functions now link correctly.
CharlieJiangXXX Dec 20, 2021
50a395b
Add inSelector.
CharlieJiangXXX Dec 20, 2021
7710cc2
Add more stuff.
CharlieJiangXXX Dec 21, 2021
5a23f55
WTF???
CharlieJiangXXX Dec 21, 2021
cc2a344
Fix a memory leak.
CharlieJiangXXX Dec 25, 2021
c3e6055
Fix vtable for Catalina.
CharlieJiangXXX Dec 26, 2021
0578cbb
Add CSR USB Transport.
CharlieJiangXXX Dec 27, 2021
c43b8ad
Add CSR Host Controllers.
CharlieJiangXXX Dec 30, 2021
c801611
Update IOBluetoothHCIRequest.
CharlieJiangXXX Jan 5, 2022
38fb44b
Add private utilities.
CharlieJiangXXX Jan 7, 2022
8ddae5b
Add logs.
CharlieJiangXXX Jan 8, 2022
7b96fe8
Add more variables.
CharlieJiangXXX Jan 14, 2022
988f471
Merge remote-tracking branch 'refs/remotes/origin/master'
CharlieJiangXXX Jan 14, 2022
29f1018
Clarify function.
CharlieJiangXXX Jan 14, 2022
d4d101e
Significant improvements based on IO80211Family.
CharlieJiangXXX Jan 25, 2022
36bcaa3
.
CharlieJiangXXX Jan 25, 2022
437ce83
Somehow the database cannot be committed...
CharlieJiangXXX Jan 25, 2022
75b6003
Capture the guy walking on the sky with core magic :)
CharlieJiangXXX Jan 31, 2022
3b08be4
Add a huge bunch more stuff.
CharlieJiangXXX Feb 12, 2022
33c6bf2
Work on interfaces.
CharlieJiangXXX Mar 3, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions Headers/IOKit/80211/Apple80211.h

This file was deleted.

626 changes: 346 additions & 280 deletions Headers/IOKit/80211/IO80211Controller.h

Large diffs are not rendered by default.

85 changes: 85 additions & 0 deletions Headers/IOKit/80211/IO80211FlowQueue.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/*
* Released under "The BSD 3-Clause License"
*
* Copyright (c) 2021 cjiang. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* 3. The names of its contributors may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/

#ifndef _IO80211FLOWQUEUE_H
#define _IO80211FLOWQUEUE_H

#include <IOKit/network/IOEthernetController.h>
#include <IOKit/80211/apple80211_var.h>

struct IO80211FlowQueueHash
{
UInt8 ac;
UInt8 interface;
ether_addr address;
} __attribute__((packed));

class IO80211FlowQueue : public OSObject
{
OSDeclareDefaultStructors( IO80211FlowQueue )

public:
virtual UInt32 enqueuePacket( mbuf_t packet );
virtual UInt32 queueSpace();
virtual UInt32 queueSize();
virtual UInt32 pendingPackets();
virtual void pause();
virtual void unPause();
virtual bool isPaused();
virtual UInt32 DEBUG_totalStagedPackets();
virtual UInt32 DEBUG_curStagedPackets();
virtual UInt32 print( void * userPrintCtx );

protected:
IO80211FlowQueueHash _hash; // 16
void * _buf; // 24
bool _paused; // 32
};

class IO80211FlowQueueLegacy : public IO80211FlowQueue
{
OSDeclareDefaultStructors( IO80211FlowQueueLegacy )

public:
IO80211FlowQueueLegacy * withParamaters( const ether_addr & address, UInt8 ac, UInt8 interface );
bool initWithParamaters( const ether_addr & address, UInt8 ac, UInt8 interface );

virtual UInt32 enqueuePacket( mbuf_t packet ) APPLE_KEXT_OVERRIDE;

virtual UInt32 queueSpace() APPLE_KEXT_OVERRIDE;
virtual UInt32 queueSize() APPLE_KEXT_OVERRIDE;

virtual bool isPaused() APPLE_KEXT_OVERRIDE;
};

#endif
81 changes: 81 additions & 0 deletions Headers/IOKit/80211/IO80211FlowQueueDatabase.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/*
* Released under "The BSD 3-Clause License"
*
* Copyright (c) 2021 cjiang. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* 3. The names of its contributors may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/

#ifndef _IO80211FLOWQUEUEDATBASE_H
#define _IO80211FLOWQUEUEDATBASE_H

#include <IOKit/80211/IO80211FlowQueue.h>

typedef bool (*IO80211FlowQueueResultAction)( IO80211FlowQueue * queue, void * arg );
typedef void (*IO80211FlowQueueAction)( IO80211FlowQueue * queue, void * arg );

class IO80211FlowQueueDatabase : public OSObject
{
OSDeclareDefaultStructors( IO80211FlowQueueDatabase )

public:
virtual bool init() APPLE_KEXT_OVERRIDE;
virtual void free() APPLE_KEXT_OVERRIDE;

void lockDatabase();
void unlockDatabase();

IOReturn insert( IO80211FlowQueue * que );
void remove( UInt64 hash );

IO80211FlowQueue * map( IO80211FlowQueueResultAction action, void * arg );
IO80211FlowQueue * find( IO80211FlowQueueResultAction action, void * arg );
IO80211FlowQueue * find( UInt64 hash );
void flush( IO80211FlowQueueAction action, void * arg );

UInt32 pendingPackets( UInt8 interface );
UInt32 packetSpace( UInt8 interface );
UInt32 queueSize( UInt8 interface );

UInt32 print( void * userPrintCtx );

protected:
/*! @var _dataBase
* The data base in which all flow queues of this object are stored. */

IO80211FlowQueue * _dataBase[200]; // 16

/*! @var _foundQueue
* The result request found in find() will be stored in this member variable so as to accelerate the next find request. */

IO80211FlowQueue * _foundQueue; // 1616
SInt32 _queueSize; // 1624
IOSimpleLock * _dataBaseLock; // 1632
};

#endif
Loading