Develop and Download Open Source Software

Browse Subversion Repository

Diff of /branches/ssh_chacha20poly1305/ttssh2/ttxssh/ssh.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 5844 by yutakapon, Fri May 1 13:06:54 2015 UTC revision 5850 by yutakapon, Wed May 6 15:57:02 2015 UTC
# Line 78  SOFTWARE, EVEN IF ADVISED OF THE POSSIBI Line 78  SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
78  #define CHANNEL_MAX 100  #define CHANNEL_MAX 100
79    
80    
81    static struct global_confirm global_confirms;
82    
83  static Channel_t channels[CHANNEL_MAX];  static Channel_t channels[CHANNEL_MAX];
84    
85  static char ssh_ttymodes[] = "\x01\x03\x02\x1c\x03\x08\x04\x15\x05\x04";  static char ssh_ttymodes[] = "\x01\x03\x02\x1c\x03\x08\x04\x15\x05\x04";
# Line 122  void ssh2_channel_send_close(PTInstVar p Line 124  void ssh2_channel_send_close(PTInstVar p
124  static BOOL SSH_agent_response(PTInstVar pvar, Channel_t *c, int local_channel_num, unsigned char *data, unsigned int buflen);  static BOOL SSH_agent_response(PTInstVar pvar, Channel_t *c, int local_channel_num, unsigned char *data, unsigned int buflen);
125    
126  //  //
127    // Global request confirm
128    //
129    static void client_init_global_confirm(void)
130    {
131            memset(&global_confirms, 0, sizeof(global_confirms));
132            global_confirms.ref_count = 0;
133    }
134    
135    void client_register_global_confirm(global_confirm_cb *cb, void *ctx)
136    {
137            struct global_confirm *gc = &global_confirms;
138    
139            if (gc->ref_count == 0) {
140                    gc->cb = cb;
141                    gc->ctx = ctx;
142                    gc->ref_count = 1;
143            }
144    }
145    
146    static int client_global_request_reply(PTInstVar pvar, int type, unsigned int seq, void *ctxt)
147    {
148            struct global_confirm *gc = &global_confirms;
149    
150            if (gc->ref_count >= 1) {
151                    if (gc->cb)
152                            gc->cb(pvar, type, seq, gc->ctx);
153                    gc->ref_count = 0;
154            }
155    
156            return 0;
157    }
158    
159    //
160  // channel function  // channel function
161  //  //
162  static Channel_t *ssh2_channel_new(unsigned int window, unsigned int maxpack,  static Channel_t *ssh2_channel_new(unsigned int window, unsigned int maxpack,
# Line 1674  static void init_protocol(PTInstVar pvar Line 1709  static void init_protocol(PTInstVar pvar
1709                  enque_handler(pvar, SSH2_MSG_REQUEST_FAILURE, handle_SSH2_request_failure);                  enque_handler(pvar, SSH2_MSG_REQUEST_FAILURE, handle_SSH2_request_failure);
1710                  enque_handler(pvar, SSH2_MSG_REQUEST_SUCCESS, handle_SSH2_request_success);                  enque_handler(pvar, SSH2_MSG_REQUEST_SUCCESS, handle_SSH2_request_success);
1711    
1712                    client_init_global_confirm();
1713    
1714          }          }
1715  }  }
1716    
# Line 7495  static BOOL handle_SSH2_request_success( Line 7532  static BOOL handle_SSH2_request_success(
7532          // 必要であればログを取る。特に何もしなくてもよい。          // 必要であればログを取る。特に何もしなくてもよい。
7533          notify_verbose_message(pvar, "SSH2_MSG_REQUEST_SUCCESS was received.", LOG_LEVEL_VERBOSE);          notify_verbose_message(pvar, "SSH2_MSG_REQUEST_SUCCESS was received.", LOG_LEVEL_VERBOSE);
7534    
7535            client_global_request_reply(pvar, SSH2_MSG_REQUEST_SUCCESS, 0, NULL);
7536    
7537          return TRUE;          return TRUE;
7538  }  }
7539    
# Line 7504  static BOOL handle_SSH2_request_failure( Line 7543  static BOOL handle_SSH2_request_failure(
7543          // 必要であればログを取る。特に何もしなくてもよい。          // 必要であればログを取る。特に何もしなくてもよい。
7544          notify_verbose_message(pvar, "SSH2_MSG_REQUEST_FAILURE was received.", LOG_LEVEL_VERBOSE);          notify_verbose_message(pvar, "SSH2_MSG_REQUEST_FAILURE was received.", LOG_LEVEL_VERBOSE);
7545    
7546            client_global_request_reply(pvar, SSH2_MSG_REQUEST_FAILURE, 0, NULL);
7547    
7548          return TRUE;          return TRUE;
7549  }  }
7550    

Legend:
Removed from v.5844  
changed lines
  Added in v.5850

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26