supplicant: Call scan callback if needed when removing interface
[framework/connectivity/connman.git] / doc / agent-api.txt
1 Agent hierarchy
2 ===============
3
4 Service         unique name
5 Interface       net.connman.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.Agent.Error.Retry
25
26                 void RequestBrowser(object service, string url)
27
28                         This method gets called when it is required
29                         to ask the user to open a website to procceed
30                         with login handling.
31
32                         This can happen if connected to a hotspot portal
33                         page without WISPr support.
34
35                         Possible Errors: net.connman.Agent.Error.Canceled
36
37                 dict RequestInput(object service, dict fields)
38
39                         This method gets called when trying to connect to
40                         a service and some extra input is required. For
41                         example a passphrase or the name of a hidden network.
42
43                         The return value should be a dictionary where the
44                         keys are the field names and the values are the
45                         actual fields. Alternatively an error indicating that
46                         the request got canceled can be returned.
47
48                         Most common return field names are "Name" and of
49                         course "Passphrase".
50
51                         The dictionary arguments contains field names with
52                         their input parameters.
53
54                         In case of WISPr credentials requests and if the user
55                         prefers to login through the browser by himself, agent
56                         will have to return a LaunchBrowser error (see below).
57
58                         Possible Errors: net.connman.Agent.Error.Canceled
59                                          net.connman.Agent.Error.LaunchBrowser
60
61                 void Cancel()
62
63                         This method gets called to indicate that the agent
64                         request failed before a reply was returned.
65
66 Fields          string Name
67
68                         The name of a network. This field will be requested
69                         when trying to connect to a hidden network.
70
71                 array{byte} SSID
72
73                         This field is an alternative to "Name" for WiFi
74                         networks and can be used to return the exact binary
75                         representation of a network name.
76
77                         Normally returning the "Name" field is the better
78                         option here.
79
80                 string Identity
81
82                         Identity (username) for EAP authentication methods.
83
84                 string Passphrase
85
86                         The passphrase for authentication. For example a WEP
87                         key, a PSK passphrase or a passphrase for EAP
88                         authentication methods.
89
90                 string PreviousPassphrase
91
92                         The previous passphrase successfully saved, i.e.
93                         which lead to a successfull connection. This field is
94                         provided as an informational argument when connecting
95                         with it does not work anymore, for instance when it
96                         has been changed on the AP. Such argument appears when
97                         a RequestInput is raised after a retry.
98
99                 string WPS
100
101                         This field requests the use of WPS to get associated.
102                         This is an alternate choice against Passphrase when
103                         requested service supports WPS. The reply can contain
104                         either empty pin, if user wants to use push-button
105                         method, or a pin code if user wants to use the pin
106                         method.
107
108                 string Username
109
110                         Username for WISPr authentication. This field will be
111                         requested when connecting to a WISPr-enabled hotspot.
112
113                 string Password
114
115                         Password for WISPr authentication. This field will be
116                         requested when connecting to a WISPr-enabled hotspot.
117
118 Arguments       string Type
119
120                         Contains the type of a field. For example "psk", "wep"
121                         "informational", "passphrase", "response", "ssid",
122                         "wpspin" or plain "string". "informational" has no
123                         "Requirement" but a "Value".
124
125                 string Requirement
126
127                         Contains the requirement option. Valid values are
128                         "mandatory", "optional" or "alternate".
129
130                         The "alternate" value specifies that this field can be
131                         returned as an alternative to another one. An example
132                         would be the network name or SSID.
133
134                         All "mandatory" fields must be returned, while the
135                         "optional" can be returned if available.
136
137                 array{string} Alternates
138
139                         Contains the list of alternate field names this
140                         field can be represented by.
141
142                 string Value
143
144                         Contains data as a string, relatively to an
145                         "informational" argument.
146
147 Examples        Requesting a passphrase for WPA2 network
148
149                         RequestInput("/service1",
150                                 { "Passphrase" : { "Type"        : "psk",
151                                                    "Requirement" : "mandatory"
152                                                  }
153                                 }
154                         ==> { "Passphrase" : "secret123" }
155
156                 Requesting a passphrase after an error on the previous one:
157
158                         RequestInput("/service1",
159                                 { "Passphrase" : { "Type"        : "psk",
160                                                    "Requirement" : "mandatory"
161                                                  },
162                                   "PreviousPassphrase" :
163                                                 { "Type"  : "informational",
164                                                   "Value" : "secret123"
165                                                 }
166                                 }
167
168                 Requesting name for hidden network
169
170                         RequestInput("/service2",
171                                 { "Name" : { "Type"        : "string",
172                                              "Requirement" : "mandatory",
173                                              "Alternates"  : [ "SSID" ]
174                                            },
175                                   "SSID" : { "Type"        : "ssid",
176                                              "Requirement" : "alternate"
177                                            }
178                                 }
179                         ==> { "Name" : "My hidden network" }
180
181                 Requesting a passphrase for a WPA2 network with WPS alternative:
182
183                         RequestInput("/service3",
184                                 { "Passphrase" : { "Type"        : "psk",
185                                                    "Requirement" : "mandatory",
186                                                    "Alternates"  : [ "WPS" ]
187                                                  },
188                                   "WPS"        : { "Type"        : "wpspin",
189                                                    "Requirement" : "alternate"
190                                                  }
191                                 }
192
193                         ==> { "WPS" : "123456" }
194
195                 Requesting passphrase for a WPA-Enterprise network:
196
197                         RequestInput("/service4",
198                                 { "Identity"   : { "Type"        : "string",
199                                                    "Requirement" : "mandatory"
200                                                  },
201                                   "Passphrase" : { "Type"        : "passphrase",
202                                                    "Requirement" : "mandatory"
203                                                  }
204                                 }
205
206                         ==> { "Identity" : "alice", "Passphrase": "secret123" }
207
208                 Requesting challenge response for a WPA-Enterprise network:
209
210                         RequestInput("/service4",
211                                 { "Identity"   : { "Type"        : "string",
212                                                    "Requirement" : "mandatory"
213                                                  },
214                                   "Passphrase" : { "Type"        : "response",
215                                                    "Requirement" : "mandatory"
216                                                  }
217                                 }
218
219                         ==> { "Identity" : "bob", "Passphrase": "secret123" }
220
221                 Requesting username and password for a WISPr-enabled hotspot:
222
223                         RequestInput("/service5",
224                                 { "Username"   : { "Type"        : "string",
225                                                    "Requirement" : "mandatory"
226                                                  },
227                                   "Password"   : { "Type"        : "passphrase",
228                                                    "Requirement" : "mandatory"
229                                                  }
230                                 }
231
232                         ==> { "Username" : "foo", "Password": "secret" }