blob: e3b472100e3747f92b77514436eee19000f314ea [file] [log] [blame]
Darin Petkove6ca3202012-10-19 14:49:56 +02001// 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// pppd.h declares a field member called |class| which forces this file to be C.
6#include <pppd/pppd.h>
7
8#include "shill/shims/c_ppp.h"
9
10char pppd_version[] = VERSION;
11
12static void PPPOnUp(void *data, int arg) {
13 PPPOnConnect(ifname);
14}
15
16static void PPPOnPhaseChange(void *data, int arg) {
mukesh agrawalfc362912013-08-06 18:10:07 -070017 if (arg == PHASE_AUTHENTICATE) {
18 PPPOnAuthenticateStart();
19 } else if (arg == PHASE_NETWORK) {
20 // Either no authentication was required, or authentication has
21 // completed.
mukesh agrawalee10f372013-08-14 14:07:11 -070022 //
23 // TODO(quiche): We can also transition backwards to PHASE_NETWORK,
24 // when disconnecting. In such cases, the may want to omit this
25 // (spurious) call.
mukesh agrawalfc362912013-08-06 18:10:07 -070026 PPPOnAuthenticateDone();
27 } else if (arg == PHASE_DISCONNECT || arg == PHASE_DEAD) {
Darin Petkove6ca3202012-10-19 14:49:56 +020028 PPPOnDisconnect();
29 }
30}
31
Liam McLoughlin15fe6e32013-12-26 16:30:55 +000032__attribute__ ((visibility("default"))) int plugin_init() {
Darin Petkove6ca3202012-10-19 14:49:56 +020033 PPPInit();
34
35 chap_check_hook = PPPHasSecret;
36 pap_check_hook = PPPHasSecret;
37
38 pap_passwd_hook = PPPGetSecret;
39 chap_passwd_hook = PPPGetSecret;
40
41 add_notifier(&ip_up_notifier, PPPOnUp, NULL);
42 add_notifier(&phasechange, PPPOnPhaseChange, NULL);
43 add_notifier(&exitnotify, PPPOnExit, NULL);
44
45 return 0;
46}