void BundNcpsOpen(Bund b) { if (Enabled(&b->conf.options, BUND_CONF_IPCP)) IpcpOpen(b); if (Enabled(&b->conf.options, BUND_CONF_IPV6CP)) Ipv6cpOpen(b); if (Enabled(&b->conf.options, BUND_CONF_COMPRESSION)) CcpOpen(b); if (Enabled(&b->conf.options, BUND_CONF_ENCRYPTION)) EcpOpen(b); }
/* * \brief Enable the link layer to come up. * * The underlying hardware driver should have established a physical * connection before calling this function. * * \param name Physical device name optionally followed by username * and password, each separated by a slash. * */ static NUTFILE *NutPppOpen(NUTDEVICE * dev, CONST char *name, int mode, int acc) { NUTFILE *fp; uint8_t i; char *cp; char *sp; char pdn[9]; PPPDCB *dcb = dev->dev_dcb; /* Clear our device control block. */ memset(dcb, 0, sizeof(PPPDCB)); /* Get the first part of the name, it specifies the physical device. */ for (cp = (char *) name, i = 0; *cp && *cp != '/' && i < sizeof(pdn) - 1; i++) { pdn[i] = *cp++; } pdn[i] = 0; /* Open the pysical device. */ if ((dcb->dcb_fd = _open(pdn, _O_RDWR | _O_BINARY)) == -1) { return NUTFILE_EOF; } /* * Allocate a file structure to return. */ if ((fp = NutHeapAlloc(sizeof(NUTFILE))) == 0) { return NUTFILE_EOF; } fp->nf_next = 0; fp->nf_dev = dev; fp->nf_fcb = 0; /* * Extract user name and password and store it in our device control * block. It will be used later by the authentication layer. */ if (*cp == '/') { for (sp = ++cp, i = 0; *sp && *sp != '/'; sp++, i++); if (i) { dcb->dcb_user = NutHeapAlloc(i + 1); for (sp = (char*)dcb->dcb_user; *cp && *cp != '/';) *sp++ = *cp++; *sp = 0; } if (*cp == '/') { for (sp = ++cp, i = 0; *sp && *sp != '/'; sp++, i++); if (i) { dcb->dcb_pass = NutHeapAlloc(i + 1); for (sp = (char*)dcb->dcb_pass; *cp && *cp != '/';) *sp++ = *cp++; *sp = 0; } } } /* Enable all layers to come up. */ IpcpOpen(dev); return fp; }