1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 /* 22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 #ifndef _NCALL_H 27 #define _NCALL_H 28 29 #ifdef __cplusplus 30 extern "C" { 31 #endif 32 33 #ifndef DS_DDICT 34 #include <sys/time.h> 35 #endif 36 37 #ifdef _KERNEL 38 39 /* 40 * ncall_t is opaque RPC pointer 41 */ 42 typedef struct ncall_s { 43 int opaque; 44 } ncall_t; 45 46 #define NCALL_DATA_SZ 8192 /* ncall_put/get_data max size */ 47 #define NCALL_BROADCAST_ID (-2) /* magic broadcast nodeid */ 48 /* 49 * ncall send flags 50 */ 51 #define NCALL_PEND 1 /* disconnect immediately */ 52 #define NCALL_UNUSED 2 /* unused */ 53 #define NCALL_ASYNC 4 /* asynchronous send (ncall_free implied) */ 54 #define NCALL_RDATA 8 /* allocate a buffer to receive data in */ 55 56 extern void ncall_register_svc(int, void (*)(ncall_t *, int *)); 57 extern void ncall_unregister_svc(int); 58 59 extern int ncall_nodeid(char *); 60 extern char *ncall_nodename(int); 61 extern int ncall_mirror(int); 62 extern int ncall_self(void); 63 64 extern int ncall_alloc(int, int, int, ncall_t **); 65 extern int ncall_timedsend(ncall_t *, int, int, struct timeval *, ...); 66 extern int ncall_timedsendnotify(ncall_t *, int, int, struct timeval *, 67 void (*)(ncall_t *, void *), void *, ...); 68 extern int ncall_broadcast(ncall_t *, int, int, struct timeval *, ...); 69 extern int ncall_send(ncall_t *, int, int, ...); 70 extern int ncall_read_reply(ncall_t *, int, ...); 71 extern void ncall_reset(ncall_t *); 72 extern void ncall_free(ncall_t *); 73 74 extern int ncall_put_data(ncall_t *, void *, int); 75 extern int ncall_get_data(ncall_t *, void *, int); 76 77 extern int ncall_sender(ncall_t *); 78 extern void ncall_reply(ncall_t *, ...); 79 extern void ncall_pend(ncall_t *); 80 extern void ncall_done(ncall_t *); 81 extern int ncall_ping(char *, int *); 82 extern int ncall_maxnodes(void); 83 extern int ncall_nextnode(void **); 84 extern int ncall_errcode(ncall_t *, int *); 85 86 #endif /* _KERNEL */ 87 88 #define NCALLNMLN 257 89 90 /* 91 * Basic node info 92 */ 93 typedef struct ncall_node_s { 94 char nc_nodename[NCALLNMLN]; /* Nodename */ 95 int nc_nodeid; /* Nodeid */ 96 } ncall_node_t; 97 98 99 #define _NCIOC_(x) (('N'<<16)|('C'<<8)|(x)) 100 101 #define NC_IOC_GETNODE _NCIOC_(0) /* return this node */ 102 #define NC_IOC_START _NCIOC_(1) /* ncall core and stubs start */ 103 #define NC_IOC_STOP _NCIOC_(2) /* ncall stop */ 104 #define NC_IOC_GETNETNODES _NCIOC_(3) /* ncalladm -i */ 105 #define NC_IOC_PING _NCIOC_(4) /* ncalladm -p */ 106 /* 107 * _NCIOC_(5) to _NCIOC_(20) are reserved for the implementation module 108 */ 109 110 #define NCALL_NSC 100 /* 100 - 109 */ 111 #define NCALL_UNUSED1 110 /* 110 - 119 */ 112 #define NCALL_UNUSED2 120 /* 120 - 129 */ 113 #define NCALL_SDBC 130 /* 130 - 149 */ 114 #define NCALL_STE 150 /* 150 - 159 */ 115 #define NCALL_HM 160 /* 160 - 169 */ 116 117 #ifdef __cplusplus 118 } 119 #endif 120 121 #endif /* _NCALL_H */