From e3db50a2ec3968dc31b780ad0bb794b908c227bb Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 1 Mar 2008 07:53:50 +0100 Subject: [PATCH] Add callbacks for starting and stopping interface --- include/iface.h | 4 ++++ src/iface-inet.c | 13 ++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/include/iface.h b/include/iface.h index e5fb05d..b9ade5e 100644 --- a/include/iface.h +++ b/include/iface.h @@ -115,9 +115,13 @@ struct connman_iface { struct connman_iface_driver { const char *name; const char *capability; + int (*probe) (struct connman_iface *iface); void (*remove) (struct connman_iface *iface); + int (*start) (struct connman_iface *iface); + int (*stop) (struct connman_iface *iface); + int (*scan) (struct connman_iface *iface); int (*connect) (struct connman_iface *iface, struct connman_network *network); diff --git a/src/iface-inet.c b/src/iface-inet.c index a09ba31..a0915af 100644 --- a/src/iface-inet.c +++ b/src/iface-inet.c @@ -140,8 +140,13 @@ int __connman_iface_up(struct connman_iface *iface) ifr.ifr_flags |= IFF_UP; - if (ioctl(sk, SIOCSIFFLAGS, &ifr) < 0) + if (ioctl(sk, SIOCSIFFLAGS, &ifr) < 0) { err = -errno; + goto done; + } + + if (iface->driver->start) + err = iface->driver->start(iface); else err = 0; @@ -158,6 +163,12 @@ int __connman_iface_down(struct connman_iface *iface) DBG("iface %p", iface); + if (iface->driver->stop) { + err = iface->driver->stop(iface); + if (err < 0) + return err; + } + sk = socket(PF_INET, SOCK_DGRAM, 0); if (sk < 0) return -errno; -- 1.7.9.5