Deleted Added
full compact
ng_sample.c (132828) ng_sample.c (139238)
1
2/*
3 * ng_sample.c
4 *
5 * Copyright (c) 1996-1999 Whistle Communications, Inc.
6 * All rights reserved.
7 *
8 * Subject to the following obligations and disclaimer of warranty, use and

--- 22 unchanged lines hidden (view full) ---

31 * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34 * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
35 * OF SUCH DAMAGE.
36 *
37 * Author: Julian Elischer <julian@freebsd.org>
38 *
1
2/*
3 * ng_sample.c
4 *
5 * Copyright (c) 1996-1999 Whistle Communications, Inc.
6 * All rights reserved.
7 *
8 * Subject to the following obligations and disclaimer of warranty, use and

--- 22 unchanged lines hidden (view full) ---

31 * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34 * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
35 * OF SUCH DAMAGE.
36 *
37 * Author: Julian Elischer <julian@freebsd.org>
38 *
39 * $FreeBSD: head/sys/netgraph/ng_sample.c 132828 2004-07-29 08:05:02Z glebius $
39 * $FreeBSD: head/sys/netgraph/ng_sample.c 139238 2004-12-23 18:39:13Z rik $
40 * $Whistle: ng_sample.c,v 1.13 1999/11/01 09:24:52 julian Exp $
41 */
42
43#include <sys/param.h>
44#include <sys/systm.h>
45#include <sys/kernel.h>
46#include <sys/mbuf.h>
47#include <sys/malloc.h>

--- 150 unchanged lines hidden (view full) ---

198 /* Example of how one might use hooks with embedded numbers: All
199 * hooks start with 'dlci' and have a decimal trailing channel
200 * number up to 4 digits Use the leadin defined int he associated .h
201 * file. */
202 if (strncmp(name,
203 NG_XXX_HOOK_DLCI_LEADIN, strlen(NG_XXX_HOOK_DLCI_LEADIN)) == 0) {
204 char *eptr;
205
40 * $Whistle: ng_sample.c,v 1.13 1999/11/01 09:24:52 julian Exp $
41 */
42
43#include <sys/param.h>
44#include <sys/systm.h>
45#include <sys/kernel.h>
46#include <sys/mbuf.h>
47#include <sys/malloc.h>

--- 150 unchanged lines hidden (view full) ---

198 /* Example of how one might use hooks with embedded numbers: All
199 * hooks start with 'dlci' and have a decimal trailing channel
200 * number up to 4 digits Use the leadin defined int he associated .h
201 * file. */
202 if (strncmp(name,
203 NG_XXX_HOOK_DLCI_LEADIN, strlen(NG_XXX_HOOK_DLCI_LEADIN)) == 0) {
204 char *eptr;
205
206 cp = name + sizeof(NG_XXX_HOOK_DLCI_LEADIN);
206 cp = name + strlen(NG_XXX_HOOK_DLCI_LEADIN);
207 if (!isdigit(*cp) || (cp[0] == '0' && cp[1] != '\0'))
208 return (EINVAL);
209 dlci = (int)strtoul(cp, &eptr, 10);
210 if (*eptr != '\0' || dlci < 0 || dlci > 1023)
211 return (EINVAL);
212
213 /* We have a dlci, now either find it, or allocate it */
214 for (chan = 0; chan < XXX_NUM_DLCIS; chan++)

--- 284 unchanged lines hidden ---
207 if (!isdigit(*cp) || (cp[0] == '0' && cp[1] != '\0'))
208 return (EINVAL);
209 dlci = (int)strtoul(cp, &eptr, 10);
210 if (*eptr != '\0' || dlci < 0 || dlci > 1023)
211 return (EINVAL);
212
213 /* We have a dlci, now either find it, or allocate it */
214 for (chan = 0; chan < XXX_NUM_DLCIS; chan++)

--- 284 unchanged lines hidden ---