001: /*
002: * SSHTools - Java SSH2 API
003: *
004: * Copyright (C) 2002-2003 Lee David Painter and Contributors.
005: *
006: * Contributions made by:
007: *
008: * Brett Smith
009: * Richard Pernavas
010: * Erwin Bolwidt
011: *
012: * This program is free software; you can redistribute it and/or
013: * modify it under the terms of the GNU General Public License
014: * as published by the Free Software Foundation; either version 2
015: * of the License, or (at your option) any later version.
016: *
017: * This program is distributed in the hope that it will be useful,
018: * but WITHOUT ANY WARRANTY; without even the implied warranty of
019: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
020: * GNU General Public License for more details.
021: *
022: * You should have received a copy of the GNU General Public License
023: * along with this program; if not, write to the Free Software
024: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
025: */
026: package com.sshtools.j2ssh.sftp;
027:
028: import com.sshtools.j2ssh.io.ByteArrayReader;
029: import com.sshtools.j2ssh.io.ByteArrayWriter;
030: import com.sshtools.j2ssh.io.UnsignedInteger32;
031: import com.sshtools.j2ssh.subsystem.SubsystemMessage;
032:
033: /**
034: *
035: *
036: * @author $author$
037: * @version $Revision: 1.18 $
038: */
039: public class SshFxpStatus extends SubsystemMessage implements
040: MessageRequestId {
041: /** */
042: public static final int SSH_FXP_STATUS = 101;
043:
044: /** */
045: public static final int STATUS_FX_OK = 0;
046:
047: /** */
048: public static final int STATUS_FX_EOF = 1;
049:
050: /** */
051: public static final int STATUS_FX_NO_SUCH_FILE = 2;
052:
053: /** */
054: public static final int STATUS_FX_PERMISSION_DENIED = 3;
055:
056: /** */
057: public static final int STATUS_FX_FAILURE = 4;
058:
059: /** */
060: public static final int STATUS_FX_BAD_MESSAGE = 5;
061:
062: /** */
063: public static final int STATUS_FX_NO_CONNECTION = 6;
064:
065: /** */
066: public static final int STATUS_FX_CONNECTION_LOST = 7;
067:
068: /** */
069: public static final int STATUS_FX_OP_UNSUPPORTED = 8;
070:
071: //public static final int STATUS_FX_INVALID_HANDLE = 9;
072: //public static final int STATUS_FX_NO_SUCH_PATH = 10;
073: //public static final int STATUS_FX_FILE_ALREADY_EXISTS = 11;
074: //public static final int STATUS_FX_WRITE_PROTECT = 12;
075: private UnsignedInteger32 id;
076: private UnsignedInteger32 errorCode;
077: private String errorMessage;
078: private String languageTag;
079:
080: /**
081: * Creates a new SshFxpStatus object.
082: *
083: * @param id
084: * @param errorCode
085: * @param errorMessage
086: * @param languageTag
087: */
088: public SshFxpStatus(UnsignedInteger32 id,
089: UnsignedInteger32 errorCode, String errorMessage,
090: String languageTag) {
091: super (SSH_FXP_STATUS);
092: this .id = id;
093: this .errorCode = errorCode;
094: this .errorMessage = errorMessage;
095: this .languageTag = languageTag;
096: }
097:
098: /**
099: * Creates a new SshFxpStatus object.
100: */
101: public SshFxpStatus() {
102: super (SSH_FXP_STATUS);
103: }
104:
105: /**
106: *
107: *
108: * @return
109: */
110: public UnsignedInteger32 getId() {
111: return id;
112: }
113:
114: /**
115: *
116: *
117: * @return
118: */
119: public UnsignedInteger32 getErrorCode() {
120: return errorCode;
121: }
122:
123: /**
124: *
125: *
126: * @return
127: */
128: public String getErrorMessage() {
129: return errorMessage;
130: }
131:
132: /**
133: *
134: *
135: * @return
136: */
137: public String getLanguageTag() {
138: return languageTag;
139: }
140:
141: /**
142: *
143: *
144: * @param bar
145: *
146: * @throws java.io.IOException
147: * @throws com.sshtools.j2ssh.transport.InvalidMessageException DOCUMENT
148: * ME!
149: */
150: public void constructMessage(ByteArrayReader bar)
151: throws java.io.IOException,
152: com.sshtools.j2ssh.transport.InvalidMessageException {
153: id = bar.readUINT32();
154: errorCode = bar.readUINT32();
155: errorMessage = bar.readString();
156: languageTag = bar.readString();
157: }
158:
159: /**
160: *
161: *
162: * @return
163: */
164: public String getMessageName() {
165: return "SSH_FXP_STATUS";
166: }
167:
168: /**
169: *
170: *
171: * @param baw
172: *
173: * @throws java.io.IOException
174: * @throws com.sshtools.j2ssh.transport.InvalidMessageException DOCUMENT
175: * ME!
176: */
177: public void constructByteArray(ByteArrayWriter baw)
178: throws java.io.IOException,
179: com.sshtools.j2ssh.transport.InvalidMessageException {
180: baw.writeUINT32(id);
181: baw.writeUINT32(errorCode);
182: baw.writeString(errorMessage);
183: baw.writeString(languageTag);
184: }
185: }
|