Darin Petkov | e6ca320 | 2012-10-19 14:49:56 +0200 | [diff] [blame^] | 1 | // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "shill/shims/c_ppp.h" |
| 6 | |
| 7 | #include "shill/shims/ppp.h" |
| 8 | |
| 9 | using shill::shims::PPP; |
| 10 | using std::string; |
| 11 | |
| 12 | void PPPInit() { |
| 13 | PPP().Start(); |
| 14 | } |
| 15 | |
| 16 | int PPPHasSecret() { |
| 17 | return 1; |
| 18 | } |
| 19 | |
| 20 | int PPPGetSecret(char *username, char *password) { |
| 21 | string user, pass; |
| 22 | if (!PPP().GetSecret(&user, &pass)) { |
| 23 | return -1; |
| 24 | } |
| 25 | if (username) { |
| 26 | strcpy(username, user.c_str()); |
| 27 | } |
| 28 | if (password) { |
| 29 | strcpy(password, pass.c_str()); |
| 30 | } |
| 31 | return 1; |
| 32 | } |
| 33 | |
| 34 | void PPPOnConnect(const char *ifname) { |
| 35 | PPP().OnConnect(ifname); |
| 36 | } |
| 37 | |
| 38 | void PPPOnDisconnect() { |
| 39 | PPP().OnDisconnect(); |
| 40 | } |
| 41 | |
| 42 | void PPPOnExit(void */*data*/, int /*arg*/) { |
| 43 | PPP().Stop(); |
| 44 | } |