Home | History | Annotate | Download | only in sftp
      1 /*
      2  * Copyright (c) 2006-2011 Christian Plattner. All rights reserved.
      3  * Please refer to the LICENSE.txt for licensing details.
      4  */
      5 package ch.ethz.ssh2.sftp;
      6 
      7 /**
      8  *
      9  * SFTP Paket Types
     10  *
     11  * @author Christian Plattner
     12  * @version 2.50, 03/15/10
     13  *
     14  */
     15 public class Packet
     16 {
     17 	public static final int SSH_FXP_INIT = 1;
     18 	public static final int SSH_FXP_VERSION = 2;
     19 	public static final int SSH_FXP_OPEN = 3;
     20 	public static final int SSH_FXP_CLOSE = 4;
     21 	public static final int SSH_FXP_READ = 5;
     22 	public static final int SSH_FXP_WRITE = 6;
     23 	public static final int SSH_FXP_LSTAT = 7;
     24 	public static final int SSH_FXP_FSTAT = 8;
     25 	public static final int SSH_FXP_SETSTAT = 9;
     26 	public static final int SSH_FXP_FSETSTAT = 10;
     27 	public static final int SSH_FXP_OPENDIR = 11;
     28 	public static final int SSH_FXP_READDIR = 12;
     29 	public static final int SSH_FXP_REMOVE = 13;
     30 	public static final int SSH_FXP_MKDIR = 14;
     31 	public static final int SSH_FXP_RMDIR = 15;
     32 	public static final int SSH_FXP_REALPATH = 16;
     33 	public static final int SSH_FXP_STAT = 17;
     34 	public static final int SSH_FXP_RENAME = 18;
     35 	public static final int SSH_FXP_READLINK = 19;
     36 	public static final int SSH_FXP_SYMLINK = 20;
     37 
     38 	public static final int SSH_FXP_STATUS = 101;
     39 	public static final int SSH_FXP_HANDLE = 102;
     40 	public static final int SSH_FXP_DATA = 103;
     41 	public static final int SSH_FXP_NAME = 104;
     42 	public static final int SSH_FXP_ATTRS = 105;
     43 
     44 	public static final int SSH_FXP_EXTENDED = 200;
     45 	public static final int SSH_FXP_EXTENDED_REPLY = 201;
     46 
     47 	public static String forName(int type) {
     48 		switch(type) {
     49 			case SSH_FXP_INIT:
     50 				return "SSH_FXP_INIT";
     51 			case SSH_FXP_VERSION:
     52 				return "SSH_FXP_VERSION";
     53 			case SSH_FXP_OPEN:
     54 				return "SSH_FXP_OPEN";
     55 			case SSH_FXP_CLOSE:
     56 				return "SSH_FXP_CLOSE";
     57 			case SSH_FXP_READ:
     58 				return "SSH_FXP_READ";
     59 			case SSH_FXP_WRITE:
     60 				return "SSH_FXP_WRITE";
     61 			case SSH_FXP_LSTAT:
     62 				return "SSH_FXP_LSTAT";
     63 			case SSH_FXP_FSTAT:
     64 				return "SSH_FXP_FSTAT";
     65 			case SSH_FXP_SETSTAT:
     66 				return "SSH_FXP_SETSTAT";
     67 			case SSH_FXP_FSETSTAT:
     68 				return "SSH_FXP_FSETSTAT";
     69 			case SSH_FXP_OPENDIR:
     70 				return "SSH_FXP_OPENDIR";
     71 			case SSH_FXP_READDIR:
     72 				return "SSH_FXP_READDIR";
     73 			case SSH_FXP_REMOVE:
     74 				return "SSH_FXP_REMOVE";
     75 			case SSH_FXP_MKDIR:
     76 				return "SSH_FXP_MKDIR";
     77 			case SSH_FXP_RMDIR:
     78 				return "SSH_FXP_RMDIR";
     79 			case SSH_FXP_REALPATH:
     80 				return "SSH_FXP_REALPATH";
     81 			case SSH_FXP_STAT:
     82 				return "SSH_FXP_STAT";
     83 			case SSH_FXP_RENAME:
     84 				return "SSH_FXP_RENAME";
     85 			case SSH_FXP_READLINK:
     86 				return "SSH_FXP_READLINK";
     87 			case SSH_FXP_SYMLINK:
     88 				return "SSH_FXP_SYMLINK";
     89 			case SSH_FXP_STATUS:
     90 				return "SSH_FXP_STATUS";
     91 			case SSH_FXP_HANDLE:
     92 				return "SSH_FXP_HANDLE";
     93 			case SSH_FXP_DATA:
     94 				return "SSH_FXP_DATA";
     95 			case SSH_FXP_NAME:
     96 				return "SSH_FXP_NAME";
     97 			case SSH_FXP_ATTRS:
     98 				return "SSH_FXP_ATTRS";
     99 			case SSH_FXP_EXTENDED:
    100 				return "SSH_FXP_EXTENDED";
    101 			case SSH_FXP_EXTENDED_REPLY:
    102 				return "SSH_FXP_EXTENDED_REPLY";
    103 		}
    104 		return null;
    105 	}
    106 }
    107