...

Source file src/github.com/godbus/dbus/v5/introspect/introspect.go

Documentation: github.com/godbus/dbus/v5/introspect

     1  // Package introspect provides some utilities for dealing with the DBus
     2  // introspection format.
     3  package introspect
     4  
     5  import "encoding/xml"
     6  
     7  // The introspection data for the org.freedesktop.DBus.Introspectable interface.
     8  var IntrospectData = Interface{
     9  	Name: "org.freedesktop.DBus.Introspectable",
    10  	Methods: []Method{
    11  		{
    12  			Name: "Introspect",
    13  			Args: []Arg{
    14  				{"out", "s", "out"},
    15  			},
    16  		},
    17  	},
    18  }
    19  
    20  // XML document type declaration of the introspection format version 1.0
    21  const IntrospectDeclarationString = `
    22  	<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
    23  	 "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
    24  `
    25  
    26  // The introspection data for the org.freedesktop.DBus.Introspectable interface,
    27  // as a string.
    28  const IntrospectDataString = `
    29  	<interface name="org.freedesktop.DBus.Introspectable">
    30  		<method name="Introspect">
    31  			<arg name="out" direction="out" type="s"/>
    32  		</method>
    33  	</interface>
    34  `
    35  
    36  // Node is the root element of an introspection.
    37  type Node struct {
    38  	XMLName    xml.Name    `xml:"node"`
    39  	Name       string      `xml:"name,attr,omitempty"`
    40  	Interfaces []Interface `xml:"interface"`
    41  	Children   []Node      `xml:"node,omitempty"`
    42  }
    43  
    44  // Interface describes a DBus interface that is available on the message bus.
    45  type Interface struct {
    46  	Name        string       `xml:"name,attr"`
    47  	Methods     []Method     `xml:"method"`
    48  	Signals     []Signal     `xml:"signal"`
    49  	Properties  []Property   `xml:"property"`
    50  	Annotations []Annotation `xml:"annotation"`
    51  }
    52  
    53  // Method describes a Method on an Interface as returned by an introspection.
    54  type Method struct {
    55  	Name        string       `xml:"name,attr"`
    56  	Args        []Arg        `xml:"arg"`
    57  	Annotations []Annotation `xml:"annotation"`
    58  }
    59  
    60  // Signal describes a Signal emitted on an Interface.
    61  type Signal struct {
    62  	Name        string       `xml:"name,attr"`
    63  	Args        []Arg        `xml:"arg"`
    64  	Annotations []Annotation `xml:"annotation"`
    65  }
    66  
    67  // Property describes a property of an Interface.
    68  type Property struct {
    69  	Name        string       `xml:"name,attr"`
    70  	Type        string       `xml:"type,attr"`
    71  	Access      string       `xml:"access,attr"`
    72  	Annotations []Annotation `xml:"annotation"`
    73  }
    74  
    75  // Arg represents an argument of a method or a signal.
    76  type Arg struct {
    77  	Name      string `xml:"name,attr,omitempty"`
    78  	Type      string `xml:"type,attr"`
    79  	Direction string `xml:"direction,attr,omitempty"`
    80  }
    81  
    82  // Annotation is an annotation in the introspection format.
    83  type Annotation struct {
    84  	Name  string `xml:"name,attr"`
    85  	Value string `xml:"value,attr"`
    86  }
    87  

View as plain text