aboutsummaryrefslogtreecommitdiffstats
path: root/src/aj_std.c
blob: 694a01da6ee15c1fc20c1fabdfcf62a5033f3e9b (plain)
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
/**
 * @file
 */
/******************************************************************************
 *    Copyright (c) Open Connectivity Foundation (OCF), AllJoyn Open Source
 *    Project (AJOSP) Contributors and others.
 *
 *    SPDX-License-Identifier: Apache-2.0
 *
 *    All rights reserved. This program and the accompanying materials are
 *    made available under the terms of the Apache License, Version 2.0
 *    which accompanies this distribution, and is available at
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Copyright (c) Open Connectivity Foundation and Contributors to AllSeen
 *    Alliance. All rights reserved.
 *
 *    Permission to use, copy, modify, and/or distribute this software for
 *    any purpose with or without fee is hereby granted, provided that the
 *    above copyright notice and this permission notice appear in all
 *    copies.
 *
 *    THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
 *    WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
 *    WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
 *    AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
 *    DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
 *    PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
 *    TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 *    PERFORMANCE OF THIS SOFTWARE.
 ******************************************************************************/

#include <ajtcl/aj_target.h>
#include <ajtcl/aj_std.h>

const char AJ_DBusDestination[] = "org.freedesktop.DBus";
const char AJ_BusDestination[] = "org.alljoyn.Bus";

const char AJ_ErrServiceUnknown[] = "org.freedesktop.DBus.Error.ServiceUnknown";
const char AJ_ErrTimeout[] = "org.alljoyn.Bus.Timeout";
const char AJ_ErrRejected[] = "org.alljoyn.Bus.Rejected";
const char AJ_ErrResources[] = "org.alljoyn.Bus.Resources";
const char AJ_ErrUpdateNotAllowed[] = "org.alljoyn.Error.UpdateNotAllowed";
const char AJ_ErrInvalidValue[] = "org.alljoyn.Error.InvalidValue";
const char AJ_ErrFeatureNotAvailable[] = "org.alljoyn.Error.FeatureNotAvailable";
const char AJ_ErrMaxSizeExceeded[] = "org.alljoyn.Error.MaxSizeExceeded";
const char AJ_ErrLanguageNotSuppored[] = "org.alljoyn.Error.LanguageNotSupported";
const char AJ_ErrMethodNotAllowed[] = "org.alljoyn.Error.MethodNotAllowed";

/* Security specific errors */
const char AJ_ErrSecurityViolation[] = "org.alljoyn.Bus.SecurityViolation";
const char AJ_ErrPermissionDenied[] = "org.alljoyn.Bus.Security.Error.PermissionDenied";
const char AJ_ErrDigestMismatch[] = "org.alljoyn.Bus.Security.Error.DigestMismatch";
const char AJ_ErrInvalidCertificate[] = "org.alljoyn.Bus.Security.Error.InvalidCertificate";
const char AJ_ErrDuplicateCertificate[] = "org.alljoyn.Bus.Security.Error.DuplicateCertificate";
const char AJ_ErrCertificateNotFound[] = "org.alljoyn.Bus.Security.Error.CertificateNotFound";
const char AJ_ErrPolicyNotNewer[] = "org.alljoyn.Bus.Security.Error.PolicyNotNewer";

static const char DBusObjectPath[] = "/org/freedesktop/DBus";
static const char DBusInterface[] = "org.freedesktop.DBus";
const char DBusPeerInterface[] = "#org.freedesktop.DBus.Peer";
static const char DBusPropsInterface[] = "#org.freedesktop.DBus.Properties";
static const char DBusIntrospectableInterface[] = "#org.freedesktop.DBus.Introspectable";

static const char BusObjectPath[] = "/org/alljoyn/Bus";
static const char BusInterface[] = "org.alljoyn.Bus";

static const char DaemonObjectPath[] = "/";
static const char DaemonInterface[] = "org.alljoyn.Daemon";

static const char PeerObjectPath[] = "/org/alljoyn/Bus/Peer";
static const char PeerSessionInterface[] = "org.alljoyn.Bus.Peer.Session";
const char PeerAuthInterface[] = "org.alljoyn.Bus.Peer.Authentication";

static const char AboutObjectPath[] = "/About";
static const char AboutInterface[] = "org.alljoyn.About";

