Add typedefs for node methods

Suggested by phk.
This commit is contained in:
Julian Elischer 1999-11-01 10:00:40 +00:00
parent 79fe5b7c35
commit 74f5c6aa25
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=52752
17 changed files with 131 additions and 147 deletions

View File

@ -37,7 +37,7 @@
* Author: Julian Elischer <julian@whistle.com>
*
* $FreeBSD$
* $Whistle: netgraph.h,v 1.24 1999/01/28 23:54:52 julian Exp $
* $Whistle: netgraph.h,v 1.29 1999/11/01 07:56:13 julian Exp $
*/
#ifndef _NETGRAPH_NETGRAPH_H_
@ -129,37 +129,36 @@ typedef struct ng_meta *meta_p;
#define NGMF_TEST 0x01 /* discard at the last moment before sending */
#define NGMF_TRACE 0x02 /* trace when handing this data to a node */
/* node method definitions */
typedef int ng_constructor_t(node_p *node);
typedef int ng_rcvmsg_t(node_p node, struct ng_mesg *msg,
const char *retaddr, struct ng_mesg **resp);
typedef int ng_shutdown_t(node_p node);
typedef int ng_newhook_t(node_p node, hook_p hook, const char *name);
typedef hook_p ng_findhook_t(node_p node, const char *name);
typedef int ng_connect_t(hook_p hook);
typedef int ng_rcvdata_t(hook_p hook, struct mbuf *m, meta_p meta);
typedef int ng_disconnect_t(hook_p hook);
/*
* Structure of a node type
*/
struct ng_type {
/* Netgraph version number (must equal NG_VERSION) */
u_int32_t version;
u_int32_t version; /* must equal NG_VERSION */
const char *name; /* Unique type name */
modeventhand_t mod_event; /* Module event handler (optional) */
ng_constructor_t *constructor; /* Node constructor */
ng_rcvmsg_t *rcvmsg; /* control messages come here */
ng_shutdown_t *shutdown; /* reset, and free resources */
ng_newhook_t *newhook; /* first notification of new hook */
ng_findhook_t *findhook; /* only if you have 23000 hooks */
ng_connect_t *connect; /* final notification of new hook */
ng_rcvdata_t *rcvdata; /* date comes here */
ng_rcvdata_t *rcvdataq; /* or here if been queued */
ng_disconnect_t *disconnect; /* notify on disconnect */
/* Unique type name */
const char *name;
/* Module event handler (optional) */
modeventhand_t mod_event;
/* Node constructor */
int (*constructor)(node_p *node);
/* Calls using the node */
int (*rcvmsg)(node_p node, struct ng_mesg *msg,
const char *retaddr, struct ng_mesg **resp);
int (*shutdown)(node_p node);
int (*newhook)(node_p node, hook_p hook, const char *name);
hook_p (*findhook)(node_p node, const char *name);
/* Calls using the hook */
int (*connect)(hook_p hook); /* already linked in */
int (*rcvdata)(hook_p hook, struct mbuf *m, meta_p meta);
int (*rcvdataq)(hook_p hook, struct mbuf *m, meta_p meta);
int (*disconnect)(hook_p hook); /* notify on disconnect */
/* These are private to the base netgraph code */
/* R/W data private to the base netgraph code DON'T TOUCH!*/
LIST_ENTRY(ng_type) types; /* linked list of all types */
int refs; /* number of instances */
};

View File

