1 mike 1.1 /*
2 **==============================================================================
3 **
4 ** Open Management Infrastructure (OMI)
5 **
6 ** Copyright (c) Microsoft Corporation
7 **
8 ** Licensed under the Apache License, Version 2.0 (the "License"); you may not
9 ** use this file except in compliance with the License. You may obtain a copy
10 ** of the License at
11 **
12 ** http://www.apache.org/licenses/LICENSE-2.0
13 **
14 ** THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 ** KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
16 ** WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
17 ** MERCHANTABLITY OR NON-INFRINGEMENT.
18 **
19 ** See the Apache 2 License for the specific language governing permissions
20 ** and limitations under the License.
21 **
22 mike 1.1 **==============================================================================
23 */
24
25 #ifndef _omi_wsman_h
26 #define _omi_wsman_h
27
28 #include "config.h"
29 #include <string.h>
30 #include <common.h>
31 #include <base/messages.h>
32 #include "selector.h"
33 #include "http.h"
34
35 BEGIN_EXTERNC
36
37 typedef struct _WSMAN WSMAN;
38
39 /*
40 Callback for processing new message.
41 Parameters:
42 protocol - pointer to a protocol object that received a message
43 mike 1.1 message - message; consumer ahs to call 'AddRef' to keep message around
44 longer than callback's lifetime
45 data - user-provided callback data
46 Return:
47 return value is ignored by wsman object;
48 added for consistency with bin Protocol
49 however, all callbacks should retunr MI_TRUE for now
50 */
51 typedef MI_Boolean (*WSMANCallback)(
52 WSMAN* protocol,
53 Message* message,
54 void* data);
55
56 /* WSMAN options.
57 mostly used for unit-testing; default values
58 are hard-coded but can be overwritten by
59 unit-tests/config modules */
60 typedef struct _WSMAN_Options
61 {
62 /* timeout for enumerate context expiration
63 * (time between enum/pull/pull/.. requests)
64 mike 1.1 */
65 MI_Uint64 timeoutEnumContextUsec;
66
67 /* Whether to trace to standard output or not */
68 MI_Boolean enableTracing;
69 }
70 WSMAN_Options;
71
72 /* default WSMAN options */
73 #define DEFAULT_WSMAN_OPTIONS { (20 * 1000000), MI_FALSE }
74
75 MI_Result WSMAN_New_Listener(
76 WSMAN** self,
77 Selector* selector, /*optional, maybe NULL*/
78 unsigned short http_port, /* 0 to disable */
79 unsigned short https_port, /* 0 to disable */
80 WSMANCallback callback,
81 void* callbackData);
82
83 MI_Result WSMAN_Delete(
84 WSMAN* self);
85 mike 1.1
86 MI_Result WSMAN_Run(
87 WSMAN* self,
88 MI_Uint64 timeoutUsec);
89
90 MI_Result WSMAN_Send(
91 WSMAN* self,
92 Message* message);
93
94 /* Sets wsman options (mostly unit-test support) */
95 MI_Result WSMAN_SetOptions(
96 WSMAN* self,
97 const WSMAN_Options* options);
98
99 END_EXTERNC
100
101 #endif /* _omi_wsman_h */
|