static const char AboutIconObjectPath[] = "/About/DeviceIcon";
static const char AboutIconInterface[] = "org.alljoyn.Icon";

const char AllSeenIntrospectableInterface[] = "#org.allseen.Introspectable";

static const char SecurityObjectPath[] = "/org/alljoyn/Bus/Security";
static const char ApplicationInterface[] = "org.alljoyn.Bus.Application";
static const char SecurityApplicationInterface[] = "$org.alljoyn.Bus.Security.Application";
static const char SecurityClaimableApplicationInterface[] = "$org.alljoyn.Bus.Security.ClaimableApplication";
static const char SecurityManagedApplicationInterface[] = "$org.alljoyn.Bus.Security.ManagedApplication";

const char* const AJ_PropertiesIface[] = {
    DBusPropsInterface,
    "?Get <s <s >v",
    "?Set <s <s <v",
    "?GetAll <s >a{sv}",
    "!PropertiesChanged >s >a{sv} >as",
    NULL
};

const char* const AJ_IntrospectionIface[] = {
    DBusIntrospectableInterface,
    "?Introspect >s",
    NULL
};

const char* const AJ_AllSeenIntrospectionIface[] = {
    AllSeenIntrospectableInterface,
    "?GetDescriptionLanguages >as",
    "?IntrospectWithDescription <s >s",
    NULL
};

static const char* const DBusIface[] = {
    DBusInterface,
    "?Hello >s",
    "!NameOwnerChanged >s >s >s",
    "!NameAcquired >s",
    "!NameLost >s",
    "?RequestName <s <u >u",
    "?AddMatch <s",
    "?RemoveMatch <s",
    "?ReleaseName <s >u",
    "?NameHasOwner <s >b",
    NULL

};

static const char* const DBusPeerIface[] = {
    DBusPeerInterface,
    "?Ping",
    "?GetMachineId >s",
    NULL

};

static const AJ_InterfaceDescription DBusIfaces[] = {
    DBusIface,
    NULL
};

static const char* const BusIface[] = {
    BusInterface,
    "!SessionLost >u",
    "!FoundAdvertisedName >s >q >s",
    "!LostAdvertisedName >s >q >s",
    "!MPSessionChanged >u >s >b",
    "?AdvertiseName <s <q >u",
    "?CancelAdvertiseName <s <q >u",
    "?FindAdvertisedName <s >u",
    "?CancelFindAdvertisedName <s >u",
    "?BindSessionPort <q <a{sv} >u >q",
    "?UnbindSessionPort <q >u",
    "?JoinSession <s <q <a{sv} >u >u >a{sv}",
    "?LeaveSession <u >u",
    "?CancelSessionlessMessage <u >u",
    "?FindAdvertisedNameByTransport <s <q >u",
    "?CancelFindAdvertisedNameByTransport <s <q >u",
    "?SetLinkTimeout <u <u >u >u",
    "?RemoveSessionMember <us >u",
    "!SessionLostWithReason >u >u",
    "?Ping <s <u >u",
    "?SetIdleTimeouts <u <u >u >u >u",
    "?SimpleHello <s <u >s >s >u",
    NULL
};

static const char* const DaemonIface[] = {
    DaemonInterface,
    "!ProbeReq",
    "!ProbeAck",
    NULL
};

static const char* const PeerSessionIface[] = {
    PeerSessionInterface,
    "?AcceptSession <q <u <s <a{sv} >b",
    "!SessionJoined >q >u >s",
    NULL
};

static const char* const PeerAuthIface[] = {
    PeerAuthInterface,
    "?ExchangeGuids <s <u >s >u",
    "?GenSessionKey <s <s <s >s >s",
    "?ExchangeGroupKeys <ay >ay",
    "?AuthChallenge <s >s",
    "?ExchangeSuites <au >au",
    "?KeyExchange <u <v >u >v",
    "?KeyAuthentication <v >v",
    "?SendManifests <a(ua(ssa(syy))saysay) >a(ua(ssa(syy))saysay)",
    "?SendMemberships <ya(yay) >ya(yay)",
    "@Mechanisms>s",
    "@Version>u",
    NULL
};

static const char* const AboutIface[] = {
    AboutInterface,
    "@Version>q",
    "?GetAboutData <s >a{sv}",
    "?GetObjectDescription >a(oas)",
    "!&Announce >q >q >a(oas) >a{sv}",
    NULL
};