@ -37,7 +37,7 @@
* Author: Julian Elischer <julian@whistle.com>
*
* $FreeBSD$
* $Whistle: ng_UI.c,v 1.11 1999/01/28 23:54:52 julian Exp $
* $Whistle: ng_UI.c,v 1.14 1999/11/01 09:24:51 julian Exp $
*/
#include <sys/param.h>
@ -74,13 +74,12 @@ struct private {
typedef struct private *priv_p;
/* Netgraph node methods */
static int ng_UI_constructor(node_p *nodep);
static int ng_UI_rcvmsg(node_p node, struct ng_mesg *msg,
const char *retaddr, struct ng_mesg **resp);
static int ng_UI_rmnode(node_p node);
static int ng_UI_newhook(node_p node, hook_p hook, const char *name);
static int ng_UI_rcvdata(hook_p hook, struct mbuf *m, meta_p meta);
static int ng_UI_disconnect(hook_p hook);
static ng_constructor_t ng_UI_constructor;
static ng_rcvmsg_t ng_UI_rcvmsg;
static ng_shutdown_t ng_UI_rmnode;
static ng_newhook_t ng_UI_newhook;
static ng_rcvdata_t ng_UI_rcvdata;
static ng_disconnect_t ng_UI_disconnect;
/* Node type descriptor */
static struct ng_type typestruct = {

View File

@ -37,7 +37,7 @@
* Author: Archie Cobbs <archie@whistle.com>
*
* $FreeBSD$
* $Whistle: ng_async.c,v 1.15 1999/01/28 23:54:52 julian Exp $
* $Whistle: ng_async.c,v 1.17 1999/11/01 09:24:51 julian Exp $
*/
/*
@ -97,13 +97,12 @@ typedef struct private *sc_p;
#define ERROUT(x) do { error = (x); goto done; } while (0)
/* Netgraph methods */
static int nga_constructor(node_p *node);
static int nga_rcvdata(hook_p hook, struct mbuf *m, meta_p meta);
static int nga_rcvmsg(node_p node, struct ng_mesg *msg,
const char *rtn, struct ng_mesg **resp);
static int nga_shutdown(node_p node);
static int nga_newhook(node_p node, hook_p hook, const char *name);
static int nga_disconnect(hook_p hook);
static ng_constructor_t nga_constructor;
static ng_rcvdata_t nga_rcvdata;
static ng_rcvmsg_t nga_rcvmsg;
static ng_shutdown_t nga_shutdown;
static ng_newhook_t nga_newhook;
static ng_disconnect_t nga_disconnect;
/* Helper stuff */
static int nga_rcv_sync(const sc_p sc, struct mbuf *m, meta_p meta);

View File

@ -37,7 +37,7 @@
* Author: Julian Elischer <julian@whistle.com>
*
* $FreeBSD$
* $Whistle: ng_cisco.c,v 1.23 1999/01/28 23:54:53 julian Exp $
* $Whistle: ng_cisco.c,v 1.25 1999/11/01 09:24:51 julian Exp $
*/
#include "opt_inet.h"
@ -119,14 +119,12 @@ struct cisco_priv {
typedef struct cisco_priv *sc_p;
/* Netgraph methods */
static int cisco_constructor(node_p *node);
static int cisco_rcvmsg(node_p node, struct ng_mesg *msg,
const char *retaddr, struct ng_mesg **resp);
static int cisco_rmnode(node_p node);
static int cisco_newhook(node_p node, hook_p hook, const char *name);
static int cisco_rcvdata(hook_p hook, struct mbuf *m, meta_p meta);
static int cisco_disconnect(hook_p hook);
static ng_constructor_t cisco_constructor;
static ng_rcvmsg_t cisco_rcvmsg;
static ng_shutdown_t cisco_rmnode;
static ng_newhook_t cisco_newhook;
static ng_rcvdata_t cisco_rcvdata;
static ng_disconnect_t cisco_disconnect;
/* Other functions */
static int cisco_input(sc_p sc, struct mbuf *m, meta_p meta);

View File

@ -37,7 +37,7 @@
* Author: Julian Elisher <julian@whistle.com>
*
* $FreeBSD$
* $Whistle: ng_echo.c,v 1.11 1999/01/28 23:54:53 julian Exp $
* $Whistle: ng_echo.c,v 1.13 1999/11/01 09:24:51 julian Exp $
*/
/*
@ -58,10 +58,9 @@
#include <netgraph/ng_echo.h>
/* Netgraph methods */
static int nge_rcvmsg(node_p node, struct ng_mesg *msg,
const char *retaddr, struct ng_mesg ** resp);
static int nge_rcvdata(hook_p hook, struct mbuf *m, meta_p meta);
static int nge_disconnect(hook_p hook);
static ng_rcvmsg_t nge_rcvmsg;
static ng_rcvdata_t nge_rcvdata;
static ng_disconnect_t nge_disconnect;
/* Netgraph type */
static struct ng_type typestruct = {

View File

@ -37,7 +37,7 @@
* Author: Julian Elisher <julian@whistle.com>
*
* $FreeBSD$
* $Whistle: ng_frame_relay.c,v 1.16 1999/01/28 23:54:53 julian Exp $
* $Whistle: ng_frame_relay.c,v 1.20 1999/11/01 09:24:51 julian Exp $
*/
/*
@ -126,11 +126,11 @@ static struct segment {
}
/* Netgraph methods */
static int ngfrm_constructor(node_p *nodep);
static int ngfrm_rmnode(node_p node);
static int ngfrm_newhook(node_p node, hook_p hook, const char *name);
static int ngfrm_rcvdata(hook_p hook, struct mbuf *m, meta_p meta);
static int ngfrm_disconnect(hook_p hook);
static ng_constructor_t ngfrm_constructor;
static ng_shutdown_t ngfrm_rmnode;
static ng_newhook_t ngfrm_newhook;
static ng_rcvdata_t ngfrm_rcvdata;
static ng_disconnect_t ngfrm_disconnect;
/* Other internal functions */
static int ngfrm_decode(node_p node, struct mbuf * m, meta_p meta);

View File

@ -37,7 +37,7 @@
* Author: Julian Elisher <julian@whistle.com>
*
* $FreeBSD$
* $Whistle: ng_hole.c,v 1.8 1999/01/28 23:54:53 julian Exp $
* $Whistle: ng_hole.c,v 1.10 1999/11/01 09:24:51 julian Exp $
*/
/*
@ -56,8 +56,8 @@
#include <netgraph/ng_hole.h>
/* Netgraph methods */
static int ngh_rcvdata(hook_p hook, struct mbuf *m, meta_p meta);
static int ngh_disconnect(hook_p hook);
static ng_rcvdata_t ngh_rcvdata;
static ng_disconnect_t ngh_disconnect;
static struct ng_type typestruct = {
NG_VERSION,

View File

@ -37,7 +37,7 @@
* Author: Archie Cobbs <archie@whistle.com>
*
* $FreeBSD$
* $Whistle: ng_iface.c,v 1.31 1999/02/02 22:27:28 archie Exp $
* $Whistle: ng_iface.c,v 1.33 1999/11/01 09:24:51 julian Exp $
*/
/*
@ -180,13 +180,12 @@ static void ng_iface_print_ioctl(struct ifnet *ifp, int cmd, caddr_t data);
#endif
/* Netgraph methods */
static int ng_iface_constructor(node_p *nodep);
static int ng_iface_rcvmsg(node_p node, struct ng_mesg *msg,
const char *retaddr, struct ng_mesg **resp);
static int ng_iface_rmnode(node_p node);
static int ng_iface_newhook(node_p node, hook_p hook, const char *name);
static int ng_iface_rcvdata(hook_p hook, struct mbuf *m, meta_p meta);
static int ng_iface_disconnect(hook_p hook);
static ng_constructor_t ng_iface_constructor;
static ng_rcvmsg_t ng_iface_rcvmsg;
static ng_shutdown_t ng_iface_rmnode;
static ng_newhook_t ng_iface_newhook;
static ng_rcvdata_t ng_iface_rcvdata;
static ng_disconnect_t ng_iface_disconnect;
/* Helper stuff */
static iffam_p get_iffam_from_af(int af);

View File

@ -37,7 +37,7 @@
* Author: Julian Elischer <julian@whistle.com>
*
* $FreeBSD$
* $Whistle: ng_lmi.c,v 1.35 1999/01/28 23:54:53 julian Exp $
* $Whistle: ng_lmi.c,v 1.38 1999/11/01 09:24:52 julian Exp $
*/
/*
@ -89,13 +89,12 @@
/*
* Netgraph node methods and type descriptor
*/
static int nglmi_constructor(node_p *node);
static int nglmi_rcvmsg(node_p node, struct ng_mesg *msg,
const char *retaddr, struct ng_mesg **resp);
static int nglmi_rmnode(node_p node);
static int nglmi_newhook(node_p node, hook_p hook, const char *name);
static int nglmi_rcvdata(hook_p hook, struct mbuf *m, meta_p meta);
static int nglmi_disconnect(hook_p hook); /* notify on disconnect */
static ng_constructor_t nglmi_constructor;
static ng_rcvmsg_t nglmi_rcvmsg;
static ng_shutdown_t nglmi_rmnode;
static ng_newhook_t nglmi_newhook;
static ng_rcvdata_t nglmi_rcvdata;
static ng_disconnect_t nglmi_disconnect;
static int nglmi_checkdata(hook_p hook, struct mbuf *m, meta_p meta);
static struct ng_type typestruct = {

View File

@ -37,7 +37,7 @@
* Author: Archie Cobbs <archie@whistle.com>
*
* $FreeBSD$
* $Whistle: ng_ppp.c,v 1.22 1999/01/28 23:54:53 julian Exp $
* $Whistle: ng_ppp.c,v 1.24 1999/11/01 09:24:52 julian Exp $
*/
/*
@ -179,13 +179,12 @@ struct private {
typedef struct private *priv_p;
/* Netgraph node methods */
static int ng_ppp_constructor(node_p *nodep);
static int ng_ppp_rcvmsg(node_p node, struct ng_mesg *msg,
const char *retaddr, struct ng_mesg **resp);
static int ng_ppp_rmnode(node_p node);
static int ng_ppp_newhook(node_p node, hook_p hook, const char *name);
static int ng_ppp_rcvdata(hook_p hook, struct mbuf *m, meta_p meta);
static int ng_ppp_disconnect(hook_p hook);
static ng_constructor_t ng_ppp_constructor;
static ng_rcvmsg_t ng_ppp_rcvmsg;
static ng_shutdown_t ng_ppp_rmnode;
static ng_newhook_t ng_ppp_newhook;
static ng_rcvdata_t ng_ppp_rcvdata;
static ng_disconnect_t ng_ppp_disconnect;
/* Helper functions */
static int ng_ppp_input(node_p node, int ln, struct mbuf *m, meta_p meta);

View File

@ -37,7 +37,7 @@
* Author: Julian Elischer <julian@whistle.com>
*
* $FreeBSD$
* $Whistle: ng_pppoe.c,v 1.7 1999/10/16 10:16:43 julian Exp $
* $Whistle: ng_pppoe.c,v 1.10 1999/11/01 09:24:52 julian Exp $
*/
#if 0
#define AAA printf("pppoe: %s\n", __FUNCTION__ );
@ -65,14 +65,13 @@
* sample node. These methods define the netgraph 'type'.
*/
static int ng_pppoe_constructor(node_p *node);
static int ng_pppoe_rcvmsg(node_p node, struct ng_mesg *msg,
const char *retaddr, struct ng_mesg **resp);
static int ng_pppoe_rmnode(node_p node);
static int ng_pppoe_newhook(node_p node, hook_p hook, const char *name);
static int ng_pppoe_connect(hook_p hook);
static int ng_pppoe_rcvdata(hook_p hook, struct mbuf *m, meta_p meta);
static int ng_pppoe_disconnect(hook_p hook);
static ng_constructor_t ng_pppoe_constructor;
static ng_rcvmsg_t ng_pppoe_rcvmsg;
static ng_shutdown_t ng_pppoe_rmnode;
static ng_newhook_t ng_pppoe_newhook;
static ng_connect_t ng_pppoe_connect;
static ng_rcvdata_t ng_pppoe_rcvdata;
static ng_disconnect_t ng_pppoe_disconnect;
/* Netgraph node type descriptor */
static struct ng_type typestruct = {

View File

@ -37,7 +37,7 @@
* Author: Julian Elischer <julian@whistle.com>
*
* $FreeBSD$
* $Whistle: ng_rfc1490.c,v 1.19 1999/01/28 23:54:53 julian Exp $
* $Whistle: ng_rfc1490.c,v 1.22 1999/11/01 09:24:52 julian Exp $
*/
/*
@ -89,13 +89,12 @@ struct private {
typedef struct private *priv_p;
/* Netgraph node methods */
static int ng_rfc1490_constructor(node_p * nodep);
static int ng_rfc1490_rcvmsg(node_p node, struct ng_mesg * msg,
const char *retaddr, struct ng_mesg **resp);
static int ng_rfc1490_rmnode(node_p node);
static int ng_rfc1490_newhook(node_p node, hook_p hook, const char *name);
static int ng_rfc1490_rcvdata(hook_p hook, struct mbuf *m, meta_p meta);
static int ng_rfc1490_disconnect(hook_p hook);
static ng_constructor_t ng_rfc1490_constructor;
static ng_rcvmsg_t ng_rfc1490_rcvmsg;
static ng_shutdown_t ng_rfc1490_rmnode;
static ng_newhook_t ng_rfc1490_newhook;
static ng_rcvdata_t ng_rfc1490_rcvdata;
static ng_disconnect_t ng_rfc1490_disconnect;
/* Node type descriptor */
static struct ng_type typestruct = {

View File

@ -37,7 +37,7 @@
* Author: Julian Elischer <julian@whistle.com>
*
* $FreeBSD$
* $Whistle: ng_sample.c,v 1.11 1999/01/28 23:54:54 julian Exp $
* $Whistle: ng_sample.c,v 1.13 1999/11/01 09:24:52 julian Exp $
*/
#include <sys/param.h>
@ -57,15 +57,14 @@
* sample node. These methods define the netgraph 'type'.
*/
static int ng_xxx_constructor(node_p *node);
static int ng_xxx_rcvmsg(node_p node, struct ng_mesg *msg,
const char *retaddr, struct ng_mesg **resp);
static int ng_xxx_rmnode(node_p node);
static int ng_xxx_newhook(node_p node, hook_p hook, const char *name);
static int ng_xxx_connect(hook_p hook);
static int ng_xxx_rcvdata(hook_p hook, struct mbuf *m, meta_p meta);
static int ng_xxx_rcvdataq(hook_p hook, struct mbuf *m, meta_p meta);
static int ng_xxx_disconnect(hook_p hook);
static ng_constructor_t ng_xxx_constructor;
static ng_rcvmsg_t ng_xxx_rcvmsg;
static ng_shutdown_t ng_xxx_rmnode;
static ng_newhook_t ng_xxx_newhook;
static ng_connect_t ng_xxx_connect;
static ng_rcvdata_t ng_xxx_rcvdata; /* note these are both ng_rcvdata_t */
static ng_rcvdata_t ng_xxx_rcvdataq; /* note these are both ng_rcvdata_t */
static ng_disconnect_t ng_xxx_disconnect;
/* Netgraph node type descriptor */
static struct ng_type typestruct = {

View File

@ -37,7 +37,7 @@
* Author: Julian Elischer <julian@whistle.com>
*
* $FreeBSD$
* $Whistle: ng_socket.c,v 1.25 1999/01/28 23:54:54 julian Exp $
* $Whistle: ng_socket.c,v 1.28 1999/11/01 09:24:52 julian Exp $
*/
/*
@ -98,12 +98,11 @@
*/
/* Netgraph node methods */
static int ngs_constructor(node_p *nodep);
static int ngs_rcvmsg(node_p node, struct ng_mesg *msg,
const char *retaddr, struct ng_mesg **resp);
static int ngs_rmnode(node_p node);
static int ngs_newhook(node_p node, hook_p hook, const char *name);
static int ngs_rcvdata(hook_p hook, struct mbuf *m, meta_p meta);
static ng_constructor_t ngs_constructor;
static ng_rcvmsg_t ngs_rcvmsg;
static ng_shutdown_t ngs_rmnode;
static ng_newhook_t ngs_newhook;
static ng_rcvdata_t ngs_rcvdata;
/* Internal methods */
static int ng_attach_data(struct socket *so);

View File

@ -37,7 +37,7 @@
* Author: Julian Elischer <julian@whistle.com>
*
* $FreeBSD$
* $Whistle: ng_tee.c,v 1.16 1999/01/28 23:54:54 julian Exp $
* $Whistle: ng_tee.c,v 1.18 1999/11/01 09:24:52 julian Exp $
*/
/*
@ -79,13 +79,12 @@ struct privdata {
typedef struct privdata *sc_p;
/* Netgraph methods */
static int ngt_constructor(node_p *node);
static int ngt_rcvmsg(node_p node, struct ng_mesg *msg,
const char *retaddr, struct ng_mesg **resp);
static int ngt_rmnode(node_p node);
static int ngt_newhook(node_p node, hook_p hook, const char *name);
static int ngt_rcvdata(hook_p hook, struct mbuf *m, meta_p meta);
static int ngt_disconnect(hook_p hook);
static ng_constructor_t ngt_constructor;
static ng_rcvmsg_t ngt_rcvmsg;
static ng_shutdown_t ngt_rmnode;
static ng_newhook_t ngt_newhook;
static ng_rcvdata_t ngt_rcvdata;
static ng_disconnect_t ngt_disconnect;
/* Netgraph type descriptor */
static struct ng_type typestruct = {

View File

@ -37,7 +37,7 @@
* Author: Archie Cobbs <archie@whistle.com>
*
* $FreeBSD$
* $Whistle: ng_tty.c,v 1.18 1999/01/28 23:54:54 julian Exp $
* $Whistle: ng_tty.c,v 1.21 1999/11/01 09:24:52 julian Exp $
*/
/*
@ -133,13 +133,12 @@ static int ngt_input(int c, struct tty *tp);
static int ngt_start(struct tty *tp);
/* Netgraph methods */
static int ngt_constructor(node_p *node);
static int ngt_rcvmsg(node_p node, struct ng_mesg *msg,
const char *retaddr, struct ng_mesg **resp);
static int ngt_shutdown(node_p node);
static int ngt_newhook(node_p node, hook_p hook, const char *name);
static int ngt_rcvdata(hook_p hook, struct mbuf *m, meta_p meta);
static int ngt_disconnect(hook_p hook);
static ng_constructor_t ngt_constructor;
static ng_rcvmsg_t ngt_rcvmsg;
static ng_shutdown_t ngt_shutdown;
static ng_newhook_t ngt_newhook;
static ng_rcvdata_t ngt_rcvdata;
static ng_disconnect_t ngt_disconnect;
static int ngt_mod_event(module_t mod, int event, void *data);
/* Other stuff */

View File

@ -37,7 +37,7 @@
* Author: Archie Cobbs <archie@whistle.com>
*
* $FreeBSD$
* $Whistle: ng_vjc.c,v 1.14 1999/01/28 23:54:54 julian Exp $
* $Whistle: ng_vjc.c,v 1.17 1999/11/01 09:24:52 julian Exp $
*/
/*
@ -88,13 +88,12 @@ typedef struct private *priv_p;
#define ERROUT(x) do { error = (x); goto done; } while (0)
/* Netgraph node methods */
static int ng_vjc_constructor(node_p *nodep);
static int ng_vjc_rcvmsg(node_p node, struct ng_mesg *msg,
const char *retaddr, struct ng_mesg **resp);
static int ng_vjc_rmnode(node_p node);
static int ng_vjc_newhook(node_p node, hook_p hook, const char *name);
static int ng_vjc_rcvdata(hook_p hook, struct mbuf *m, meta_p t);
static int ng_vjc_disconnect(hook_p hook);
static ng_constructor_t ng_vjc_constructor;
static ng_rcvmsg_t ng_vjc_rcvmsg;
static ng_shutdown_t ng_vjc_rmnode;
static ng_newhook_t ng_vjc_newhook;
static ng_rcvdata_t ng_vjc_rcvdata;
static ng_disconnect_t ng_vjc_disconnect;
/* Helper stuff */
static struct mbuf *ng_vjc_pulluphdrs(struct mbuf *m);