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