From: Marcel Holtmann Date: Sat, 1 Mar 2008 06:53:50 +0000 (+0100) Subject: Add callbacks for starting and stopping interface X-Git-Tag: 2.0_alpha~4899 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e3db50a2ec3968dc31b780ad0bb794b908c227bb;p=framework%2Fconnectivity%2Fconnman.git Add callbacks for starting and stopping interface --- 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;