Commit | Line | Data |
---|---|---|
dabf4152 | 1 | /* |
f1f22dbf RRS |
2 | Copyright (c) 2014, Ronnie Sahlberg |
3 | All rights reserved. | |
4 | ||
5 | Redistribution and use in source and binary forms, with or without | |
6 | modification, are permitted provided that the following conditions are met: | |
7 | ||
8 | 1. Redistributions of source code must retain the above copyright notice, this | |
9 | list of conditions and the following disclaimer. | |
10 | 2. 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 | ||
14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | |
15 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
16 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | |
18 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
19 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
20 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
21 | ON 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 | |
23 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
24 | ||
25 | The views and conclusions contained in the software and documentation are those | |
26 | of the authors and should not be interpreted as representing official policies, | |
27 | either expressed or implied, of the FreeBSD Project. | |
28 | */ | |
dabf4152 AM |
29 | |
30 | const PMAP_PORT = 111; /* portmapper port number */ | |
31 | ||
f1f22dbf | 32 | struct pmap2_mapping { |
dabf4152 AM |
33 | unsigned int prog; |
34 | unsigned int vers; | |
35 | unsigned int prot; | |
36 | unsigned int port; | |
37 | }; | |
38 | ||
f1f22dbf | 39 | struct pmap2_call_args { |
dabf4152 AM |
40 | unsigned int prog; |
41 | unsigned int vers; | |
42 | unsigned int proc; | |
43 | opaque args<>; | |
44 | }; | |
45 | ||
f1f22dbf | 46 | struct pmap2_call_result { |
dabf4152 AM |
47 | unsigned int port; |
48 | opaque res<>; | |
49 | }; | |
50 | ||
f1f22dbf RRS |
51 | struct pmap2_mapping_list { |
52 | pmap2_mapping map; | |
53 | pmap2_mapping_list *next; | |
54 | }; | |
55 | ||
56 | struct pmap2_dump_result { | |
57 | struct pmap2_mapping_list *list; | |
58 | }; | |
59 | ||
60 | struct pmap3_string_result { | |
61 | string addr<>; | |
ee872606 RRS |
62 | }; |
63 | ||
f1f22dbf RRS |
64 | struct pmap3_mapping { |
65 | unsigned int prog; | |
66 | unsigned int vers; | |
67 | string netid<>; | |
68 | string addr<>; | |
69 | string owner<>; | |
70 | }; | |
71 | ||
72 | struct pmap3_mapping_list { | |
73 | pmap3_mapping map; | |
74 | pmap3_mapping_list *next; | |
75 | }; | |
76 | ||
77 | struct pmap3_dump_result { | |
78 | struct pmap3_mapping_list *list; | |
79 | }; | |
80 | ||
81 | struct pmap3_call_args { | |
82 | unsigned int prog; | |
83 | unsigned int vers; | |
84 | unsigned int proc; | |
85 | opaque args<>; | |
86 | }; | |
87 | ||
88 | struct pmap3_call_result { | |
89 | unsigned int port; | |
90 | opaque res<>; | |
91 | }; | |
92 | ||
93 | struct 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 |
102 | program 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 |