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

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

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: Archie Cobbs <archie@freebsd.org>
38 *
39 * $Whistle: ng_parse.c,v 1.3 1999/11/29 01:43:48 archie Exp $
1
2/*
3 * ng_parse.c
4 *
5 * Copyright (c) 1999 Whistle Communications, Inc.
6 * All rights reserved.
7 *
8 * Subject to the following obligations and disclaimer of warranty, use and

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

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: Archie Cobbs <archie@freebsd.org>
38 *
39 * $Whistle: ng_parse.c,v 1.3 1999/11/29 01:43:48 archie Exp $
40 * $FreeBSD: head/sys/netgraph/ng_parse.c 131108 2004-06-25 19:22:05Z julian $
40 * $FreeBSD: head/sys/netgraph/ng_parse.c 132780 2004-07-28 06:59:55Z kan $
41 */
42
43#include <sys/types.h>
44#include <sys/param.h>
45#include <sys/systm.h>
46#include <sys/kernel.h>
47#include <sys/errno.h>
48#include <sys/malloc.h>

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

1110 FREE(str, M_NETGRAPH_PARSE);
1111 *off += toklen;
1112 *buflen = arraylen;
1113 return (0);
1114 } else {
1115 struct ng_parse_type subtype;
1116
1117 subtype = ng_parse_bytearray_subtype;
41 */
42
43#include <sys/types.h>
44#include <sys/param.h>
45#include <sys/systm.h>
46#include <sys/kernel.h>
47#include <sys/errno.h>
48#include <sys/malloc.h>

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

1110 FREE(str, M_NETGRAPH_PARSE);
1111 *off += toklen;
1112 *buflen = arraylen;
1113 return (0);
1114 } else {
1115 struct ng_parse_type subtype;
1116
1117 subtype = ng_parse_bytearray_subtype;
1118 (const void *)subtype.private = type->info;
1118 *(const void **)&subtype.private = type->info;
1119 return ng_array_parse(&subtype, s, off, start, buf, buflen);
1120 }
1121}
1122
1123static int
1124ng_bytearray_unparse(const struct ng_parse_type *type,
1125 const u_char *data, int *off, char *cbuf, int cbuflen)
1126{
1127 struct ng_parse_type subtype;
1128
1129 subtype = ng_parse_bytearray_subtype;
1119 return ng_array_parse(&subtype, s, off, start, buf, buflen);
1120 }
1121}
1122
1123static int
1124ng_bytearray_unparse(const struct ng_parse_type *type,
1125 const u_char *data, int *off, char *cbuf, int cbuflen)
1126{
1127 struct ng_parse_type subtype;
1128
1129 subtype = ng_parse_bytearray_subtype;
1130 (const void *)subtype.private = type->info;
1130 *(const void **)&subtype.private = type->info;
1131 return ng_array_unparse(&subtype, data, off, cbuf, cbuflen);
1132}
1133
1134static int
1135ng_bytearray_getDefault(const struct ng_parse_type *type,
1136 const u_char *const start, u_char *buf, int *buflen)
1137{
1138 struct ng_parse_type subtype;
1139
1140 subtype = ng_parse_bytearray_subtype;
1131 return ng_array_unparse(&subtype, data, off, cbuf, cbuflen);
1132}
1133
1134static int
1135ng_bytearray_getDefault(const struct ng_parse_type *type,
1136 const u_char *const start, u_char *buf, int *buflen)
1137{
1138 struct ng_parse_type subtype;
1139
1140 subtype = ng_parse_bytearray_subtype;
1141 (const void *)subtype.private = type->info;
1141 *(const void **)&subtype.private = type->info;
1142 return ng_array_getDefault(&subtype, start, buf, buflen);
1143}
1144
1145const struct ng_parse_type ng_parse_bytearray_type = {
1146 NULL,
1147 NULL,
1148 NULL,
1149 ng_bytearray_parse,

--- 714 unchanged lines hidden ---
1142 return ng_array_getDefault(&subtype, start, buf, buflen);
1143}
1144
1145const struct ng_parse_type ng_parse_bytearray_type = {
1146 NULL,
1147 NULL,
1148 NULL,
1149 ng_bytearray_parse,

--- 714 unchanged lines hidden ---