13b2bd0f6Slogwang 23b2bd0f6Slogwang /* 33b2bd0f6Slogwang * netgraph.h 43b2bd0f6Slogwang * 53b2bd0f6Slogwang * Copyright (c) 1996-1999 Whistle Communications, Inc. 63b2bd0f6Slogwang * All rights reserved. 73b2bd0f6Slogwang * 83b2bd0f6Slogwang * Subject to the following obligations and disclaimer of warranty, use and 93b2bd0f6Slogwang * redistribution of this software, in source or object code forms, with or 103b2bd0f6Slogwang * without modifications are expressly permitted by Whistle Communications; 113b2bd0f6Slogwang * provided, however, that: 123b2bd0f6Slogwang * 1. Any and all reproductions of the source or object code must include the 133b2bd0f6Slogwang * copyright notice above and the following disclaimer of warranties; and 143b2bd0f6Slogwang * 2. No rights are granted, in any manner or form, to use Whistle 153b2bd0f6Slogwang * Communications, Inc. trademarks, including the mark "WHISTLE 163b2bd0f6Slogwang * COMMUNICATIONS" on advertising, endorsements, or otherwise except as 173b2bd0f6Slogwang * such appears in the above copyright notice or in the software. 183b2bd0f6Slogwang * 193b2bd0f6Slogwang * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND 203b2bd0f6Slogwang * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO 213b2bd0f6Slogwang * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE, 223b2bd0f6Slogwang * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF 233b2bd0f6Slogwang * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. 243b2bd0f6Slogwang * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY 253b2bd0f6Slogwang * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS 263b2bd0f6Slogwang * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE. 273b2bd0f6Slogwang * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES 283b2bd0f6Slogwang * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING 293b2bd0f6Slogwang * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 303b2bd0f6Slogwang * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR 313b2bd0f6Slogwang * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY 323b2bd0f6Slogwang * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 333b2bd0f6Slogwang * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 343b2bd0f6Slogwang * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY 353b2bd0f6Slogwang * OF SUCH DAMAGE. 363b2bd0f6Slogwang * 373b2bd0f6Slogwang * Author: Archie Cobbs <[email protected]> 383b2bd0f6Slogwang * 393b2bd0f6Slogwang * $FreeBSD$ 403b2bd0f6Slogwang * $Whistle: netgraph.h,v 1.7 1999/01/20 00:57:23 archie Exp $ 413b2bd0f6Slogwang */ 423b2bd0f6Slogwang 433b2bd0f6Slogwang #ifndef _NETGRAPH_H_ 443b2bd0f6Slogwang #define _NETGRAPH_H_ 453b2bd0f6Slogwang 463b2bd0f6Slogwang #include <sys/types.h> 473b2bd0f6Slogwang #include <netgraph/ng_message.h> 483b2bd0f6Slogwang 49*d4a07e70Sfengbojiang #ifdef FSTACK 50*d4a07e70Sfengbojiang #ifndef __printflike 51*d4a07e70Sfengbojiang #define __printflike(fmtarg, firstvararg) 52*d4a07e70Sfengbojiang #endif 53*d4a07e70Sfengbojiang 54*d4a07e70Sfengbojiang #define NGCTL_DEFAULT_RCVBUF 1024*8 55*d4a07e70Sfengbojiang #endif 56*d4a07e70Sfengbojiang 573b2bd0f6Slogwang __BEGIN_DECLS 583b2bd0f6Slogwang int NgMkSockNode(const char *, int *, int *); 593b2bd0f6Slogwang int NgNameNode(int, const char *, const char *, ...) __printflike(3, 4); 603b2bd0f6Slogwang int NgSendMsg(int, const char *, int, int, const void *, size_t); 613b2bd0f6Slogwang int NgSendAsciiMsg(int, const char *, const char *, ...) __printflike(3, 4); 623b2bd0f6Slogwang int NgSendReplyMsg(int, const char *, 633b2bd0f6Slogwang const struct ng_mesg *, const void *, size_t); 643b2bd0f6Slogwang int NgRecvMsg(int, struct ng_mesg *, size_t, char *); 653b2bd0f6Slogwang int NgAllocRecvMsg(int, struct ng_mesg **, char *); 663b2bd0f6Slogwang int NgRecvAsciiMsg(int, struct ng_mesg *, size_t, char *); 673b2bd0f6Slogwang int NgAllocRecvAsciiMsg(int, struct ng_mesg **, char *); 683b2bd0f6Slogwang int NgSendData(int, const char *, const u_char *, size_t); 693b2bd0f6Slogwang int NgRecvData(int, u_char *, size_t, char *); 703b2bd0f6Slogwang int NgAllocRecvData(int, u_char **, char *); 713b2bd0f6Slogwang int NgSetDebug(int); 723b2bd0f6Slogwang void NgSetErrLog(void (*)(const char *fmt, ...), 733b2bd0f6Slogwang void (*)(const char *fmt, ...)); 74*d4a07e70Sfengbojiang 75*d4a07e70Sfengbojiang #ifdef FSTACK 76*d4a07e70Sfengbojiang #include <sys/socket.h> 77*d4a07e70Sfengbojiang 78*d4a07e70Sfengbojiang int ng_socket(int domain, int type, int protocol); 79*d4a07e70Sfengbojiang int ng_connect(int sockfd, const struct sockaddr *addr, 80*d4a07e70Sfengbojiang socklen_t addrlen); 81*d4a07e70Sfengbojiang int ng_bind(int sockfd, const struct sockaddr *addr, 82*d4a07e70Sfengbojiang socklen_t addrlen); 83*d4a07e70Sfengbojiang ssize_t ng_sendto(int sockfd, const void *buf, size_t len, int flags, 84*d4a07e70Sfengbojiang const struct sockaddr *dest_addr, socklen_t addrlen); 85*d4a07e70Sfengbojiang ssize_t ng_recvfrom(int sockfd, void *buf, size_t len, int flags, 86*d4a07e70Sfengbojiang struct sockaddr *src_addr, socklen_t *addrlen); 87*d4a07e70Sfengbojiang int ng_close(int fd); 88*d4a07e70Sfengbojiang #endif 89*d4a07e70Sfengbojiang 903b2bd0f6Slogwang __END_DECLS 913b2bd0f6Slogwang 923b2bd0f6Slogwang #endif 933b2bd0f6Slogwang 94