-
Notifications
You must be signed in to change notification settings - Fork 0
/
elementCapabilitiesProvider.c
176 lines (160 loc) · 5.57 KB
/
elementCapabilitiesProvider.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
/*
* elementCapabilitiesProvider.c
*
* (C) Copyright IBM Corp. 2009
*
* THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE
* ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE
* CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT.
*
* You can obtain a current copy of the Eclipse Public License from
* http://www.opensource.org/licenses/eclipse-1.0.php
*
* Author: Sean Swehla <smswehla@us.ibm.com>
*
* Description:
*
* ElementCapabilities provider for sfcb. This file has been created
* explicitly to serve an instance of SFCB_IndiciationServiceCapabilities.
* The initial implementation of this simply returns CMPI_RC_OK for each
* of the function calls and relies on internal provider to do all of
* of the real work. The important part of this file is the InitInstances
* function, which is hooked by the CreateMI call. This will create the
* static instance of the association the first time the provider is
* loaded.
*
*/
#include <sfcCommon/utilft.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <sys/types.h>
#include <dirent.h>
#include <unistd.h>
#include "constClass.h"
#include "providerRegister.h"
#include "trace.h"
#include "native.h"
#include "control.h"
#include "config.h"
#include "sfcbmacs.h"
#define NEW(x) ((x *) malloc(sizeof(x)))
#include "cmpi/cmpidt.h"
#include "cmpi/cmpift.h"
#include "cmpiftx.h"
#include "cmpi/cmpimacs.h"
#include "cmpimacsx.h"
static const CMPIBroker *_broker;
void
ElementCapabilitiesInitInstances(const CMPIContext *ctx)
{
CMPIObjectPath *op = NULL,
*opLeft = NULL,
*opRight = NULL,
*left = NULL,
*right = NULL;
CMPIValue val;
CMPIEnumeration *enm = NULL;
CMPIInstance *ci = NULL;
CMPIContext *ctxLocal;
ctxLocal = native_clone_CMPIContext(ctx);
val.string = sfcb_native_new_CMPIString("$DefaultProvider$", NULL, 0);
ctxLocal->ft->addEntry(ctxLocal, "rerouteToProvider", &val, CMPI_string);
op = CMNewObjectPath(_broker, "root/interop", "SFCB_ElementCapabilities",
NULL);
ci = CMNewInstance(_broker, op, NULL);
opLeft =
CMNewObjectPath(_broker, "root/interop", "CIM_IndicationService",
NULL);
enm = CBEnumInstanceNames(_broker, ctx, opLeft, NULL);
left = CMGetNext(enm, NULL).value.ref;
opRight =
CMNewObjectPath(_broker, "root/interop",
"SFCB_IndicationServiceCapabilities", NULL);
enm = CBEnumInstanceNames(_broker, ctx, opRight, NULL);
right = CMGetNext(enm, NULL).value.ref;
CMAddKey(op, "ManagedElement", &left, CMPI_ref);
CMAddKey(op, "Capabilities", &right, CMPI_ref);
CMSetProperty(ci, "ManagedElement", &left, CMPI_ref);
CMSetProperty(ci, "Capabilities", &right, CMPI_ref);
CBCreateInstance(_broker, ctxLocal, op, ci, NULL);
CMRelease(ctxLocal);
return;
}
CMPIStatus
ElementCapabilitiesAssociators(CMPIAssociationMI * mi,
const CMPIContext *ctx,
const CMPIResult *rslt,
const CMPIObjectPath * cop,
const char *assocClass,
const char *resultClass,
const char *role,
const char *resultRole,
const char **propertyList)
{
return okSt;
}
CMPIStatus
ElementCapabilitiesAssociatorNames(CMPIAssociationMI * mi,
const CMPIContext *ctx,
const CMPIResult *rslt,
const CMPIObjectPath * cop,
const char *assocClass,
const char *resultClass,
const char *role,
const char *resultRole)
{
return okSt;
}
CMPIStatus
ElementCapabilitiesReferences(CMPIAssociationMI * mi,
const CMPIContext *ctx,
const CMPIResult *rslt,
const CMPIObjectPath * cop,
const char *resultClass,
const char *role, const char **propertyList)
{
return okSt;
}
CMPIStatus
ElementCapabilitiesReferenceNames(CMPIAssociationMI * mi,
const CMPIContext *ctx,
const CMPIResult *rslt,
const CMPIObjectPath * cop,
const char *resultClass,
const char *role)
{
return okSt;
}
/* ElementCapabilitiesAssociationCleanup */
static CMPIStatus okCleanup(ElementCapabilities,Association);
static CMPIAssociationMIFT assocMIFT__ElementCapabilities = {
CMPICurrentVersion,
CMPICurrentVersion,
"associationElementCapabilities",
ElementCapabilitiesAssociationCleanup,
ElementCapabilitiesAssociators,
ElementCapabilitiesAssociatorNames,
ElementCapabilitiesReferences,
ElementCapabilitiesReferenceNames,
};
CMPI_EXTERN_C
CMPIAssociationMI *
ElementCapabilities_Create_AssociationMI(const CMPIBroker * brkr,
const CMPIContext *ctx,
CMPIStatus *rc)
{
static CMPIAssociationMI mi = {
NULL,
&assocMIFT__ElementCapabilities,
};
_broker = brkr;
ElementCapabilitiesInitInstances(ctx);
return &mi;
}
/* MODELINES */
/* DO NOT EDIT BELOW THIS COMMENT */
/* Modelines are added by 'make pretty' */
/* -*- Mode: C; c-basic-offset: 2; indent-tabs-mode: nil; -*- */
/* vi:set ts=2 sts=2 sw=2 expandtab: */