Libinfo-78.tar.gz
[apple/libinfo.git] / netinfo.subproj / nibind_prot.x
1 /*
2  * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3  *
4  * @APPLE_LICENSE_HEADER_START@
5  * 
6  * Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
7  * Reserved.  This file contains Original Code and/or Modifications of
8  * Original Code as defined in and that are subject to the Apple Public
9  * Source License Version 1.1 (the "License").  You may not use this file
10  * except in compliance with the License.  Please obtain a copy of the
11  * License at http://www.apple.com/publicsource and read it before using
12  * this file.
13  * 
14  * The Original Code and all software distributed under the License are
15  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT.  Please see the
19  * License for the specific language governing rights and limitations
20  * under the License.
21  * 
22  * @APPLE_LICENSE_HEADER_END@
23  */
24 /* 
25  * NetInfo binder protocol specification
26  * Copyright (C) 1989 by NeXT, Inc.
27  */
28
29 /* Preamble appearing on all generated output */
30 #ifndef NOPREAMBLE
31 %/*
32 % * Output of the RPC protocol compiler: DO NOT EDIT
33 % * Copyright (C) 1989 by NeXT, Inc.
34 % */
35 #endif
36
37 #ifdef RPC_HDR
38 %#ifndef NI_PROG
39 %#include <netinfo/ni_prot.h>
40 %#endif
41 #else
42 %#include <string.h>
43 #endif
44
45 const NIBIND_MAXREGS = 32;
46
47 struct nibind_addrinfo {
48         unsigned udp_port;
49         unsigned tcp_port;
50 };
51
52 struct nibind_registration {
53         ni_name tag;
54         nibind_addrinfo addrs;
55 };
56
57 union nibind_getregister_res switch (ni_status status) {
58 case NI_OK:
59         nibind_addrinfo addrs;
60 default:
61         void;
62 };
63
64 union nibind_listreg_res switch (ni_status status) {
65 case NI_OK:
66         nibind_registration regs<NIBIND_MAXREGS>;
67 default:
68         void;
69 };
70
71 struct nibind_clone_args {
72         ni_name tag;
73         ni_name master_name;
74         unsigned master_addr;
75         ni_name master_tag;
76 };
77         
78 struct nibind_bind_args {
79         unsigned client_addr;
80         ni_name client_tag;
81         ni_name server_tag;
82 };
83
84 program NIBIND_PROG {
85         version NIBIND_VERS {
86                 void
87                 NIBIND_PING(void) = 0;
88
89                 ni_status
90                 NIBIND_REGISTER(nibind_registration) = 1;
91
92                 ni_status
93                 NIBIND_UNREGISTER(ni_name) = 2;
94
95                 nibind_getregister_res
96                 NIBIND_GETREGISTER(ni_name) = 3;
97
98                 nibind_listreg_res
99                 NIBIND_LISTREG(void) = 4;
100
101                 ni_status
102                 NIBIND_CREATEMASTER(ni_name) = 5;
103
104                 ni_status
105                 NIBIND_CREATECLONE(nibind_clone_args) = 6;
106
107                 ni_status
108                 NIBIND_DESTROYDOMAIN(ni_name) = 7;
109
110                 /*
111                  * Answers only if the given binding is served
112                  */
113                 void
114                 NIBIND_BIND(nibind_bind_args) = 8;
115         } = 1;
116 } = 200100001;