diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/Makefile.in | 3 | ||||
-rw-r--r-- | source3/include/includes.h | 3 | ||||
-rw-r--r-- | source3/include/proto.h | 10 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/ndr_perfcount.c | 493 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/ndr_perfcount.h | 26 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/perfcount.h | 129 | ||||
-rw-r--r-- | source3/librpc/idl/perfcount.idl | 172 | ||||
-rw-r--r-- | source3/registry/reg_perfcount.c | 128 | ||||
-rw-r--r-- | source3/rpc_parse/parse_misc.c | 42 |
9 files changed, 912 insertions, 94 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in index 26b33639e4..b552a9b84c 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -593,6 +593,7 @@ REG_FULL_OBJ = $(REG_SMBCONF_OBJ) \ $(REG_INIT_FULL_OBJ) \ registry/reg_eventlog.o \ registry/reg_perfcount.o \ + librpc/gen_ndr/ndr_perfcount.o \ registry/reg_util_legacy.o LIB_EVENTLOG_OBJ = lib/eventlog/eventlog.o @@ -1395,7 +1396,7 @@ samba3-idl:: @PIDL_OUTPUTDIR="librpc/gen_ndr" PIDL_ARGS="$(PIDL_ARGS)" CPP="$(CPP)" PIDL="../pidl/pidl" \ srcdir="$(srcdir)" $(srcdir)/script/build_idl.sh \ librpc/idl/messaging.idl librpc/idl/libnetapi.idl librpc/idl/notify.idl \ - librpc/idl/wbint.idl + librpc/idl/wbint.idl librpc/idl/perfcount.idl ##################################################################### diff --git a/source3/include/includes.h b/source3/include/includes.h index 71125140be..453c8b3f29 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -672,8 +672,7 @@ struct smb_iconv_convenience *lp_iconv_convenience(void *lp_ctx); #include "ntdomain.h" #include "reg_objects.h" #include "reg_db.h" -#include "rpc_perfcount.h" -#include "rpc_perfcount_defs.h" +#include "librpc/gen_ndr/perfcount.h" #include "librpc/gen_ndr/notify.h" #include "librpc/gen_ndr/xattr.h" #include "librpc/gen_ndr/messaging.h" diff --git a/source3/include/proto.h b/source3/include/proto.h index ba2f42688d..530f167df6 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -5131,18 +5131,18 @@ uint32 reg_perfcount_get_last_help(uint32 last_counter); uint32 reg_perfcount_get_counter_help(uint32 base_index, char **retbuf); uint32 reg_perfcount_get_counter_names(uint32 base_index, char **retbuf); bool _reg_perfcount_get_counter_data(TDB_DATA key, TDB_DATA *data); -bool _reg_perfcount_get_instance_info(PERF_INSTANCE_DEFINITION *inst, +bool _reg_perfcount_get_instance_info(struct PERF_INSTANCE_DEFINITION *inst, prs_struct *ps, int instId, - PERF_OBJECT_TYPE *obj, + struct PERF_OBJECT_TYPE *obj, TDB_CONTEXT *names); -bool _reg_perfcount_add_instance(PERF_OBJECT_TYPE *obj, +bool _reg_perfcount_add_instance(struct PERF_OBJECT_TYPE *obj, prs_struct *ps, int instInd, TDB_CONTEXT *names); uint32 reg_perfcount_get_perf_data_block(uint32 base_index, prs_struct *ps, - PERF_DATA_BLOCK *block, + struct PERF_DATA_BLOCK *block, const char *object_ids); WERROR reg_perfcount_get_hkpd(prs_struct *ps, uint32 max_buf_size, uint32 *outbuf_len, const char *object_ids); @@ -5636,8 +5636,6 @@ NTSTATUS cli_do_rpc_ndr(struct rpc_pipe_client *cli, /* The following definitions come from rpc_parse/parse_misc.c */ bool smb_io_time(const char *desc, NTTIME *nttime, prs_struct *ps, int depth); -bool smb_io_system_time(const char *desc, prs_struct *ps, int depth, SYSTEMTIME *systime); -bool make_systemtime(SYSTEMTIME *systime, struct tm *unixtime); bool smb_io_uuid(const char *desc, struct GUID *uuid, prs_struct *ps, int depth); diff --git a/source3/librpc/gen_ndr/ndr_perfcount.c b/source3/librpc/gen_ndr/ndr_perfcount.c new file mode 100644 index 0000000000..9944434920 --- /dev/null +++ b/source3/librpc/gen_ndr/ndr_perfcount.c @@ -0,0 +1,493 @@ +/* parser auto-generated by pidl */ + +#include "includes.h" +#include "librpc/gen_ndr/ndr_perfcount.h" + +static enum ndr_err_code ndr_push_SYSTEMTIME(struct ndr_push *ndr, int ndr_flags, const struct SYSTEMTIME *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 2)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->year)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->month)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->dayofweek)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->day)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->hour)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->minute)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->second)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->milliseconds)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_SYSTEMTIME(struct ndr_pull *ndr, int ndr_flags, struct SYSTEMTIME *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 2)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->year)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->month)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->dayofweek)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->day)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->hour)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->minute)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->second)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->milliseconds)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_SYSTEMTIME(struct ndr_print *ndr, const char *name, const struct SYSTEMTIME *r) +{ + ndr_print_struct(ndr, name, "SYSTEMTIME"); + ndr->depth++; + ndr_print_uint16(ndr, "year", r->year); + ndr_print_uint16(ndr, "month", r->month); + ndr_print_uint16(ndr, "dayofweek", r->dayofweek); + ndr_print_uint16(ndr, "day", r->day); + ndr_print_uint16(ndr, "hour", r->hour); + ndr_print_uint16(ndr, "minute", r->minute); + ndr_print_uint16(ndr, "second", r->second); + ndr_print_uint16(ndr, "milliseconds", r->milliseconds); + ndr->depth--; +} + +_PUBLIC_ enum ndr_err_code ndr_push_PERF_COUNTER_DEFINITION(struct ndr_push *ndr, int ndr_flags, const struct PERF_COUNTER_DEFINITION *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->ByteLength)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->CounterNameTitleIndex)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->CounterNameTitlePointer)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->CounterHelpTitleIndex)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->CounterHelpTitlePointer)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->DefaultScale)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->DetailLevel)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->CounterType)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->CounterSize)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->CounterOffset)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_PERF_COUNTER_DEFINITION(struct ndr_pull *ndr, int ndr_flags, struct PERF_COUNTER_DEFINITION *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->ByteLength)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->CounterNameTitleIndex)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->CounterNameTitlePointer)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->CounterHelpTitleIndex)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->CounterHelpTitlePointer)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->DefaultScale)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->DetailLevel)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->CounterType)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->CounterSize)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->CounterOffset)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_PERF_COUNTER_DEFINITION(struct ndr_print *ndr, const char *name, const struct PERF_COUNTER_DEFINITION *r) +{ + ndr_print_struct(ndr, name, "PERF_COUNTER_DEFINITION"); + ndr->depth++; + ndr_print_uint32(ndr, "ByteLength", r->ByteLength); + ndr_print_uint32(ndr, "CounterNameTitleIndex", r->CounterNameTitleIndex); + ndr_print_uint32(ndr, "CounterNameTitlePointer", r->CounterNameTitlePointer); + ndr_print_uint32(ndr, "CounterHelpTitleIndex", r->CounterHelpTitleIndex); + ndr_print_uint32(ndr, "CounterHelpTitlePointer", r->CounterHelpTitlePointer); + ndr_print_uint32(ndr, "DefaultScale", r->DefaultScale); + ndr_print_uint32(ndr, "DetailLevel", r->DetailLevel); + ndr_print_uint32(ndr, "CounterType", r->CounterType); + ndr_print_uint32(ndr, "CounterSize", r->CounterSize); + ndr_print_uint32(ndr, "CounterOffset", r->CounterOffset); + ndr->depth--; +} + +_PUBLIC_ enum ndr_err_code ndr_push_PERF_COUNTER_BLOCK(struct ndr_push *ndr, int ndr_flags, const struct PERF_COUNTER_BLOCK *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->ByteLength)); + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->data, r->ByteLength)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_PERF_COUNTER_BLOCK(struct ndr_pull *ndr, int ndr_flags, struct PERF_COUNTER_BLOCK *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->ByteLength)); + NDR_PULL_ALLOC_N(ndr, r->data, r->ByteLength); + NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->data, r->ByteLength)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_PERF_COUNTER_BLOCK(struct ndr_print *ndr, const char *name, const struct PERF_COUNTER_BLOCK *r) +{ + ndr_print_struct(ndr, name, "PERF_COUNTER_BLOCK"); + ndr->depth++; + ndr_print_uint32(ndr, "ByteLength", r->ByteLength); + ndr_print_array_uint8(ndr, "data", r->data, r->ByteLength); + ndr->depth--; +} + +_PUBLIC_ enum ndr_err_code ndr_push_PERF_INSTANCE_DEFINITION(struct ndr_push *ndr, int ndr_flags, const struct PERF_INSTANCE_DEFINITION *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 5)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->ByteLength)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->ParentObjectTitleIndex)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->ParentObjectTitlePointer)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->UniqueID)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->NameOffset)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->NameLength)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->data)); + NDR_CHECK(ndr_push_PERF_COUNTER_BLOCK(ndr, NDR_SCALARS, &r->counter_data)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->data) { + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, *r->data)); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_PERF_INSTANCE_DEFINITION(struct ndr_pull *ndr, int ndr_flags, struct PERF_INSTANCE_DEFINITION *r) +{ + uint32_t _ptr_data; + TALLOC_CTX *_mem_save_data_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 5)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->ByteLength)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->ParentObjectTitleIndex)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->ParentObjectTitlePointer)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->UniqueID)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->NameOffset)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->NameLength)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data)); + if (_ptr_data) { + NDR_PULL_ALLOC(ndr, r->data); + } else { + r->data = NULL; + } + NDR_CHECK(ndr_pull_PERF_COUNTER_BLOCK(ndr, NDR_SCALARS, &r->counter_data)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->data) { + _mem_save_data_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->data, 0); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, r->data)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, 0); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_PERF_INSTANCE_DEFINITION(struct ndr_print *ndr, const char *name, const struct PERF_INSTANCE_DEFINITION *r) +{ + ndr_print_struct(ndr, name, "PERF_INSTANCE_DEFINITION"); + ndr->depth++; + ndr_print_uint32(ndr, "ByteLength", r->ByteLength); + ndr_print_uint32(ndr, "ParentObjectTitleIndex", r->ParentObjectTitleIndex); + ndr_print_uint32(ndr, "ParentObjectTitlePointer", r->ParentObjectTitlePointer); + ndr_print_uint32(ndr, "UniqueID", r->UniqueID); + ndr_print_uint32(ndr, "NameOffset", r->NameOffset); + ndr_print_uint32(ndr, "NameLength", r->NameLength); + ndr_print_ptr(ndr, "data", r->data); + ndr->depth++; + if (r->data) { + ndr_print_uint8(ndr, "data", *r->data); + } + ndr->depth--; + ndr_print_PERF_COUNTER_BLOCK(ndr, "counter_data", &r->counter_data); + ndr->depth--; +} + +_PUBLIC_ enum ndr_err_code ndr_push_PERF_OBJECT_TYPE(struct ndr_push *ndr, int ndr_flags, const struct PERF_OBJECT_TYPE *r) +{ + uint32_t cntr_counters_0; + uint32_t cntr_instances_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 8)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->TotalByteLength)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->DefinitionLength)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->HeaderLength)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->ObjectNameTitleIndex)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->ObjectNameTitlePointer)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->ObjectHelpTitleIndex)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->ObjectHelpTitlePointer)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->DetailLevel)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->NumCounters)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->DefaultCounter)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->NumInstances)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->CodePage)); + NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->PerfTime)); + NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->PerfFreq)); + for (cntr_counters_0 = 0; cntr_counters_0 < r->NumCounters; cntr_counters_0++) { + NDR_CHECK(ndr_push_PERF_COUNTER_DEFINITION(ndr, NDR_SCALARS, &r->counters[cntr_counters_0])); + } + for (cntr_instances_0 = 0; cntr_instances_0 < r->NumInstances; cntr_instances_0++) { + NDR_CHECK(ndr_push_PERF_INSTANCE_DEFINITION(ndr, NDR_SCALARS, &r->instances[cntr_instances_0])); + } + NDR_CHECK(ndr_push_PERF_COUNTER_BLOCK(ndr, NDR_SCALARS, &r->counter_data)); + } + if (ndr_flags & NDR_BUFFERS) { + for (cntr_instances_0 = 0; cntr_instances_0 < r->NumInstances; cntr_instances_0++) { + NDR_CHECK(ndr_push_PERF_INSTANCE_DEFINITION(ndr, NDR_BUFFERS, &r->instances[cntr_instances_0])); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_PERF_OBJECT_TYPE(struct ndr_pull *ndr, int ndr_flags, struct PERF_OBJECT_TYPE *r) +{ + uint32_t cntr_counters_0; + TALLOC_CTX *_mem_save_counters_0; + uint32_t cntr_instances_0; + TALLOC_CTX *_mem_save_instances_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 8)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->TotalByteLength)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->DefinitionLength)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->HeaderLength)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->ObjectNameTitleIndex)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->ObjectNameTitlePointer)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->ObjectHelpTitleIndex)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->ObjectHelpTitlePointer)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->DetailLevel)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->NumCounters)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->DefaultCounter)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->NumInstances)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->CodePage)); + NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->PerfTime)); + NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->PerfFreq)); + NDR_PULL_ALLOC_N(ndr, r->counters, r->NumCounters); + _mem_save_counters_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->counters, 0); + for (cntr_counters_0 = 0; cntr_counters_0 < r->NumCounters; cntr_counters_0++) { + NDR_CHECK(ndr_pull_PERF_COUNTER_DEFINITION(ndr, NDR_SCALARS, &r->counters[cntr_counters_0])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_counters_0, 0); + NDR_PULL_ALLOC_N(ndr, r->instances, r->NumInstances); + _mem_save_instances_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->instances, 0); + for (cntr_instances_0 = 0; cntr_instances_0 < r->NumInstances; cntr_instances_0++) { + NDR_CHECK(ndr_pull_PERF_INSTANCE_DEFINITION(ndr, NDR_SCALARS, &r->instances[cntr_instances_0])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_instances_0, 0); + NDR_CHECK(ndr_pull_PERF_COUNTER_BLOCK(ndr, NDR_SCALARS, &r->counter_data)); + } + if (ndr_flags & NDR_BUFFERS) { + _mem_save_instances_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->instances, 0); + for (cntr_instances_0 = 0; cntr_instances_0 < r->NumInstances; cntr_instances_0++) { + NDR_CHECK(ndr_pull_PERF_INSTANCE_DEFINITION(ndr, NDR_BUFFERS, &r->instances[cntr_instances_0])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_instances_0, 0); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_PERF_OBJECT_TYPE(struct ndr_print *ndr, const char *name, const struct PERF_OBJECT_TYPE *r) +{ + uint32_t cntr_counters_0; + uint32_t cntr_instances_0; + ndr_print_struct(ndr, name, "PERF_OBJECT_TYPE"); + ndr->depth++; + ndr_print_uint32(ndr, "TotalByteLength", r->TotalByteLength); + ndr_print_uint32(ndr, "DefinitionLength", r->DefinitionLength); + ndr_print_uint32(ndr, "HeaderLength", r->HeaderLength); + ndr_print_uint32(ndr, "ObjectNameTitleIndex", r->ObjectNameTitleIndex); + ndr_print_uint32(ndr, "ObjectNameTitlePointer", r->ObjectNameTitlePointer); + ndr_print_uint32(ndr, "ObjectHelpTitleIndex", r->ObjectHelpTitleIndex); + ndr_print_uint32(ndr, "ObjectHelpTitlePointer", r->ObjectHelpTitlePointer); + ndr_print_uint32(ndr, "DetailLevel", r->DetailLevel); + ndr_print_uint32(ndr, "NumCounters", r->NumCounters); + ndr_print_uint32(ndr, "DefaultCounter", r->DefaultCounter); + ndr_print_uint32(ndr, "NumInstances", r->NumInstances); + ndr_print_uint32(ndr, "CodePage", r->CodePage); + ndr_print_hyper(ndr, "PerfTime", r->PerfTime); + ndr_print_hyper(ndr, "PerfFreq", r->PerfFreq); + ndr->print(ndr, "%s: ARRAY(%d)", "counters", (int)r->NumCounters); + ndr->depth++; + for (cntr_counters_0=0;cntr_counters_0<r->NumCounters;cntr_counters_0++) { + char *idx_0=NULL; + if (asprintf(&idx_0, "[%d]", cntr_counters_0) != -1) { + ndr_print_PERF_COUNTER_DEFINITION(ndr, "counters", &r->counters[cntr_counters_0]); + free(idx_0); + } + } + ndr->depth--; + ndr->print(ndr, "%s: ARRAY(%d)", "instances", (int)r->NumInstances); + ndr->depth++; + for (cntr_instances_0=0;cntr_instances_0<r->NumInstances;cntr_instances_0++) { + char *idx_0=NULL; + if (asprintf(&idx_0, "[%d]", cntr_instances_0) != -1) { + ndr_print_PERF_INSTANCE_DEFINITION(ndr, "instances", &r->instances[cntr_instances_0]); + free(idx_0); + } + } + ndr->depth--; + ndr_print_PERF_COUNTER_BLOCK(ndr, "counter_data", &r->counter_data); + ndr->depth--; +} + +_PUBLIC_ enum ndr_err_code ndr_push_PERF_DATA_BLOCK(struct ndr_push *ndr, int ndr_flags, const struct PERF_DATA_BLOCK *r) +{ + uint32_t cntr_Signature_0; + uint32_t cntr_objects_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 8)); + for (cntr_Signature_0 = 0; cntr_Signature_0 < 4; cntr_Signature_0++) { + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->Signature[cntr_Signature_0])); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->LittleEndian)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->Version)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->Revision)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->TotalByteLength)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->HeaderLength)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->NumObjectTypes)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->DefaultObject)); + NDR_CHECK(ndr_push_SYSTEMTIME(ndr, NDR_SCALARS, &r->SystemTime)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->Padding)); + NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->PerfTime)); + NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->PerfFreq)); + NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->PerfTime100nSec)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->SystemNameLength)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->SystemNameOffset)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->data)); + for (cntr_objects_0 = 0; cntr_objects_0 < r->NumObjectTypes; cntr_objects_0++) { + NDR_CHECK(ndr_push_PERF_OBJECT_TYPE(ndr, NDR_SCALARS, &r->objects[cntr_objects_0])); + } + } + if (ndr_flags & NDR_BUFFERS) { + if (r->data) { + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, *r->data)); + } + for (cntr_objects_0 = 0; cntr_objects_0 < r->NumObjectTypes; cntr_objects_0++) { + NDR_CHECK(ndr_push_PERF_OBJECT_TYPE(ndr, NDR_BUFFERS, &r->objects[cntr_objects_0])); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_PERF_DATA_BLOCK(struct ndr_pull *ndr, int ndr_flags, struct PERF_DATA_BLOCK *r) +{ + uint32_t cntr_Signature_0; + uint32_t _ptr_data; + TALLOC_CTX *_mem_save_data_0; + uint32_t cntr_objects_0; + TALLOC_CTX *_mem_save_objects_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 8)); + for (cntr_Signature_0 = 0; cntr_Signature_0 < 4; cntr_Signature_0++) { + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->Signature[cntr_Signature_0])); + } + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->LittleEndian)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->Version)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->Revision)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->TotalByteLength)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->HeaderLength)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->NumObjectTypes)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->DefaultObject)); + NDR_CHECK(ndr_pull_SYSTEMTIME(ndr, NDR_SCALARS, &r->SystemTime)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->Padding)); + NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->PerfTime)); + NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->PerfFreq)); + NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->PerfTime100nSec)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->SystemNameLength)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->SystemNameOffset)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data)); + if (_ptr_data) { + NDR_PULL_ALLOC(ndr, r->data); + } else { + r->data = NULL; + } + NDR_PULL_ALLOC_N(ndr, r->objects, r->NumObjectTypes); + _mem_save_objects_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->objects, 0); + for (cntr_objects_0 = 0; cntr_objects_0 < r->NumObjectTypes; cntr_objects_0++) { + NDR_CHECK(ndr_pull_PERF_OBJECT_TYPE(ndr, NDR_SCALARS, &r->objects[cntr_objects_0])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_objects_0, 0); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->data) { + _mem_save_data_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->data, 0); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, r->data)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, 0); + } + _mem_save_objects_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->objects, 0); + for (cntr_objects_0 = 0; cntr_objects_0 < r->NumObjectTypes; cntr_objects_0++) { + NDR_CHECK(ndr_pull_PERF_OBJECT_TYPE(ndr, NDR_BUFFERS, &r->objects[cntr_objects_0])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_objects_0, 0); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_PERF_DATA_BLOCK(struct ndr_print *ndr, const char *name, const struct PERF_DATA_BLOCK *r) +{ + uint32_t cntr_Signature_0; + uint32_t cntr_objects_0; + ndr_print_struct(ndr, name, "PERF_DATA_BLOCK"); + ndr->depth++; + ndr->print(ndr, "%s: ARRAY(%d)", "Signature", (int)4); + ndr->depth++; + for (cntr_Signature_0=0;cntr_Signature_0<4;cntr_Signature_0++) { + char *idx_0=NULL; + if (asprintf(&idx_0, "[%d]", cntr_Signature_0) != -1) { + ndr_print_uint16(ndr, "Signature", r->Signature[cntr_Signature_0]); + free(idx_0); + } + } + ndr->depth--; + ndr_print_uint32(ndr, "LittleEndian", r->LittleEndian); + ndr_print_uint32(ndr, "Version", r->Version); + ndr_print_uint32(ndr, "Revision", r->Revision); + ndr_print_uint32(ndr, "TotalByteLength", r->TotalByteLength); + ndr_print_uint32(ndr, "HeaderLength", r->HeaderLength); + ndr_print_uint32(ndr, "NumObjectTypes", r->NumObjectTypes); + ndr_print_uint32(ndr, "DefaultObject", r->DefaultObject); + ndr_print_SYSTEMTIME(ndr, "SystemTime", &r->SystemTime); + ndr_print_uint32(ndr, "Padding", r->Padding); + ndr_print_hyper(ndr, "PerfTime", r->PerfTime); + ndr_print_hyper(ndr, "PerfFreq", r->PerfFreq); + ndr_print_hyper(ndr, "PerfTime100nSec", r->PerfTime100nSec); + ndr_print_uint32(ndr, "SystemNameLength", r->SystemNameLength); + ndr_print_uint32(ndr, "SystemNameOffset", r->SystemNameOffset); + ndr_print_ptr(ndr, "data", r->data); + ndr->depth++; + if (r->data) { + ndr_print_uint8(ndr, "data", *r->data); + } + ndr->depth--; + ndr->print(ndr, "%s: ARRAY(%d)", "objects", (int)r->NumObjectTypes); + ndr->depth++; + for (cntr_objects_0=0;cntr_objects_0<r->NumObjectTypes;cntr_objects_0++) { + char *idx_0=NULL; + if (asprintf(&idx_0, "[%d]", cntr_objects_0) != -1) { + ndr_print_PERF_OBJECT_TYPE(ndr, "objects", &r->objects[cntr_objects_0]); + free(idx_0); + } + } + ndr->depth--; + ndr->depth--; +} + diff --git a/source3/librpc/gen_ndr/ndr_perfcount.h b/source3/librpc/gen_ndr/ndr_perfcount.h new file mode 100644 index 0000000000..8697bf08d2 --- /dev/null +++ b/source3/librpc/gen_ndr/ndr_perfcount.h @@ -0,0 +1,26 @@ +/* header auto-generated by pidl */ + +#include "librpc/ndr/libndr.h" +#include "librpc/gen_ndr/perfcount.h" + +#ifndef _HEADER_NDR_perfcount +#define _HEADER_NDR_perfcount + +#define NDR_PERFCOUNT_CALL_COUNT (0) +void ndr_print_SYSTEMTIME(struct ndr_print *ndr, const char *name, const struct SYSTEMTIME *r); +enum ndr_err_code ndr_push_PERF_COUNTER_DEFINITION(struct ndr_push *ndr, int ndr_flags, const struct PERF_COUNTER_DEFINITION *r); +enum ndr_err_code ndr_pull_PERF_COUNTER_DEFINITION(struct ndr_pull *ndr, int ndr_flags, struct PERF_COUNTER_DEFINITION *r); +void ndr_print_PERF_COUNTER_DEFINITION(struct ndr_print *ndr, const char *name, const struct PERF_COUNTER_DEFINITION *r); +enum ndr_err_code ndr_push_PERF_COUNTER_BLOCK(struct ndr_push *ndr, int ndr_flags, const struct PERF_COUNTER_BLOCK *r); +enum ndr_err_code ndr_pull_PERF_COUNTER_BLOCK(struct ndr_pull *ndr, int ndr_flags, struct PERF_COUNTER_BLOCK *r); +void ndr_print_PERF_COUNTER_BLOCK(struct ndr_print *ndr, const char *name, const struct PERF_COUNTER_BLOCK *r); +enum ndr_err_code ndr_push_PERF_INSTANCE_DEFINITION(struct ndr_push *ndr, int ndr_flags, const struct PERF_INSTANCE_DEFINITION *r); +enum ndr_err_code ndr_pull_PERF_INSTANCE_DEFINITION(struct ndr_pull *ndr, int ndr_flags, struct PERF_INSTANCE_DEFINITION *r); +void ndr_print_PERF_INSTANCE_DEFINITION(struct ndr_print *ndr, const char *name, const struct PERF_INSTANCE_DEFINITION *r); +enum ndr_err_code ndr_push_PERF_OBJECT_TYPE(struct ndr_push *ndr, int ndr_flags, const struct PERF_OBJECT_TYPE *r); +enum ndr_err_code ndr_pull_PERF_OBJECT_TYPE(struct ndr_pull *ndr, int ndr_flags, struct PERF_OBJECT_TYPE *r); +void ndr_print_PERF_OBJECT_TYPE(struct ndr_print *ndr, const char *name, const struct PERF_OBJECT_TYPE *r); +enum ndr_err_code ndr_push_PERF_DATA_BLOCK(struct ndr_push *ndr, int ndr_flags, const struct PERF_DATA_BLOCK *r); +enum ndr_err_code ndr_pull_PERF_DATA_BLOCK(struct ndr_pull *ndr, int ndr_flags, struct PERF_DATA_BLOCK *r); +void ndr_print_PERF_DATA_BLOCK(struct ndr_print *ndr, const char *name, const struct PERF_DATA_BLOCK *r); +#endif /* _HEADER_NDR_perfcount */ diff --git a/source3/librpc/gen_ndr/perfcount.h b/source3/librpc/gen_ndr/perfcount.h new file mode 100644 index 0000000000..cafce4f604 --- /dev/null +++ b/source3/librpc/gen_ndr/perfcount.h @@ -0,0 +1,129 @@ +/* header auto-generated by pidl */ + +#include <stdint.h> + +#include "libcli/util/ntstatus.h" + +#ifndef _HEADER_perfcount +#define _HEADER_perfcount + +#define PERF_NO_INSTANCES ( -1 ) +#define PERF_NO_UNIQUE_ID ( -1 ) +#define PERF_SIZE_DWORD ( 0x00000000 ) +#define PERF_SIZE_LARGE ( 0x00000100 ) +#define PERF_SIZE_ZERO ( 0x00000200 ) +#define PERF_SIZE_VARIABLE_LEN ( 0x00000300 ) +#define PERF_TYPE_NUMBER ( 0x00000000 ) +#define PERF_TYPE_COUNTER ( 0x00000400 ) +#define PERF_TYPE_TEXT ( 0x00000800 ) +#define PERF_TYPE_ZERO ( 0x00000C00 ) +#define PERF_NUMBER_HEX ( 0x00000000 ) +#define PERF_NUMBER_DECIMAL ( 0x00010000 ) +#define PERF_NUMBER_DEC_1000 ( 0x00020000 ) +#define PERF_COUNTER_VALUE ( 0x00000000 ) +#define PERF_COUNTER_RATE ( 0x00010000 ) +#define PERF_COUNTER_FRACTION ( 0x00020000 ) +#define PERF_COUNTER_BASE ( 0x00030000 ) +#define PERF_COUNTER_ELAPSED ( 0x00040000 ) +#define PERF_COUNTER_QUEUELEN ( 0x00050000 ) +#define PERF_COUNTER_HISTOGRAM ( 0x00060000 ) +#define PERF_COUNTER_PRECISION ( 0x00070000 ) +#define PERF_TEXT_UNICODE ( 0x00000000 ) +#define PERF_TEXT_ASCII ( 0x00010000 ) +#define PERF_TIMER_TICK ( 0x00000000 ) +#define PERF_TIMER_100NS ( 0x00100000 ) +#define PERF_OBJECT_TIMER ( 0x00200000 ) +#define PERF_DELTA_COUNTER ( 0x00400000 ) +#define PERF_DELTA_BASE ( 0x00800000 ) +#define PERF_INVERSE_COUNTER ( 0x01000000 ) +#define PERF_MULTI_COUNTER ( 0x02000000 ) +#define PERF_DISPLAY_NO_SUFFIX ( 0x00000000 ) +#define PERF_DISPLAY_PER_SEC ( 0x10000000 ) +#define PERF_DISPLAY_PERCENT ( 0x20000000 ) +#define PERF_DISPLAY_SECONDS ( 0x30000000 ) +#define PERF_DISPLAY_NOSHOW ( 0x40000000 ) +#define PERF_DETAIL_NOVICE ( 100 ) +#define PERF_DETAIL_ADVANCED ( 200 ) +#define PERF_DETAIL_EXPERT ( 300 ) +#define PERF_DETAIL_WIZARD ( 400 ) +struct SYSTEMTIME { + uint16_t year; + uint16_t month; + uint16_t dayofweek; + uint16_t day; + uint16_t hour; + uint16_t minute; + uint16_t second; + uint16_t milliseconds; +}; + +struct PERF_COUNTER_DEFINITION { + uint32_t ByteLength; + uint32_t CounterNameTitleIndex; + uint32_t CounterNameTitlePointer; + uint32_t CounterHelpTitleIndex; + uint32_t CounterHelpTitlePointer; + uint32_t DefaultScale; + uint32_t DetailLevel; + uint32_t CounterType; + uint32_t CounterSize; + uint32_t CounterOffset; +}/* [public] */; + +struct PERF_COUNTER_BLOCK { + uint32_t ByteLength; + uint8_t *data; +}/* [public] */; + +struct PERF_INSTANCE_DEFINITION { + uint32_t ByteLength; + uint32_t ParentObjectTitleIndex; + uint32_t ParentObjectTitlePointer; + uint32_t UniqueID; + uint32_t NameOffset; + uint32_t NameLength; + uint8_t *data;/* [unique] */ + struct PERF_COUNTER_BLOCK counter_data; +}/* [public] */; + +struct PERF_OBJECT_TYPE { + uint32_t TotalByteLength; + uint32_t DefinitionLength; + uint32_t HeaderLength; + uint32_t ObjectNameTitleIndex; + uint32_t ObjectNameTitlePointer; + uint32_t ObjectHelpTitleIndex; + uint32_t ObjectHelpTitlePointer; + uint32_t DetailLevel; + uint32_t NumCounters; + uint32_t DefaultCounter; + uint32_t NumInstances; + uint32_t CodePage; + uint64_t PerfTime; + uint64_t PerfFreq; + struct PERF_COUNTER_DEFINITION *counters; + struct PERF_INSTANCE_DEFINITION *instances; + struct PERF_COUNTER_BLOCK counter_data; +}/* [public] */; + +struct PERF_DATA_BLOCK { + uint16_t Signature[4]; + uint32_t LittleEndian; + uint32_t Version; + uint32_t Revision; + uint32_t TotalByteLength; + uint32_t HeaderLength; + uint32_t NumObjectTypes; + uint32_t DefaultObject; + struct SYSTEMTIME SystemTime; + uint32_t Padding; + uint64_t PerfTime; + uint64_t PerfFreq; + uint64_t PerfTime100nSec; + uint32_t SystemNameLength; + uint32_t SystemNameOffset; + uint8_t *data;/* [unique] */ + struct PERF_OBJECT_TYPE *objects; +}/* [public] */; + +#endif /* _HEADER_perfcount */ diff --git a/source3/librpc/idl/perfcount.idl b/source3/librpc/idl/perfcount.idl new file mode 100644 index 0000000000..e9a4383c43 --- /dev/null +++ b/source3/librpc/idl/perfcount.idl @@ -0,0 +1,172 @@ +#include "idl_types.h" + +/* + IDL structures for perfcount code +*/ + +[ + pointer_default(unique) +] + interface perfcount +{ + const int PERF_NO_INSTANCES = -1; + const int PERF_NO_UNIQUE_ID = -1; + + /* These determine the data size */ + const int PERF_SIZE_DWORD = 0x00000000; + const int PERF_SIZE_LARGE = 0x00000100; + const int PERF_SIZE_ZERO = 0x00000200; + const int PERF_SIZE_VARIABLE_LEN = 0x00000300; + + /* These determine the usage of the counter */ + const int PERF_TYPE_NUMBER = 0x00000000; + const int PERF_TYPE_COUNTER = 0x00000400; + const int PERF_TYPE_TEXT = 0x00000800; + const int PERF_TYPE_ZERO = 0x00000C00; + + /* If PERF_TYPE_NUMBER was selected, these provide display information */ + const int PERF_NUMBER_HEX = 0x00000000; + const int PERF_NUMBER_DECIMAL = 0x00010000; + const int PERF_NUMBER_DEC_1000 = 0x00020000; + + /* If PERF_TYPE_COUNTER was selected, these provide display information */ + const int PERF_COUNTER_VALUE = 0x00000000; + const int PERF_COUNTER_RATE = 0x00010000; + const int PERF_COUNTER_FRACTION = 0x00020000; + const int PERF_COUNTER_BASE = 0x00030000; + const int PERF_COUNTER_ELAPSED = 0x00040000; + const int PERF_COUNTER_QUEUELEN = 0x00050000; + const int PERF_COUNTER_HISTOGRAM = 0x00060000; + const int PERF_COUNTER_PRECISION = 0x00070000; + + /* If PERF_TYPE_TEXT was selected, these provide display information */ + const int PERF_TEXT_UNICODE = 0x00000000; + const int PERF_TEXT_ASCII = 0x00010000; + + /* These provide information for which tick count to use when computing elapsed interval */ + const int PERF_TIMER_TICK = 0x00000000; + const int PERF_TIMER_100NS = 0x00100000; + const int PERF_OBJECT_TIMER = 0x00200000; + + /* These affect how the data is manipulated prior to being displayed */ + const int PERF_DELTA_COUNTER = 0x00400000; + const int PERF_DELTA_BASE = 0x00800000; + const int PERF_INVERSE_COUNTER = 0x01000000; + const int PERF_MULTI_COUNTER = 0x02000000; + + /* These determine if any text gets added when the value is displayed */ + const int PERF_DISPLAY_NO_SUFFIX = 0x00000000; + const int PERF_DISPLAY_PER_SEC = 0x10000000; + const int PERF_DISPLAY_PERCENT = 0x20000000; + const int PERF_DISPLAY_SECONDS = 0x30000000; + const int PERF_DISPLAY_NOSHOW = 0x40000000; + + /* These determine the DetailLevel of the counter */ + const int PERF_DETAIL_NOVICE = 100; + const int PERF_DETAIL_ADVANCED = 200; + const int PERF_DETAIL_EXPERT = 300; + const int PERF_DETAIL_WIZARD = 400; + + typedef struct { + uint16 year; + uint16 month; + uint16 dayofweek; + uint16 day; + uint16 hour; + uint16 minute; + uint16 second; + uint16 milliseconds; + } SYSTEMTIME; + + typedef [public] struct { + /* sizeof(PERF_COUNTER_DEFINITION) */ + uint32 ByteLength; + uint32 CounterNameTitleIndex; + uint32 CounterNameTitlePointer; + uint32 CounterHelpTitleIndex; + uint32 CounterHelpTitlePointer; + uint32 DefaultScale; + uint32 DetailLevel; + uint32 CounterType; + uint32 CounterSize; + uint32 CounterOffset; + } PERF_COUNTER_DEFINITION; + + typedef [public] struct { + /* Total size of the data block, including all data plus this header */ + uint32 ByteLength; + uint8 data[ByteLength]; + } PERF_COUNTER_BLOCK; + + typedef [public] struct { + /* Total size of the instance definition, including the length of the terminated Name string */ + uint32 ByteLength; + uint32 ParentObjectTitleIndex; + uint32 ParentObjectTitlePointer; + uint32 UniqueID; + /* From the start of the PERF_INSTANCE_DEFINITION, the byte offset to the start of the Name string */ + uint32 NameOffset; + uint32 NameLength; + /* Unicode string containing the name for the instance */ + uint8 *data; + PERF_COUNTER_BLOCK counter_data; + } PERF_INSTANCE_DEFINITION; + + typedef [public] struct { + /* Total size of the object block, including all PERF_INSTANCE_DEFINITIONs, + PERF_COUNTER_DEFINITIONs and PERF_COUNTER_BLOCKs in bytes */ + uint32 TotalByteLength; + /* Size of this PERF_OBJECT_TYPE plus all PERF_COUNTER_DEFINITIONs in bytes */ + uint32 DefinitionLength; + /* Size of this PERF_OBJECT_TYPE */ + uint32 HeaderLength; + uint32 ObjectNameTitleIndex; + uint32 ObjectNameTitlePointer; + uint32 ObjectHelpTitleIndex; + uint32 ObjectHelpTitlePointer; + uint32 DetailLevel; + uint32 NumCounters; + uint32 DefaultCounter; + uint32 NumInstances; + uint32 CodePage; + hyper PerfTime; + hyper PerfFreq; + PERF_COUNTER_DEFINITION counters[NumCounters]; + PERF_INSTANCE_DEFINITION instances[NumInstances]; + PERF_COUNTER_BLOCK counter_data; + } PERF_OBJECT_TYPE; + + /* PerfCounter Inner Buffer structs */ + typedef [public] struct { + /* hardcoded to read "P.E.R.F" */ + uint16 Signature[4]; + uint32 LittleEndian; + /* both currently hardcoded to 1 */ + uint32 Version; + uint32 Revision; + /* bytes of PERF_OBJECT_TYPE data, does NOT include the PERF_DATA_BLOCK */ + uint32 TotalByteLength; + /* size of PERF_DATA_BLOCK including the uint8 *data */ + uint32 HeaderLength; + /* number of PERF_OBJECT_TYPE structures encoded */ + uint32 NumObjectTypes; + uint32 DefaultObject; + SYSTEMTIME SystemTime; + /* This will guarantee that we're on a 64-bit boundary before we encode + PerfTime, and having it there will make my offset math much easier. */ + uint32 Padding; + /* Now when I'm marshalling this, I'll need to call prs_align_uint64() + before I start encodint the uint64 structs */ + /* clock rate * seconds uptime */ + hyper PerfTime; + /* The clock rate of the CPU */ + hyper PerfFreq; + /* used for high-res timers -- for now PerfTime * 10e7 */ + hyper PerfTime100nSec; + uint32 SystemNameLength; + uint32 SystemNameOffset; + /* The SystemName, in unicode, terminated */ + uint8* data; + PERF_OBJECT_TYPE objects[NumObjectTypes]; + } PERF_DATA_BLOCK; +} diff --git a/source3/registry/reg_perfcount.c b/source3/registry/reg_perfcount.c index ea4ccbf58f..4132a4780a 100644 --- a/source3/registry/reg_perfcount.c +++ b/source3/registry/reg_perfcount.c @@ -30,7 +30,7 @@ #define NAMES_DB "names.tdb" #define DATA_DB "data.tdb" -PERF_OBJECT_TYPE *_reg_perfcount_find_obj(PERF_DATA_BLOCK *block, int objind); +struct PERF_OBJECT_TYPE *_reg_perfcount_find_obj(struct PERF_DATA_BLOCK *block, int objind); /********************************************************************* *********************************************************************/ @@ -365,7 +365,7 @@ static uint32 _reg_perfcount_get_numinst(int objInd, TDB_CONTEXT *names) /********************************************************************* *********************************************************************/ -static bool _reg_perfcount_add_object(PERF_DATA_BLOCK *block, +static bool _reg_perfcount_add_object(struct PERF_DATA_BLOCK *block, prs_struct *ps, int num, TDB_DATA data, @@ -373,16 +373,16 @@ static bool _reg_perfcount_add_object(PERF_DATA_BLOCK *block, { int i; bool success = True; - PERF_OBJECT_TYPE *obj; + struct PERF_OBJECT_TYPE *obj; - block->objects = (PERF_OBJECT_TYPE *)TALLOC_REALLOC_ARRAY(ps->mem_ctx, + block->objects = (struct PERF_OBJECT_TYPE *)TALLOC_REALLOC_ARRAY(ps->mem_ctx, block->objects, - PERF_OBJECT_TYPE, + struct PERF_OBJECT_TYPE, block->NumObjectTypes+1); if(block->objects == NULL) return False; obj = &(block->objects[block->NumObjectTypes]); - memset((void *)&(block->objects[block->NumObjectTypes]), 0, sizeof(PERF_OBJECT_TYPE)); + memset((void *)&(block->objects[block->NumObjectTypes]), 0, sizeof(struct PERF_OBJECT_TYPE)); block->objects[block->NumObjectTypes].ObjectNameTitleIndex = num; block->objects[block->NumObjectTypes].ObjectNameTitlePointer = 0; block->objects[block->NumObjectTypes].ObjectHelpTitleIndex = num+1; @@ -469,10 +469,10 @@ static uint32 _reg_perfcount_compute_scale(int64_t data) /********************************************************************* *********************************************************************/ -static bool _reg_perfcount_get_counter_info(PERF_DATA_BLOCK *block, +static bool _reg_perfcount_get_counter_info(struct PERF_DATA_BLOCK *block, prs_struct *ps, int CounterIndex, - PERF_OBJECT_TYPE *obj, + struct PERF_OBJECT_TYPE *obj, TDB_CONTEXT *names) { TDB_DATA key, data; @@ -578,11 +578,11 @@ static bool _reg_perfcount_get_counter_info(PERF_DATA_BLOCK *block, /********************************************************************* *********************************************************************/ -PERF_OBJECT_TYPE *_reg_perfcount_find_obj(PERF_DATA_BLOCK *block, int objind) +struct PERF_OBJECT_TYPE *_reg_perfcount_find_obj(struct PERF_DATA_BLOCK *block, int objind) { int i; - PERF_OBJECT_TYPE *obj = NULL; + struct PERF_OBJECT_TYPE *obj = NULL; for(i = 0; i < block->NumObjectTypes; i++) { @@ -598,7 +598,7 @@ PERF_OBJECT_TYPE *_reg_perfcount_find_obj(PERF_DATA_BLOCK *block, int objind) /********************************************************************* *********************************************************************/ -static bool _reg_perfcount_add_counter(PERF_DATA_BLOCK *block, +static bool _reg_perfcount_add_counter(struct PERF_DATA_BLOCK *block, prs_struct *ps, int num, TDB_DATA data, @@ -606,7 +606,7 @@ static bool _reg_perfcount_add_counter(PERF_DATA_BLOCK *block, { char *begin, *end, *start, *stop; int parent; - PERF_OBJECT_TYPE *obj; + struct PERF_OBJECT_TYPE *obj; bool success = True; char buf[PERFCOUNT_MAX_LEN]; @@ -634,17 +634,17 @@ static bool _reg_perfcount_add_counter(PERF_DATA_BLOCK *block, parent, num)); return False; } - obj->counters = (PERF_COUNTER_DEFINITION *)TALLOC_REALLOC_ARRAY(ps->mem_ctx, + obj->counters = (struct PERF_COUNTER_DEFINITION *)TALLOC_REALLOC_ARRAY(ps->mem_ctx, obj->counters, - PERF_COUNTER_DEFINITION, + struct PERF_COUNTER_DEFINITION, obj->NumCounters+1); if(obj->counters == NULL) return False; - memset((void *)&(obj->counters[obj->NumCounters]), 0, sizeof(PERF_COUNTER_DEFINITION)); + memset((void *)&(obj->counters[obj->NumCounters]), 0, sizeof(struct PERF_COUNTER_DEFINITION)); obj->counters[obj->NumCounters].CounterNameTitleIndex=num; obj->counters[obj->NumCounters].CounterHelpTitleIndex=num+1; obj->counters[obj->NumCounters].DetailLevel = PERF_DETAIL_NOVICE; - obj->counters[obj->NumCounters].ByteLength = sizeof(PERF_COUNTER_DEFINITION); + obj->counters[obj->NumCounters].ByteLength = sizeof(struct PERF_COUNTER_DEFINITION); success = _reg_perfcount_get_counter_info(block, ps, num, obj, names); obj->NumCounters += 1; start = stop + 1; @@ -660,10 +660,10 @@ static bool _reg_perfcount_add_counter(PERF_DATA_BLOCK *block, /********************************************************************* *********************************************************************/ -bool _reg_perfcount_get_instance_info(PERF_INSTANCE_DEFINITION *inst, +bool _reg_perfcount_get_instance_info(struct PERF_INSTANCE_DEFINITION *inst, prs_struct *ps, int instId, - PERF_OBJECT_TYPE *obj, + struct PERF_OBJECT_TYPE *obj, TDB_CONTEXT *names) { TDB_DATA key, data; @@ -754,23 +754,23 @@ bool _reg_perfcount_get_instance_info(PERF_INSTANCE_DEFINITION *inst, /********************************************************************* *********************************************************************/ -bool _reg_perfcount_add_instance(PERF_OBJECT_TYPE *obj, +bool _reg_perfcount_add_instance(struct PERF_OBJECT_TYPE *obj, prs_struct *ps, int instInd, TDB_CONTEXT *names) { - PERF_INSTANCE_DEFINITION *inst; + struct PERF_INSTANCE_DEFINITION *inst; if(obj->instances == NULL) { obj->instances = TALLOC_REALLOC_ARRAY(ps->mem_ctx, obj->instances, - PERF_INSTANCE_DEFINITION, + struct PERF_INSTANCE_DEFINITION, obj->NumInstances); } if(obj->instances == NULL) return False; - memset(&(obj->instances[instInd]), 0, sizeof(PERF_INSTANCE_DEFINITION)); + memset(&(obj->instances[instInd]), 0, sizeof(struct PERF_INSTANCE_DEFINITION)); inst = &(obj->instances[instInd]); return _reg_perfcount_get_instance_info(inst, ps, instInd, obj, names); } @@ -778,7 +778,7 @@ bool _reg_perfcount_add_instance(PERF_OBJECT_TYPE *obj, /********************************************************************* *********************************************************************/ -static int _reg_perfcount_assemble_global(PERF_DATA_BLOCK *block, +static int _reg_perfcount_assemble_global(struct PERF_DATA_BLOCK *block, prs_struct *ps, int base_index, TDB_CONTEXT *names) @@ -849,7 +849,7 @@ static bool _reg_perfcount_get_64(uint64_t *retval, /********************************************************************* *********************************************************************/ -static bool _reg_perfcount_init_data_block_perf(PERF_DATA_BLOCK *block, +static bool _reg_perfcount_init_data_block_perf(struct PERF_DATA_BLOCK *block, TDB_CONTEXT *names) { uint64_t PerfFreq, PerfTime, PerfTime100nSec; @@ -893,10 +893,27 @@ static bool _reg_perfcount_init_data_block_perf(PERF_DATA_BLOCK *block, return True; } +/******************************************************************* +********************************************************************/ + +static bool make_systemtime(struct SYSTEMTIME *systime, struct tm *unixtime) +{ + systime->year=unixtime->tm_year+1900; + systime->month=unixtime->tm_mon+1; + systime->dayofweek=unixtime->tm_wday; + systime->day=unixtime->tm_mday; + systime->hour=unixtime->tm_hour; + systime->minute=unixtime->tm_min; + systime->second=unixtime->tm_sec; + systime->milliseconds=0; + + return True; +} + /********************************************************************* *********************************************************************/ -static bool _reg_perfcount_init_data_block(PERF_DATA_BLOCK *block, +static bool _reg_perfcount_init_data_block(struct PERF_DATA_BLOCK *block, prs_struct *ps, TDB_CONTEXT *names) { smb_ucs2_t *temp = NULL; @@ -931,7 +948,7 @@ static bool _reg_perfcount_init_data_block(PERF_DATA_BLOCK *block, return False; } memcpy(block->data, temp, block->SystemNameLength); - block->SystemNameOffset = sizeof(PERF_DATA_BLOCK) - sizeof(block->objects) - sizeof(block->data); + block->SystemNameOffset = sizeof(struct PERF_DATA_BLOCK) - sizeof(block->objects) - sizeof(block->data); block->HeaderLength = block->SystemNameOffset + block->SystemNameLength; /* Make sure to adjust for 64-bit alignment for when we finish writing the system name, so that the PERF_OBJECT_TYPE struct comes out 64-bit aligned */ @@ -943,13 +960,13 @@ static bool _reg_perfcount_init_data_block(PERF_DATA_BLOCK *block, /********************************************************************* *********************************************************************/ -static uint32 _reg_perfcount_perf_data_block_fixup(PERF_DATA_BLOCK *block, prs_struct *ps) +static uint32 _reg_perfcount_perf_data_block_fixup(struct PERF_DATA_BLOCK *block, prs_struct *ps) { int obj, cnt, inst, pad, i; - PERF_OBJECT_TYPE *object; - PERF_INSTANCE_DEFINITION *instance; - PERF_COUNTER_DEFINITION *counter; - PERF_COUNTER_BLOCK *counter_data; + struct PERF_OBJECT_TYPE *object; + struct PERF_INSTANCE_DEFINITION *instance; + struct PERF_COUNTER_DEFINITION *counter; + struct PERF_COUNTER_BLOCK *counter_data; char *temp = NULL, *src_addr, *dst_addr; block->TotalByteLength = 0; @@ -1024,7 +1041,7 @@ static uint32 _reg_perfcount_perf_data_block_fixup(PERF_DATA_BLOCK *block, prs_s } object[obj].TotalByteLength += object[obj].counter_data.ByteLength; } - object[obj].HeaderLength = sizeof(*object) - (sizeof(counter) + sizeof(instance) + sizeof(PERF_COUNTER_BLOCK)); + object[obj].HeaderLength = sizeof(*object) - (sizeof(counter) + sizeof(instance) + sizeof(struct PERF_COUNTER_BLOCK)); object[obj].TotalByteLength += object[obj].HeaderLength; object[obj].DefinitionLength += object[obj].HeaderLength; @@ -1039,7 +1056,7 @@ static uint32 _reg_perfcount_perf_data_block_fixup(PERF_DATA_BLOCK *block, prs_s uint32 reg_perfcount_get_perf_data_block(uint32 base_index, prs_struct *ps, - PERF_DATA_BLOCK *block, + struct PERF_DATA_BLOCK *block, const char *object_ids) { uint32 buffer_size = 0; @@ -1084,10 +1101,35 @@ uint32 reg_perfcount_get_perf_data_block(uint32 base_index, return buffer_size + block->HeaderLength; } +/******************************************************************* +********************************************************************/ + +static bool smb_io_system_time(const char *desc, prs_struct *ps, int depth, struct SYSTEMTIME *systime) +{ + if(!prs_uint16("year", ps, depth, &systime->year)) + return False; + if(!prs_uint16("month", ps, depth, &systime->month)) + return False; + if(!prs_uint16("dayofweek", ps, depth, &systime->dayofweek)) + return False; + if(!prs_uint16("day", ps, depth, &systime->day)) + return False; + if(!prs_uint16("hour", ps, depth, &systime->hour)) + return False; + if(!prs_uint16("minute", ps, depth, &systime->minute)) + return False; + if(!prs_uint16("second", ps, depth, &systime->second)) + return False; + if(!prs_uint16("milliseconds", ps, depth, &systime->milliseconds)) + return False; + + return True; +} + /********************************************************************* *********************************************************************/ -static bool _reg_perfcount_marshall_perf_data_block(prs_struct *ps, PERF_DATA_BLOCK block, int depth) +static bool _reg_perfcount_marshall_perf_data_block(prs_struct *ps, struct PERF_DATA_BLOCK block, int depth) { int i; prs_debug(ps, depth, "", "_reg_perfcount_marshall_perf_data_block"); @@ -1142,11 +1184,11 @@ static bool _reg_perfcount_marshall_perf_data_block(prs_struct *ps, PERF_DATA_BL *********************************************************************/ static bool _reg_perfcount_marshall_perf_counters(prs_struct *ps, - PERF_OBJECT_TYPE object, + struct PERF_OBJECT_TYPE object, int depth) { int cnt; - PERF_COUNTER_DEFINITION counter; + struct PERF_COUNTER_DEFINITION counter; prs_debug(ps, depth, "", "_reg_perfcount_marshall_perf_counters"); depth++; @@ -1186,7 +1228,7 @@ static bool _reg_perfcount_marshall_perf_counters(prs_struct *ps, *********************************************************************/ static bool _reg_perfcount_marshall_perf_counter_data(prs_struct *ps, - PERF_COUNTER_BLOCK counter_data, + struct PERF_COUNTER_BLOCK counter_data, int depth) { prs_debug(ps, depth, "", "_reg_perfcount_marshall_perf_counter_data"); @@ -1209,10 +1251,10 @@ static bool _reg_perfcount_marshall_perf_counter_data(prs_struct *ps, *********************************************************************/ static bool _reg_perfcount_marshall_perf_instances(prs_struct *ps, - PERF_OBJECT_TYPE object, + struct PERF_OBJECT_TYPE object, int depth) { - PERF_INSTANCE_DEFINITION instance; + struct PERF_INSTANCE_DEFINITION instance; int inst; prs_debug(ps, depth, "", "_reg_perfcount_marshall_perf_instances"); @@ -1249,11 +1291,11 @@ static bool _reg_perfcount_marshall_perf_instances(prs_struct *ps, /********************************************************************* *********************************************************************/ -static bool _reg_perfcount_marshall_perf_objects(prs_struct *ps, PERF_DATA_BLOCK block, int depth) +static bool _reg_perfcount_marshall_perf_objects(prs_struct *ps, struct PERF_DATA_BLOCK block, int depth) { int obj; - PERF_OBJECT_TYPE object; + struct PERF_OBJECT_TYPE object; prs_debug(ps, depth, "", "_reg_perfcount_marshall_perf_objects"); depth++; @@ -1319,7 +1361,7 @@ static bool _reg_perfcount_marshall_perf_objects(prs_struct *ps, PERF_DATA_BLOCK /********************************************************************* *********************************************************************/ -static bool _reg_perfcount_marshall_hkpd(prs_struct *ps, PERF_DATA_BLOCK block) +static bool _reg_perfcount_marshall_hkpd(prs_struct *ps, struct PERF_DATA_BLOCK block) { int depth = 0; if(_reg_perfcount_marshall_perf_data_block(ps, block, depth) == True) @@ -1343,7 +1385,7 @@ WERROR reg_perfcount_get_hkpd(prs_struct *ps, uint32 max_buf_size, uint32 *outbu * promising under * http://msdn2.microsoft.com/en-us/library/aa373105.aspx -- vl */ - PERF_DATA_BLOCK block; + struct PERF_DATA_BLOCK block; uint32 buffer_size, base_index; buffer_size = 0; diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 34611a48fd..c000923b9e 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -59,48 +59,6 @@ bool smb_io_time(const char *desc, NTTIME *nttime, prs_struct *ps, int depth) } /******************************************************************* -********************************************************************/ - -bool smb_io_system_time(const char *desc, prs_struct *ps, int depth, SYSTEMTIME *systime) -{ - if(!prs_uint16("year", ps, depth, &systime->year)) - return False; - if(!prs_uint16("month", ps, depth, &systime->month)) - return False; - if(!prs_uint16("dayofweek", ps, depth, &systime->dayofweek)) - return False; - if(!prs_uint16("day", ps, depth, &systime->day)) - return False; - if(!prs_uint16("hour", ps, depth, &systime->hour)) - return False; - if(!prs_uint16("minute", ps, depth, &systime->minute)) - return False; - if(!prs_uint16("second", ps, depth, &systime->second)) - return False; - if(!prs_uint16("milliseconds", ps, depth, &systime->milliseconds)) - return False; - - return True; -} - -/******************************************************************* -********************************************************************/ - -bool make_systemtime(SYSTEMTIME *systime, struct tm *unixtime) -{ - systime->year=unixtime->tm_year+1900; - systime->month=unixtime->tm_mon+1; - systime->dayofweek=unixtime->tm_wday; - systime->day=unixtime->tm_mday; - systime->hour=unixtime->tm_hour; - systime->minute=unixtime->tm_min; - systime->second=unixtime->tm_sec; - systime->milliseconds=0; - - return True; -} - -/******************************************************************* Reads or writes a struct GUID ********************************************************************/ |