Imported Upstream version 1.9.4
[deb_libnfs.git] / portmap / portmap.x
CommitLineData
dabf4152 1/*
f1f22dbf
RRS
2Copyright (c) 2014, Ronnie Sahlberg
3All rights reserved.
4
5Redistribution and use in source and binary forms, with or without
6modification, are permitted provided that the following conditions are met:
7
81. Redistributions of source code must retain the above copyright notice, this
9 list of conditions and the following disclaimer.
102. Redistributions in binary form must reproduce the above copyright notice,
11 this list of conditions and the following disclaimer in the documentation
12 and/or other materials provided with the distribution.
13
14THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
18ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
25The views and conclusions contained in the software and documentation are those
26of the authors and should not be interpreted as representing official policies,
27either expressed or implied, of the FreeBSD Project.
28*/
dabf4152
AM
29
30const PMAP_PORT = 111; /* portmapper port number */
31
f1f22dbf 32struct pmap2_mapping {
dabf4152
AM
33 unsigned int prog;
34 unsigned int vers;
35 unsigned int prot;
36 unsigned int port;
37};
38
f1f22dbf 39struct pmap2_call_args {
dabf4152
AM
40 unsigned int prog;
41 unsigned int vers;
42 unsigned int proc;
43 opaque args<>;
44};
45
f1f22dbf 46struct pmap2_call_result {
dabf4152
AM
47 unsigned int port;
48 opaque res<>;
49};
50
f1f22dbf
RRS
51struct pmap2_mapping_list {
52 pmap2_mapping map;
53 pmap2_mapping_list *next;
54};
55
56struct pmap2_dump_result {
57 struct pmap2_mapping_list *list;
58};
59
60struct pmap3_string_result {
61 string addr<>;
ee872606
RRS
62};
63
f1f22dbf
RRS
64struct pmap3_mapping {
65 unsigned int prog;
66 unsigned int vers;
67 string netid<>;
68 string addr<>;
69 string owner<>;
70};
71
72struct pmap3_mapping_list {
73 pmap3_mapping map;
74 pmap3_mapping_list *next;
75};
76
77struct pmap3_dump_result {
78 struct pmap3_mapping_list *list;
79};
80
81struct pmap3_call_args {
82 unsigned int prog;
83 unsigned int vers;
84 unsigned int proc;
85 opaque args<>;
86};
87
88struct pmap3_call_result {
89 unsigned int port;
90 opaque res<>;
91};
92
93struct pmap3_netbuf {
94 unsigned int maxlen;
95 /* This pretty much contains a sockaddr_storage.
96 * Beware differences in endianess for ss_family
97 * and whether or not ss_len exists.
98 */
99 opaque buf<>;
ee872606
RRS
100};
101
dabf4152
AM
102program PMAP_PROGRAM {
103 version PMAP_V2 {
104 void
f1f22dbf 105 PMAP2_NULL(void) = 0;
dabf4152
AM
106
107 bool
f1f22dbf 108 PMAP2_SET(pmap2_mapping) = 1;
dabf4152
AM
109
110 bool
f1f22dbf 111 PMAP2_UNSET(pmap2_mapping) = 2;
dabf4152
AM
112
113 unsigned int
f1f22dbf 114 PMAP2_GETPORT(pmap2_mapping) = 3;
dabf4152 115
f1f22dbf
RRS
116 pmap2_dump_result
117 PMAP2_DUMP(void) = 4;
ee872606 118
f1f22dbf
RRS
119 pmap2_call_result
120 PMAP2_CALLIT(pmap2_call_args) = 5;
dabf4152 121 } = 2;
f1f22dbf
RRS
122 version PMAP_V3 {
123 void
124 PMAP3_NULL(void) = 0;
125
126 bool
127 PMAP3_SET(pmap3_mapping) = 1;
128
129 bool
130 PMAP3_UNSET(pmap3_mapping) = 2;
131
132 pmap3_string_result
133 PMAP3_GETADDR(pmap3_mapping) = 3;
134
135 pmap3_dump_result
136 PMAP3_DUMP(void) = 4;
137
138 pmap3_call_result
139 PMAP3_CALLIT(pmap3_call_args) = 5;
140
141 unsigned int
142 PMAP3_GETTIME(void) = 6;
143
144 pmap3_netbuf
145 PMAP3_UADDR2TADDR(string) = 7;
146
147 struct pmap3_string_result
148 PMAP3_TADDR2UADDR(pmap3_netbuf) = 8;
149 } = 3;
dabf4152
AM
150} = 100000;
151