xref: /xnu-12377.81.4/iokit/Tests/TestServices/TestIOServiceUserNotification.h (revision 043036a2b3718f7f0be807e2870f8f47d3fa0796)
1 #ifndef _IOKIT_TESTIOSERVICEUSERNOTIFICATION_H_
2 #define _IOKIT_TESTIOSERVICEUSERNOTIFICATION_H_
3 
4 #include <IOKit/IOService.h>
5 #include <IOKit/IOUserClient.h>
6 
7 #if DEVELOPMENT || DEBUG
8 
9 class TestIOServiceUserNotification : public IOService {
10 	OSDeclareDefaultStructors(TestIOServiceUserNotification);
11 
12 public:
13 	virtual bool start(IOService *provider) override;
14 	virtual void free() override;
15 
16 	void registerUserNotification(OSObject * notification);
17 	void trimUserNotificationsLocked(void);
18 	size_t getUserNotificationLeakCount(void);
19 
20 private:
21 	OSArray * fUserNotifications;
22 	IOLock * fLock;
23 };
24 
25 class TestIOServiceUserNotificationUserClient : public IOUserClient {
26 	OSDeclareDefaultStructors(TestIOServiceUserNotificationUserClient);
27 
28 public:
29 	bool start(IOService * provider) override;
30 	IONotifier * registerInterest(const OSSymbol * typeOfInterest,
31 	    IOServiceInterestHandler handler,
32 	    void * target, void * ref = NULL) override;
33 	virtual IOReturn clientClose() override;
34 	IOReturn externalMethod(uint32_t selector, IOExternalMethodArguments * args,
35 	    IOExternalMethodDispatch * dispatch, OSObject * target, void * reference) override;
36 private:
37 	TestIOServiceUserNotification * fProvider;
38 };
39 
40 #endif /* DEVELOPMENT || DEBUG */
41 
42 #endif /* _IOKIT_TESTIOSERVICEUSERNOTIFICATION_H_ */
43