static const char* const AboutIconIface[] = {
    AboutIconInterface,
    "@Version>q",
    "@MimeType>s",
    "@Size>u",
    "?GetUrl >s",
    "?GetContent >ay",
    NULL
};

static const char* const ApplicationIface[] = {
    ApplicationInterface,
    "@Version>q",
    "!&State >(yyayay) >q",
    NULL
};

static const char* const SecurityApplicationIface[] = {
    SecurityApplicationInterface,
    "@Version>q",
    "@ApplicationState>q",
    "@ManifestTemplateDigest>(yay)",
    "@EccPublicKey>(yyayay)",
    "@ManufacturerCertificate>a(yay)",
    "@ManifestTemplate>a(ssya(syy))",
    "@ClaimCapabilities>q",
    "@ClaimCapabilityAdditionalInfo>q",
    NULL
};

static const char* const SecurityClaimableApplicationIface[] = {
    SecurityClaimableApplicationInterface,
    "@Version>q",
    "?Claim <(yyayay) <ay <ay <(yyayay) <ay <a(yay) <a(ua(ssa(syy))saysay)",
    NULL
};

static const char* const SecurityManagedApplicationIface[] = {
    SecurityManagedApplicationInterface,
    "@Version>q",
    "@Identity>a(yay)",
    "@Manifests>a(ua(ssa(syy))saysay)",
    "@IdentityCertificateId>(ayay(yyayay))",
    "@PolicyVersion>u",
    "@Policy>(qua(a(ya(yyayayay)ay)a(ssa(syy))))",
    "@DefaultPolicy>(qua(a(ya(yyayayay)ay)a(ssa(syy))))",
    "@MembershipSummaries>a(ayay(yyayay))",
    "?Reset",
    "?UpdateIdentity <a(yay) <a(ua(ssa(syy))saysay)",
    "?UpdatePolicy <(qua(a(ya(yyayayay)ay)a(ssa(syy))))",
    "?ResetPolicy",
    "?InstallMembership <a(yay)",
    "?RemoveMembership <(ayay(yyayay))",
    "?StartManagement",
    "?EndManagement",
    "?InstallManifests <a(ua(ssa(syy))saysay)",
    NULL
};

static const AJ_InterfaceDescription PeerIfaces[] = {
    PeerSessionIface,
    PeerAuthIface,
    NULL
};

static const AJ_InterfaceDescription BusIfaces[] = {
    BusIface,
    NULL
};

static const AJ_InterfaceDescription SecurityIfaces[] = {
    AJ_PropertiesIface,
    ApplicationIface,
    SecurityApplicationIface,
    SecurityClaimableApplicationIface,
    SecurityManagedApplicationIface,
    NULL
};

/*
 * These are interfaces that all objects implement so use the wildcard in the object list
 */
static const AJ_InterfaceDescription CommonIfaces[] = {
    AJ_IntrospectionIface,
    DBusPeerIface,
    AJ_AllSeenIntrospectionIface,
    NULL
};

static const AJ_InterfaceDescription DaemonIfaces[] = {
    DaemonIface,
    NULL
};

static const AJ_InterfaceDescription AboutIfaces[] = {
    AJ_PropertiesIface,
    AboutIface,
    NULL
};

static const AJ_InterfaceDescription AboutIconIfaces[] = {
    AJ_PropertiesIface,
    AboutIconIface,
    NULL
};

/*
 * Ordering of these objects is important
 */
const AJ_Object AJ_StandardObjects[] = {
    { DBusObjectPath,        DBusIfaces,        AJ_OBJ_FLAG_IS_PROXY,  NULL },
    { BusObjectPath,         BusIfaces,         AJ_OBJ_FLAG_IS_PROXY,  NULL },
    { PeerObjectPath,        PeerIfaces,        0,                     NULL },
    { "?",                   CommonIfaces,      0,                     NULL },
    { DaemonObjectPath,      DaemonIfaces,      AJ_OBJ_FLAG_IS_PROXY,  NULL },
    { AboutObjectPath,       AboutIfaces,       0,                     NULL },
    { AboutIconObjectPath,   AboutIconIfaces,   0,                     NULL },
    { SecurityObjectPath,    SecurityIfaces,    0,                     NULL },
    { NULL,                  NULL,              0,                     NULL }
};