KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > filesys > netbios > win32 > NetBIOS


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.netbios.win32;
18
19 /**
20  * NetBIOS API Constants Class
21  */

22 public class NetBIOS
23 {
24     // NetBIOS command codes
25

26     public final static int NCBCall = 0x10;
27     public final static int NCBListen = 0x11;
28     public final static int NCBHangup = 0x12;
29     public final static int NCBSend = 0x14;
30     public final static int NCBRecv = 0x15;
31     public final static int NCBRecvAny = 0x16;
32     public final static int NCBChainSend = 0x17;
33     public final static int NCBDGSend = 0x20;
34     public final static int NCBDGRecv = 0x21;
35     public final static int NCBDGSendBc = 0x22;
36     public final static int NCBDGRecvBc = 0x23;
37     public final static int NCBAddName = 0x30;
38     public final static int NCBDelName = 0x31;
39     public final static int NCBReset = 0x32;
40     public final static int NCBAStat = 0x33;
41     public final static int NCBSStat = 0x34;
42     public final static int NCBCancel = 0x35;
43     public final static int NCBAddGrName = 0x36;
44     public final static int NCBEnum = 0x37;
45     public final static int NCBUnlink = 0x70;
46     public final static int NCBSendNA = 0x71;
47     public final static int NCBChainSendNA = 0x72;
48     public final static int NCBLANStAlert = 0x73;
49     public final static int NCBAction = 0x77;
50     public final static int NCBFindName = 0x78;
51     public final static int NCBTrace = 0x79;
52
53     public final static int Asynch = 0x80;
54
55     // Status codes
56

57     public final static int NRC_GoodRet = 0x00;
58     public final static int NRC_BufLen = 0x01;
59     public final static int NRC_IllCmd = 0x03;
60     public final static int NRC_CmdTmo = 0x05;
61     public final static int NRC_Incomp = 0x06;
62     public final static int NRC_Baddr = 0x07;
63     public final static int NRC_SNumOut = 0x08;
64     public final static int NRC_NoRes = 0x09;
65     public final static int NRC_SClosed = 0x0A;
66     public final static int NRC_CmdCan = 0x0B;
67     public final static int NRC_DupName = 0x0D;
68     public final static int NRC_NamTFul = 0x0E;
69     public final static int NRC_ActSes = 0x0F;
70     public final static int NRC_LocTFul = 0x11;
71     public final static int NRC_RemTFul = 0x12;
72     public final static int NRC_IllNN = 0x13;
73     public final static int NRC_NoCall = 0x14;
74     public final static int NRC_NoWild = 0x15;
75     public final static int NRC_InUse = 0x16;
76     public final static int NRC_NamErr = 0x17;
77     public final static int NRC_SAbort = 0x18;
78     public final static int NRC_NamConf = 0x19;
79     public final static int NRC_IfBusy = 0x21;
80     public final static int NRC_TooMany = 0x22;
81     public final static int NRC_Bridge = 0x23;
82     public final static int NRC_CanOccr = 0x24;
83     public final static int NRC_Cancel = 0x26;
84     public final static int NRC_DupEnv = 0x30;
85     public final static int NRC_EnvNotDef = 0x34;
86     public final static int NRC_OSResNotAv = 0x35;
87     public final static int NRC_MaxApps = 0x36;
88     public final static int NRC_NoSaps = 0x37;
89     public final static int NRC_NoResources = 0x38;
90     public final static int NRC_InvAddress = 0x39;
91     public final static int NRC_InvDDid = 0x3B;
92     public final static int NRC_LockFail = 0x3C;
93     public final static int NRC_OpenErr = 0x3F;
94     public final static int NRC_System = 0x40;
95     public final static int NRC_Pending = 0xFF;
96
97     // Various constants
98

99     public final static int NCBNameSize = 16;
100     public final static int MaxLANA = 254;
101
102     public final static int NameFlagsMask = 0x87;
103
104     public final static int GroupName = 0x80;
105     public final static int UniqueName = 0x00;
106     public final static int Registering = 0x00;
107     public final static int Registered = 0x04;
108     public final static int Deregistered = 0x05;
109     public final static int Duplicate = 0x06;
110     public final static int DuplicateDereg = 0x07;
111     public final static int ListenOutstanding = 0x01;
112     public final static int CallPending = 0x02;
113     public final static int SessionEstablished = 0x03;
114     public final static int HangupPending = 0x04;
115     public final static int HangupComplete = 0x05;
116     public final static int SessionAborted = 0x06;
117
118     public final static String JavaDoc AllTransports = "M\0\0\0";
119
120     // Maximum receive size (16bits)
121
//
122
// Multiple receives must be issued to receive data packets over this size
123

124     public final static int MaxReceiveSize = 0xFFFF;
125
126     /**
127      * Return the status string for a NetBIOS error code
128      *
129      * @param nbError int
130      * @return String
131      */

132     public final static String JavaDoc getErrorString(int nbError)
133     {
134
135         String JavaDoc str = "";
136
137         switch (nbError)
138         {
139         case NRC_GoodRet:
140             str = "Success status";
141             break;
142         case NRC_BufLen:
143             str = "Illegal buffer length";
144             break;
145         case NRC_IllCmd:
146             str = "Illegal command";
147             break;
148         case NRC_CmdTmo:
149             str = "Command timed out";
150             break;
151         case NRC_Incomp:
152             str = "Message incomplete, issue another command";
153             break;
154         case NRC_Baddr:
155             str = "Illegal buffer address";
156             break;
157         case NRC_SNumOut:
158             str = "Session number out of range";
159             break;
160         case NRC_NoRes:
161             str = "No resource available";
162             break;
163         case NRC_SClosed:
164             str = "Session closed";
165             break;
166         case NRC_CmdCan:
167             str = "Command cancelled";
168             break;
169         case NRC_DupName:
170             str = "Duplicate name";
171             break;
172         case NRC_NamTFul:
173             str = "Name table full";
174             break;
175         case NRC_ActSes:
176             str = "No deletions, name has active sessions";
177             break;
178         case NRC_LocTFul:
179             str = "Local session table full";
180             break;
181         case NRC_RemTFul:
182             str = "Remote session table full";
183             break;
184         case NRC_IllNN:
185             str = "Illegal name number";
186             break;
187         case NRC_NoCall:
188             str = "No callname";
189             break;
190         case NRC_NoWild:
191             str = "Cannot put * in ncb_name";
192             break;
193         case NRC_InUse:
194             str = "Name in use on remote adapter";
195             break;
196         case NRC_NamErr:
197             str = "Name deleted";
198             break;
199         case NRC_SAbort:
200             str = "Session ended abnormally";
201             break;
202         case NRC_NamConf:
203             str = "Name conflict detected";
204             break;
205         case NRC_IfBusy:
206             str = "Interface busy, IRET before retrying";
207             break;
208         case NRC_TooMany:
209             str = "Too many commands outstanding, try later";
210             break;
211         case NRC_Bridge:
212             str = "ncb_lana_num field invalid";
213             break;
214         case NRC_CanOccr:
215             str = "Command completed whilst cancel occurring";
216             break;
217         case NRC_Cancel:
218             str = "Command not valid to cancel";
219             break;
220         case NRC_DupEnv:
221             str = "Name defined by another local process";
222             break;
223         case NRC_EnvNotDef:
224             str = "Environment undefined, RESET required";
225             break;
226         case NRC_OSResNotAv:
227             str = "Require OS resources exhausted";
228             break;
229         case NRC_MaxApps:
230             str = "Max number of applications exceeded";
231             break;
232         case NRC_NoSaps:
233             str = "No saps available for NetBIOS";
234             break;
235         case NRC_NoResources:
236             str = "Requested resources not available";
237             break;
238         case NRC_InvAddress:
239             str = "Invalid ncb address or length";
240             break;
241         case NRC_InvDDid:
242             str = "Ivalid NCB DDID";
243             break;
244         case NRC_LockFail:
245             str = "Lock of user area failed";
246             break;
247         case NRC_OpenErr:
248             str = "NetBIOS not loaded";
249             break;
250         case NRC_System:
251             str = "System error";
252             break;
253         case NRC_Pending:
254             str = "Asyncrhonous command pending";
255             break;
256         }
257
258         return str;
259     }
260 }
261
Popular Tags