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.connection;
027:
028: import com.sshtools.j2ssh.io.ByteArrayReader;
029: import com.sshtools.j2ssh.io.ByteArrayWriter;
030: import com.sshtools.j2ssh.transport.InvalidMessageException;
031: import com.sshtools.j2ssh.transport.SshMessage;
032:
033: import java.io.IOException;
034:
035: /**
036: *
037: *
038: * @author $author$
039: * @version $Revision: 1.20 $
040: */
041: public class SshMsgChannelWindowAdjust extends SshMessage {
042: /** */
043: protected final static int SSH_MSG_CHANNEL_WINDOW_ADJUST = 93;
044: private long bytesToAdd;
045: private long recipientChannel;
046:
047: /**
048: * Creates a new SshMsgChannelWindowAdjust object.
049: *
050: * @param recipientChannel
051: * @param bytesToAdd
052: */
053: public SshMsgChannelWindowAdjust(long recipientChannel,
054: long bytesToAdd) {
055: super (SSH_MSG_CHANNEL_WINDOW_ADJUST);
056: this .recipientChannel = recipientChannel;
057: this .bytesToAdd = bytesToAdd;
058: }
059:
060: /**
061: * Creates a new SshMsgChannelWindowAdjust object.
062: */
063: public SshMsgChannelWindowAdjust() {
064: super (SSH_MSG_CHANNEL_WINDOW_ADJUST);
065: }
066:
067: /**
068: *
069: *
070: * @return
071: */
072: public long getBytesToAdd() {
073: return bytesToAdd;
074: }
075:
076: /**
077: *
078: *
079: * @return
080: */
081: public String getMessageName() {
082: return "SSH_MSG_CHANNEL_WINDOW_ADJUST";
083: }
084:
085: /**
086: *
087: *
088: * @return
089: */
090: public long getRecipientChannel() {
091: return recipientChannel;
092: }
093:
094: /**
095: *
096: *
097: * @param baw
098: *
099: * @throws InvalidMessageException
100: */
101: protected void constructByteArray(ByteArrayWriter baw)
102: throws InvalidMessageException {
103: try {
104: baw.writeInt(recipientChannel);
105: baw.writeInt(bytesToAdd);
106: } catch (IOException ioe) {
107: throw new InvalidMessageException("Invalid message data");
108: }
109: }
110:
111: /**
112: *
113: *
114: * @param bar
115: *
116: * @throws InvalidMessageException
117: */
118: protected void constructMessage(ByteArrayReader bar)
119: throws InvalidMessageException {
120: try {
121: recipientChannel = bar.readInt();
122: bytesToAdd = bar.readInt();
123: } catch (IOException ioe) {
124: throw new InvalidMessageException("Invalid message data");
125: }
126: }
127: }
|