1 /*---------------------------------------------------------------------------*
2   Project:  TwlSDK - FS - libraries
3   File:     hook.h
4 
5   Copyright 2007-2008 Nintendo. All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law. They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Date:: 2008-09-18#$
14   $Rev: 8573 $
15   $Author: okubata_ryoma $
16 
17  *---------------------------------------------------------------------------*/
18 
19 
20 #ifndef NITRO_FS_HOOK_H_
21 #define NITRO_FS_HOOK_H_
22 
23 
24 #include <nitro/fs/archive.h>
25 
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 
32 /*---------------------------------------------------------------------------*/
33 /* Constants */
34 
35 typedef u32 FSEvent;
36 #define FS_EVENT_NONE           0x00000000
37 #define FS_EVENT_MEDIA_REMOVED  0x00000001
38 #define FS_EVENT_MEDIA_INSERTED 0x00000002
39 
40 
41 /*---------------------------------------------------------------------------*/
42 /* Declarations */
43 
44 typedef void (*FSEventFunction)(void *userdata, FSEvent event, void *argument);
45 typedef struct FSEventHook
46 {
47     struct FSEventHook *next;
48     FSEventFunction     callback;
49     void               *userdata;
50     FSArchive          *arc;
51 }
52 FSEventHook;
53 
54 
55 /*---------------------------------------------------------------------------*/
56 /* Functions */
57 
58 /*---------------------------------------------------------------------------*
59   Name:         FS_RegisterEventHook
60 
61   Description:  Registers hooks for internal archive events.
62 
63   Arguments:    arc: The archive for which to register
64                 hook: The FSEventHook structure to register
65                 callback: The callback function to invoke when an event occurs
66                 userdata: Arbitrary user-defined data (NULL when this is not required)
67 
68   Returns:      None.
69  *---------------------------------------------------------------------------*/
70 void FS_RegisterEventHook(const char *arc, FSEventHook *hook, FSEventFunction callback, void *userdata);
71 
72 /*---------------------------------------------------------------------------*
73   Name:         FS_UnregisterEventHook
74 
75   Description:  Unregisters hooks for registered internal archived events.
76 
77   Arguments:    hook: A registered FSEventHook structure
78 
79   Returns:      None.
80  *---------------------------------------------------------------------------*/
81 void FS_UnregisterEventHook(FSEventHook *hook);
82 
83 
84 /*---------------------------------------------------------------------------*/
85 
86 
87 #ifdef __cplusplus
88 } /* extern "C" */
89 #endif
90 
91 
92 #endif /* NITRO_FS_HOOK_H_ */
93