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_wsman_h
26 #define _omi_wsman_wsman_h
27
28 #include "config.h"
29 #include <string.h>
30 #include <common.h>
31 #include <base/messages.h>
32 #include <sock/selector.h>
33 #include <http/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 /* Whether to do HTTP-leavel tracing */
71 MI_Boolean enableHTTPTracing;
72 }
73 WSMAN_Options;
74
75 /* default WSMAN options */
76 #define DEFAULT_WSMAN_OPTIONS { (20 * 1000000), MI_FALSE, MI_FALSE }
77
78 MI_Result WSMAN_New_Listener(
79 WSMAN** self,
80 Selector* selector, /*optional, maybe NULL*/
81 unsigned short http_port, /* 0 to disable */
82 unsigned short https_port, /* 0 to disable */
83 WSMANCallback callback,
84 void* callbackData);
85 mike 1.1
86 MI_Result WSMAN_Delete(
87 WSMAN* self);
88
89 MI_Result WSMAN_Run(
90 WSMAN* self,
91 MI_Uint64 timeoutUsec);
92
93 MI_Result WSMAN_Send(
94 WSMAN* self,
95 Message* message);
96
97 /* Sets wsman options (mostly unit-test support) */
98 MI_Result WSMAN_SetOptions(
99 WSMAN* self,
100 const WSMAN_Options* options);
101
102 END_EXTERNC
103
104 #endif /* _omi_wsman_wsman_h */
|