2 Unix SMB/CIFS implementation.
3 Portable SMB Messaging statistics interfaces
4 Copyright (C) Todd Stecher (2008)
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef _SMB_PERFCOUNT_H_
21 #define _SMB_PERFCOUNT_H_
23 #define SMB_PERFCOUNTER_INTERFACE_VERSION 1
25 struct smb_perfcount_data
{
26 struct smb_perfcount_handlers
*handlers
;
30 struct smb_perfcount_handlers
{
31 void (*perfcount_start
) (struct smb_perfcount_data
*pcd
);
32 void (*perfcount_add
) (struct smb_perfcount_data
*pcd
);
33 void (*perfcount_set_op
) (struct smb_perfcount_data
*pcd
, int op
);
34 void (*perfcount_set_subop
) (struct smb_perfcount_data
*pcd
, int subop
);
35 void (*perfcount_set_ioctl
) (struct smb_perfcount_data
*pcd
, int io_ctl
);
36 void (*perfcount_set_msglen_in
) (struct smb_perfcount_data
*pcd
,
38 void (*perfcount_set_msglen_out
) (struct smb_perfcount_data
*pcd
,
40 void (*perfcount_set_client
) (struct smb_perfcount_data
*pcd
, uid_t uid
,
41 const char *user
, const char *domain
);
42 void (*perfcount_copy_context
) (struct smb_perfcount_data
*pcd
,
43 struct smb_perfcount_data
*new_pcd
);
44 void (*perfcount_defer_op
) (struct smb_perfcount_data
*pcd
,
45 struct smb_perfcount_data
*def_pcd
);
46 void (*perfcount_end
) (struct smb_perfcount_data
*pcd
);
49 bool smb_perfcount_init(void);
51 NTSTATUS
smb_register_perfcounter(int interface_version
, const char *name
,
52 const struct smb_perfcount_handlers
*handlers
);
54 void smb_init_perfcount_data(struct smb_perfcount_data
*pcd
);
56 #define SMB_PERFCOUNT_START(_pcd_) \
57 do {if((_pcd_) && (_pcd_)->handlers) \
58 (_pcd_)->handlers->perfcount_start((_pcd_)); \
61 #define SMB_PERFCOUNT_ADD(_pcd_) \
62 do {if((_pcd_) && (_pcd_)->handlers) \
63 (_pcd_)->handlers->perfcount_add((_pcd_)); \
66 #define SMB_PERFCOUNT_SET_OP(_pcd_,_op_) \
67 do {if((_pcd_) && (_pcd_)->handlers) \
68 (_pcd_)->handlers->perfcount_set_op((_pcd_), (_op_)); \
71 #define SMB_PERFCOUNT_SET_SUBOP(_pcd_,_subop_) \
72 do {if((_pcd_) && (_pcd_)->handlers) \
73 (_pcd_)->handlers->perfcount_set_subop((_pcd_), (_subop_)); \
76 #define SMB_PERFCOUNT_SET_IOCTL(_pcd_,_subop_) \
77 do {if((_pcd_) && (_pcd_)->handlers) \
78 (_pcd_)->handlers->perfcount_set_ioctl((_pcd_), (_subop_)); \
81 #define SMB_PERFCOUNT_SET_MSGLEN_IN(_pcd_,_in_) \
82 do {if((_pcd_) && (_pcd_)->handlers) \
83 (_pcd_)->handlers->perfcount_set_msglen_in((_pcd_), (_in_));\
86 #define SMB_PERFCOUNT_SET_MSGLEN_OUT(_pcd_,_out_) \
87 do {if((_pcd_) && (_pcd_)->handlers) \
88 (_pcd_)->handlers->perfcount_set_msglen_out((_pcd_), (_out_));\
91 #define SMB_PERFCOUNT_SET_CLIENT(_pcd_,_uid_, _user_, _domain_) \
92 do {if((_pcd_) && (_pcd_)->handlers) \
93 (_pcd_)->handlers->perfcount_set_client((_pcd_), (_uid_), \
94 (_user_), (_domain_)); \
97 #define SMB_PERFCOUNT_COPY_CONTEXT(_pcd_, _new_pcd_) \
98 do {if((_pcd_) && (_pcd_)->handlers) \
99 (_pcd_)->handlers->perfcount_copy_context((_pcd_), (_new_pcd_)); \
102 #define SMB_PERFCOUNT_DEFER_OP(_pcd_, _def_pcd_) \
103 do {if((_pcd_) && (_pcd_)->handlers) \
104 (_pcd_)->handlers->perfcount_defer_op((_pcd_), (_def_pcd_)); \
107 #define SMB_PERFCOUNT_END(_pcd_) \
108 do {if((_pcd_) && (_pcd_)->handlers) \
109 (_pcd_)->handlers->perfcount_end((_pcd_));\
112 #endif /* _SMB_PERFCOUNT_H_ */