Thanks, This code works fine, I use it in Naja.
I have developed the libssh2 binding for python. Naja is Webdav, FTP, SFTP client and SSH Terminal. http://www.keyphrene.com/download/preview/naja137.exe http://www.keyphrene.com/products/naja/ cheers Vincent. > Oh cool! Good work Vincent. I looked over what the last person sent > about sending a certain type of SSH request, but that seemed like > something that should have been in the library... and here it is! > > Developers: Will this be included in the mainstream library? Seems > like a much needed addition! At least from my perspective, since I'm > writing a SSH client ;p > > Paul > > On Dec 25, 2007 2:28 AM, [EMAIL PROTECTED] > <[EMAIL PROTECTED]> wrote: >> Hi, >> >> I have added libssh2_channel_request_pty_size method for libssh2-0.17. >> This method works fine. >> >> LIBSSH2_API int >> libssh2_channel_request_pty_size(LIBSSH2_CHANNEL * channel, int width, >> int height, >> int width_px, int height_px) >> { >> LIBSSH2_SESSION *session = channel->session; >> unsigned char *s, *data; >> static const unsigned char reply_codes[3] = >> { SSH_MSG_CHANNEL_SUCCESS, SSH_MSG_CHANNEL_FAILURE, 0 }; >> unsigned long data_len; >> int rc; >> >> if (channel->reqPTY_state == libssh2_NB_state_idle) { >> /* 41 = packet_type(1) + channel(4) + pty_req_len(4) + >> "window-change"(13) + >> * want_reply(1) + width(4) + height(4) + width_px(4) + >> * height_px(4) */ >> channel->reqPTY_packet_len = 39; >> >> /* Zero the whole thing out */ >> memset(&channel->reqPTY_packet_requirev_state, 0, >> sizeof(channel->reqPTY_packet_requirev_state)); >> >> _libssh2_debug(session, LIBSSH2_DBG_CONN, >> "changing tty size on channel %lu/%lu", >> channel->local.id, >> channel->remote.id); >> >> s = channel->reqPTY_packet = >> LIBSSH2_ALLOC(session, channel->reqPTY_packet_len); >> if (!channel->reqPTY_packet) { >> libssh2_error(session, LIBSSH2_ERROR_ALLOC, >> "Unable to allocate memory for pty-request", >> 0); >> return -1; >> } >> >> *(s++) = SSH_MSG_CHANNEL_REQUEST; >> libssh2_htonu32(s, channel->remote.id); >> s += 4; >> libssh2_htonu32(s, sizeof("window-change") - 1); >> s += 4; >> memcpy(s, "window-change", sizeof("window-change") - 1); >> s += sizeof("window-change") - 1; >> >> *(s++) = 0x00; // Don't reply >> libssh2_htonu32(s, width); >> s += 4; >> libssh2_htonu32(s, height); >> s += 4; >> libssh2_htonu32(s, width_px); >> s += 4; >> libssh2_htonu32(s, height_px); >> s += 4; >> >> channel->reqPTY_state = libssh2_NB_state_created; >> } >> >> if (channel->reqPTY_state == libssh2_NB_state_created) { >> rc = libssh2_packet_write(session, channel->reqPTY_packet, >> channel->reqPTY_packet_len); >> if (rc == PACKET_EAGAIN) { >> return PACKET_EAGAIN; >> } else if (rc) { >> libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND, >> "Unable to send window-change packet", 0); >> LIBSSH2_FREE(session, channel->reqPTY_packet); >> channel->reqPTY_packet = NULL; >> channel->reqPTY_state = libssh2_NB_state_idle; >> return -1; >> } >> LIBSSH2_FREE(session, channel->reqPTY_packet); >> channel->reqPTY_packet = NULL; >> >> libssh2_htonu32(channel->reqPTY_local_channel, >> channel->local.id); >> >> channel->reqPTY_state = libssh2_NB_state_sent; >> return 0; >> } >> >> >> channel->reqPTY_state = libssh2_NB_state_idle; >> return -1; >> } >> >> >> >> Best Regards >> Vincent Jaulin >> >> Paul Thomas a écrit : >> >> > Developers, >> > >> > I've got a simpler question than last time. And btw, thanks for the >> > help on that last one! >> > >> > Ok, I know that I can use libssh2_channel_request_pty_ex() to get a >> > terminal and specify its width and height. Is there anyway that after >> > that pty is alive that I can make it re-adjust its dimensions? >> > >> > Thanks, >> > Paul >> > >> > ------------------------------------------------------------------------- >> > SF.Net email is sponsored by: >> > Check out the new SourceForge.net Marketplace. >> > It's the best place to buy or sell services >> > for just about anything Open Source. >> > http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace >> > _______________________________________________ >> > libssh2-devel mailing list >> > libssh2-devel@lists.sourceforge.net >> > https://lists.sourceforge.net/lists/listinfo/libssh2-devel >> > >> > >> >> > ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ libssh2-devel mailing list libssh2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libssh2-devel