File tree Expand file tree Collapse file tree 2 files changed +37
-5
lines changed Expand file tree Collapse file tree 2 files changed +37
-5
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,22 @@ var IntrospectData = Interface{
17
17
},
18
18
}
19
19
20
+ // PeerData is the introspection data for the org.freedesktop.DBus.Peer interface.
21
+ var PeerData = Interface {
22
+ Name : "org.freedesktop.DBus.Peer" ,
23
+ Methods : []Method {
24
+ {
25
+ Name : "Ping" ,
26
+ },
27
+ {
28
+ Name : "GetMachineId" ,
29
+ Args : []Arg {
30
+ {"machine_uuid" , "s" , "out" },
31
+ },
32
+ },
33
+ },
34
+ }
35
+
20
36
// XML document type declaration of the introspection format version 1.0
21
37
const IntrospectDeclarationString = `
22
38
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
Original file line number Diff line number Diff line change @@ -16,19 +16,35 @@ import (
16
16
type Introspectable string
17
17
18
18
// NewIntrospectable returns an Introspectable that returns the introspection
19
- // data that corresponds to the given Node. If n.Interfaces doesn't contain the
20
- // data for org.freedesktop.DBus.Introspectable, it is added automatically.
19
+ // data that corresponds to the given Node.
20
+ //
21
+ // If n.Interfaces doesn't contain the data for
22
+ // org.freedesktop.DBus.Introspectable or org.freedesktop.DBus.Peer, they are
23
+ // added automatically.
21
24
func NewIntrospectable (n * Node ) Introspectable {
22
- found := false
25
+ foundIntrospect := false
26
+ foundPeer := false
27
+
23
28
for _ , v := range n .Interfaces {
24
29
if v .Name == "org.freedesktop.DBus.Introspectable" {
25
- found = true
30
+ foundIntrospect = true
31
+ break
32
+ }
33
+
34
+ if v .Name == "org.freedesktop.DBus.Peer" {
35
+ foundPeer = true
26
36
break
27
37
}
28
38
}
29
- if ! found {
39
+
40
+ if ! foundIntrospect {
30
41
n .Interfaces = append (n .Interfaces , IntrospectData )
31
42
}
43
+
44
+ if ! foundPeer {
45
+ n .Interfaces = append (n .Interfaces , PeerData )
46
+ }
47
+
32
48
b , err := xml .Marshal (n )
33
49
if err != nil {
34
50
panic (err )
You can’t perform that action at this time.
0 commit comments