KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > filesys > smb > dcerpc > DCEPipeType


1 /*
2  * Copyright (C) 2005 Alfresco, Inc.
3  *
4  * Licensed under the Mozilla Public License version 1.1
5  * with a permitted attribution clause. You may obtain a
6  * copy of the License at
7  *
8  * http://www.alfresco.org/legal/license.txt
9  *
10  * Unless required by applicable law or agreed to in writing,
11  * software distributed under the License is distributed on an
12  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  * either express or implied. See the License for the specific
14  * language governing permissions and limitations under the
15  * License.
16  */

17 package org.alfresco.filesys.smb.dcerpc;
18
19 /**
20  * <p>
21  * Defines the special DCE/RPC pipe names.
22  */

23 public class DCEPipeType
24 {
25
26     // IPC$ client pipe names
27

28     private static final String JavaDoc[] _pipeNames = { "\\PIPE\\srvsvc",
29                                                                                  "\\PIPE\\samr",
30                                                                                  "\\PIPE\\winreg",
31                                                                                  "\\PIPE\\wkssvc",
32                                                                                  "\\PIPE\\NETLOGON",
33                                                                                  "\\PIPE\\lsarpc",
34                                                                                  "\\PIPE\\spoolss",
35                                                                                  "\\PIPE\\netdfs",
36                                                                                  "\\PIPE\\svcctl",
37                                                                                  "\\PIPE\\EVENTLOG",
38                                                                                  "\\PIPE\\NETLOGON"
39     };
40
41     // IPC$ server pipe names
42

43     private static final String JavaDoc[] _srvNames = { "\\PIPE\\ntsvcs",
44                                                                                         "\\PIPE\\lsass",
45                                                                                         "\\PIPE\\winreg",
46                                                                                         "\\PIPE\\ntsvcs",
47                                                                                         "\\PIPE\\lsass",
48                                                                                         "\\PIPE\\lsass",
49                                                                                         "\\PIPE\\spoolss",
50                                                                                         "\\PIPE\\netdfs",
51                                                                                         "\\PIPE\\svcctl",
52                                                                                         "\\PIPE\\EVENTLOG"
53     };
54     
55     // IPC$ pipe ids
56

57     public static final int PIPE_SRVSVC = 0;
58     public static final int PIPE_SAMR = 1;
59     public static final int PIPE_WINREG = 2;
60     public static final int PIPE_WKSSVC = 3;
61     public static final int PIPE_NETLOGON = 4;
62     public static final int PIPE_LSARPC = 5;
63     public static final int PIPE_SPOOLSS = 6;
64     public static final int PIPE_NETDFS = 7;
65     public static final int PIPE_SVCCTL = 8;
66     public static final int PIPE_EVENTLOG = 9;
67     public static final int PIPE_NETLOGON1= 10;
68     
69     // IPC$ pipe UUIDs
70

71     private static UUID _uuidNetLogon = new UUID("8a885d04-1ceb-11c9-9fe8-08002b104860", 2);
72     private static UUID _uuidWinReg = new UUID("338cd001-2244-31f1-aaaa-900038001003", 1);
73     private static UUID _uuidSvcCtl = new UUID("367abb81-9844-35f1-ad32-98f038001003", 2);
74     private static UUID _uuidLsaRpc = new UUID("12345678-1234-abcd-ef00-0123456789ab", 0);
75     private static UUID _uuidSrvSvc = new UUID("4b324fc8-1670-01d3-1278-5a47bf6ee188", 3);
76     private static UUID _uuidWksSvc = new UUID("6bffd098-a112-3610-9833-46c3f87e345a", 1);
77     private static UUID _uuidSamr = new UUID("12345778-1234-abcd-ef00-0123456789ac", 1);
78     private static UUID _uuidSpoolss = new UUID("12345778-1234-abcd-ef00-0123456789ab", 1);
79     private static UUID _uuidSvcctl = new UUID("367abb81-9844-35f1-ad32-98f038001003", 2);
80     private static UUID _uuidEventLog = new UUID("82273FDC-E32A-18C3-3F78-827929DC23EA", 0);
81     private static UUID _uuidNetLogon1= new UUID("12345678-1234-abcd-ef00-01234567cffb", 1);
82
83 // private static UUID _uuidAtSvc = new UUID("1ff70682-0a51-30e8-076d-740be8cee98b", 1);
84

85     /**
86      * Convert a pipe name to a type
87      *
88      * @param name String
89      * @return int
90      */

91     public final static int getNameAsType(String JavaDoc name)
92     {
93         for (int i = 0; i < _pipeNames.length; i++)
94         {
95             if (_pipeNames[i].equals(name))
96                 return i;
97         }
98         return -1;
99     }
100
101     /**
102      * Convert a pipe type to a name
103      *
104      * @param typ int
105      * @return String
106      */

107     public final static String JavaDoc getTypeAsString(int typ)
108     {
109         if (typ >= 0 && typ < _pipeNames.length)
110             return _pipeNames[typ];
111         return null;
112     }
113
114     /**
115      * Convert a pipe type to a short name
116      *
117      * @param typ int
118      * @return String
119      */

120     public final static String JavaDoc getTypeAsStringShort(int typ)
121     {
122         if (typ >= 0 && typ < _pipeNames.length)
123         {
124             String JavaDoc name = _pipeNames[typ];
125             return name.substring(5);
126         }
127         return null;
128     }
129
130     /**
131      * Return the UUID for the pipe type
132      *
133      * @param typ int
134      * @return UUID
135      */

136     public final static UUID getUUIDForType(int typ)
137     {
138         UUID ret = null;
139
140         switch (typ)
141         {
142         case PIPE_NETLOGON:
143             ret = _uuidNetLogon;
144             break;
145         case PIPE_NETLOGON1:
146             ret = _uuidNetLogon1;
147             break;
148         case PIPE_WINREG:
149             ret = _uuidWinReg;
150             break;
151         case PIPE_LSARPC:
152             ret = _uuidLsaRpc;
153             break;
154         case PIPE_WKSSVC:
155             ret = _uuidWksSvc;
156             break;
157         case PIPE_SAMR:
158             ret = _uuidSamr;
159             break;
160         case PIPE_SRVSVC:
161             ret = _uuidSrvSvc;
162             break;
163         case PIPE_SPOOLSS:
164             ret = _uuidSpoolss;
165             break;
166         case PIPE_SVCCTL:
167             ret = _uuidSvcCtl;
168             break;
169         case PIPE_EVENTLOG:
170             ret = _uuidEventLog;
171             break;
172         }
173         return ret;
174     }
175
176     /**
177      * Get the server-side pipe name for the specified pipe
178      *
179      * @param typ int
180      * @return String
181      */

182     public final static String JavaDoc getServerPipeName(int typ)
183     {
184         if (typ >= 0 && typ < _srvNames.length)
185             return _srvNames[typ];
186         return null;
187     }
188 }
189
Popular Tags