Imported Upstream version 1.29
[platform/upstream/connman.git] / doc / vpn-agent-api.txt
1 Agent hierarchy
2 ===============
3
4 Service         unique name
5 Interface       net.connman.vpn.Agent
6 Object path     freely definable
7
8 Methods         void Release()
9
10                         This method gets called when the service daemon
11                         unregisters the agent. An agent can use it to do
12                         cleanup tasks. There is no need to unregister the
13                         agent, because when this method gets called it has
14                         already been unregistered.
15
16                 void ReportError(object service, string error)
17
18                         This method gets called when an error has to be
19                         reported to the user.
20
21                         A special return value can be used to trigger a
22                         retry of the failed transaction.
23
24                         Possible Errors: net.connman.vpn.Agent.Error.Retry
25
26                 dict RequestInput(object service, dict fields)
27
28                         This method gets called when trying to connect to
29                         a service and some extra input is required. For
30                         example a password or username.
31
32                         The return value should be a dictionary where the
33                         keys are the field names and the values are the
34                         actual fields. Alternatively an error indicating that
35                         the request got canceled can be returned.
36
37                         Most common return field names are "Username" and of
38                         course "Password".
39
40                         The dictionary arguments contains field names with
41                         their input parameters.
42
43                         Possible Errors: net.connman.vpn.Agent.Error.Canceled
44
45                 void Cancel()
46
47                         This method gets called to indicate that the agent
48                         request failed before a reply was returned.
49
50 Fields          string Username
51
52                         Username for authentication. This field will be
53                         requested when connecting to L2TP and PPTP.
54
55                 string Password
56
57                         Password for authentication.
58
59                 boolean SaveCredentials
60
61                         Tells if the user wants the user credentials
62                         be saved by connman-vpnd.
63
64                 string Host
65
66                         End point of this VPN link i.e., the VPN gateway
67                         we are trying to connect to.
68
69                 string Name
70
71                         Name of the VPN connection we are trying to connect to.
72
73                 string OpenConnect.CACert
74
75                         Informational field containing a path name for an
76                         additional Certificate Authority file.
77
78                 string OpenConnect.ClientCert
79
80                         Informational field containing a pkcs11 URL or a path
81                         name for the client certificate.
82
83                 string OpenConnect.Cookie
84
85                         Return the OpenConnect cookie value that is used for
86                         authenticating the VPN session.
87
88                 string OpenConnect.ServerCert
89
90                         Return the OpenConnect server hash used to identify
91                         the final server after possible web authentication
92                         logins, selections and redirections.
93
94                 string OpenConnect.VPNHost
95
96                         Return the final VPN server to use after possible
97                         web authentication logins, selections and redirections.
98
99 Arguments       string Type
100
101                         Contains the type of a field. For example "password",
102                         "response", "boolean" or plain "string".
103
104                 string Requirement
105
106                         Contains the requirement option. Valid values are
107                         "mandatory", "optional", "alternate" or
108                         "informational".
109
110                         The "alternate" value specifies that this field can be
111                         returned as an alternative to another one.
112
113                         All "mandatory" fields must be returned, while the
114                         "optional" can be returned if available.
115
116                         Nothing needs to be returned for "informational", as it
117                         is here only to provide an information so a value is
118                         attached to it.
119
120                 array{string} Alternates
121
122                         Contains the list of alternate field names this
123                         field can be represented by.
124
125                 string Value
126
127                         Contains data as a string, relatively to an
128                         "informational" argument.
129
130 Examples        Requesting a username and password for L2TP network
131
132                         RequestInput("/vpn1",
133                                 { "Username" : { "Type"        : "string",
134                                                  "Requirement" : "mandatory"
135                                                 } }
136                                 { "Password" : { "Type"        : "password",
137                                                  "Requirement" : "mandatory"
138                                                 } }
139                                 { "SaveCredentials" : { "Type" : "boolean",
140                                                 "Requirement" : "optional"
141                                                 }
142                                 }
143                         ==> { "Username" : "foo", "Password" : "secret123",
144                                 "SaveCredentials" : true }
145
146                 Requesting a OpenConnect cookie
147
148                         RequestInput("/vpn2",
149                                 { "OpenConnect.Cookie" : { "Type" : "string",
150                                                  "Requirement" : "mandatory"
151                                                         } }
152                                 { "Host" : { "Type" : "string",
153                                          "Requirement" : "informational"
154                                                         } }
155                                 { "Name" : { "Type" : "string",
156                                          "Requirement" : "informational"
157                                                         } }
158                         ==> { "OpenConnect.Cookie" : "0123456@adfsf@asasdf" }