~zulcss/samba/server-dailies-3.4

« back to all changes in this revision

Viewing changes to source3/include/smb_perfcount.h

  • Committer: Chuck Short
  • Date: 2010-09-28 20:38:39 UTC
  • Revision ID: zulcss@ubuntu.com-20100928203839-pgjulytsi9ue63x1
Initial version

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
   Unix SMB/CIFS implementation.
 
3
   Portable SMB Messaging statistics interfaces
 
4
   Copyright (C) Todd Stecher (2008)
 
5
 
 
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.
 
10
 
 
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.
 
15
 
 
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/>.
 
18
*/
 
19
 
 
20
#ifndef _SMB_PERFCOUNT_H_
 
21
#define _SMB_PERFCOUNT_H_
 
22
 
 
23
#define SMB_PERFCOUNTER_INTERFACE_VERSION       1
 
24
 
 
25
struct smb_perfcount_data{
 
26
        struct smb_perfcount_handlers *handlers;
 
27
        void *context;
 
28
};
 
29
 
 
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,
 
37
                                         uint64_t in_bytes);
 
38
        void (*perfcount_set_msglen_out) (struct smb_perfcount_data *pcd,
 
39
                                          uint64_t out_bytes);
 
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);
 
47
};
 
48
 
 
49
bool smb_perfcount_init(void);
 
50
 
 
51
NTSTATUS smb_register_perfcounter(int interface_version, const char *name,
 
52
                                  const struct smb_perfcount_handlers *handlers);
 
53
 
 
54
void smb_init_perfcount_data(struct smb_perfcount_data *pcd);
 
55
 
 
56
#define SMB_PERFCOUNT_START(_pcd_) \
 
57
    do {if((_pcd_) && (_pcd_)->handlers) \
 
58
            (_pcd_)->handlers->perfcount_start((_pcd_)); \
 
59
    } while (0)
 
60
 
 
61
#define SMB_PERFCOUNT_ADD(_pcd_) \
 
62
    do {if((_pcd_) && (_pcd_)->handlers) \
 
63
            (_pcd_)->handlers->perfcount_add((_pcd_)); \
 
64
    } while (0)
 
65
 
 
66
#define SMB_PERFCOUNT_SET_OP(_pcd_,_op_) \
 
67
    do {if((_pcd_) && (_pcd_)->handlers) \
 
68
            (_pcd_)->handlers->perfcount_set_op((_pcd_), (_op_)); \
 
69
    } while (0)
 
70
 
 
71
#define SMB_PERFCOUNT_SET_SUBOP(_pcd_,_subop_) \
 
72
    do {if((_pcd_) && (_pcd_)->handlers) \
 
73
            (_pcd_)->handlers->perfcount_set_subop((_pcd_), (_subop_)); \
 
74
    } while (0)
 
75
 
 
76
#define SMB_PERFCOUNT_SET_IOCTL(_pcd_,_subop_) \
 
77
    do {if((_pcd_) && (_pcd_)->handlers) \
 
78
            (_pcd_)->handlers->perfcount_set_ioctl((_pcd_), (_subop_)); \
 
79
    } while (0)
 
80
 
 
81
#define SMB_PERFCOUNT_SET_MSGLEN_IN(_pcd_,_in_) \
 
82
    do {if((_pcd_) && (_pcd_)->handlers) \
 
83
            (_pcd_)->handlers->perfcount_set_msglen_in((_pcd_), (_in_));\
 
84
    } while (0)
 
85
 
 
86
#define SMB_PERFCOUNT_SET_MSGLEN_OUT(_pcd_,_out_) \
 
87
    do {if((_pcd_) && (_pcd_)->handlers) \
 
88
            (_pcd_)->handlers->perfcount_set_msglen_out((_pcd_), (_out_));\
 
89
    } while (0)
 
90
 
 
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_)); \
 
95
    } while (0)
 
96
 
 
97
#define SMB_PERFCOUNT_COPY_CONTEXT(_pcd_, _new_pcd_) \
 
98
    do {if((_pcd_) && (_pcd_)->handlers) \
 
99
            (_pcd_)->handlers->perfcount_copy_context((_pcd_), (_new_pcd_)); \
 
100
    } while (0)
 
101
 
 
102
#define SMB_PERFCOUNT_DEFER_OP(_pcd_, _def_pcd_) \
 
103
    do {if((_pcd_) && (_pcd_)->handlers) \
 
104
            (_pcd_)->handlers->perfcount_defer_op((_pcd_), (_def_pcd_)); \
 
105
    } while (0)
 
106
 
 
107
#define SMB_PERFCOUNT_END(_pcd_) \
 
108
    do {if((_pcd_) && (_pcd_)->handlers) \
 
109
            (_pcd_)->handlers->perfcount_end((_pcd_));\
 
110
    } while (0)
 
111
 
 
112
#endif /* _SMB_PERFCOUNT_H_ */