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 /* Change to 2, loadable modules now take a TALLOC_CTX * parameter. */
24 #define SMB_PERFCOUNTER_INTERFACE_VERSION 2
26 struct smb_perfcount_data
{
27 struct smb_perfcount_handlers
*handlers
;
31 struct smb_perfcount_handlers
{
32 void (*perfcount_start
) (struct smb_perfcount_data
*pcd
);
33 void (*perfcount_add
) (struct smb_perfcount_data
*pcd
);
34 void (*perfcount_set_op
) (struct smb_perfcount_data
*pcd
, int op
);
35 void (*perfcount_set_subop
) (struct smb_perfcount_data
*pcd
, int subop
);
36 void (*perfcount_set_ioctl
) (struct smb_perfcount_data
*pcd
, int io_ctl
);
37 void (*perfcount_set_msglen_in
) (struct smb_perfcount_data
*pcd
,
39 void (*perfcount_set_msglen_out
) (struct smb_perfcount_data
*pcd
,
41 void (*perfcount_copy_context
) (struct smb_perfcount_data
*pcd
,
42 struct smb_perfcount_data
*new_pcd
);
43 void (*perfcount_defer_op
) (struct smb_perfcount_data
*pcd
,
44 struct smb_perfcount_data
*def_pcd
);
45 void (*perfcount_end
) (struct smb_perfcount_data
*pcd
);
48 bool smb_perfcount_init(void);
50 NTSTATUS
smb_register_perfcounter(int interface_version
, const char *name
,
51 const struct smb_perfcount_handlers
*handlers
);
53 void smb_init_perfcount_data(struct smb_perfcount_data
*pcd
);
55 #define SMB_PERFCOUNT_START(_pcd_) \
56 do {if((_pcd_) && (_pcd_)->handlers) \
57 (_pcd_)->handlers->perfcount_start((_pcd_)); \
60 #define SMB_PERFCOUNT_ADD(_pcd_) \
61 do {if((_pcd_) && (_pcd_)->handlers) \
62 (_pcd_)->handlers->perfcount_add((_pcd_)); \
65 #define SMB_PERFCOUNT_SET_OP(_pcd_,_op_) \
66 do {if((_pcd_) && (_pcd_)->handlers) \
67 (_pcd_)->handlers->perfcount_set_op((_pcd_), (_op_)); \
70 #define SMB_PERFCOUNT_SET_SUBOP(_pcd_,_subop_) \
71 do {if((_pcd_) && (_pcd_)->handlers) \
72 (_pcd_)->handlers->perfcount_set_subop((_pcd_), (_subop_)); \
75 #define SMB_PERFCOUNT_SET_IOCTL(_pcd_,_subop_) \
76 do {if((_pcd_) && (_pcd_)->handlers) \
77 (_pcd_)->handlers->perfcount_set_ioctl((_pcd_), (_subop_)); \
80 #define SMB_PERFCOUNT_SET_MSGLEN_IN(_pcd_,_in_) \
81 do {if((_pcd_) && (_pcd_)->handlers) \
82 (_pcd_)->handlers->perfcount_set_msglen_in((_pcd_), (_in_));\
85 #define SMB_PERFCOUNT_SET_MSGLEN_OUT(_pcd_,_out_) \
86 do {if((_pcd_) && (_pcd_)->handlers) \
87 (_pcd_)->handlers->perfcount_set_msglen_out((_pcd_), (_out_));\
90 #define SMB_PERFCOUNT_COPY_CONTEXT(_pcd_, _new_pcd_) \
91 do {if((_pcd_) && (_pcd_)->handlers) \
92 (_pcd_)->handlers->perfcount_copy_context((_pcd_), (_new_pcd_)); \
95 #define SMB_PERFCOUNT_DEFER_OP(_pcd_, _def_pcd_) \
96 do {if((_pcd_) && (_pcd_)->handlers) \
97 (_pcd_)->handlers->perfcount_defer_op((_pcd_), (_def_pcd_)); \
100 #define SMB_PERFCOUNT_END(_pcd_) \
101 do {if((_pcd_) && (_pcd_)->handlers) \
102 (_pcd_)->handlers->perfcount_end((_pcd_));\
105 #endif /* _SMB_PERFCOUNT_H_ */