File: Protocol.html

package info (click to toggle)
libnet-sftp-ruby 1.1.1-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 1,444 kB
  • ctags: 854
  • sloc: ruby: 4,216; makefile: 14
file content (168 lines) | stat: -rw-r--r-- 9,843 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
    <title>Module: Net::SFTP::Protocol</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />

    <script language="JavaScript" type="text/javascript">
    // <![CDATA[

        function toggleSource( id )
        {
          var elem
          var link

          if( document.getElementById )
          {
            elem = document.getElementById( id )
            link = document.getElementById( "l_" + id )
          }
          else if ( document.all )
          {
            elem = eval( "document.all." + id )
            link = eval( "document.all.l_" + id )
          }
          else
            return false;

          if( elem.style.display == "block" )
          {
            elem.style.display = "none"
            link.innerHTML = "show source"
          }
          else
          {
            elem.style.display = "block"
            link.innerHTML = "hide source"
          }
        }

        function openCode( url )
        {
          window.open( url, "SOURCE_CODE", "width=400,height=400,scrollbars=yes" )
        }
      // ]]>
    </script>
  </head>

  <body>
  <table width="100%" border='0' cellpadding='0' cellspacing='0' class='banner'><tr>
  <td class="file-title"><span class="file-title-prefix">Module</span><br />Net::SFTP::Protocol</td>
  <td align="right">
    <table cellspacing=0 cellpadding=2>
      <tr valign="top">
        <td>In:</td>
        <td>
<a href="../../../files/lib/net/sftp/protocol/01/attributes_rb.html">lib/net/sftp/protocol/01/attributes.rb</a>
<a href="../../../files/lib/net/sftp/protocol/01/impl_rb.html">lib/net/sftp/protocol/01/impl.rb</a>
<a href="../../../files/lib/net/sftp/protocol/01/packet-assistant_rb.html">lib/net/sftp/protocol/01/packet-assistant.rb</a>
<a href="../../../files/lib/net/sftp/protocol/01/services_rb.html">lib/net/sftp/protocol/01/services.rb</a>
<a href="../../../files/lib/net/sftp/protocol/02/impl_rb.html">lib/net/sftp/protocol/02/impl.rb</a>
<a href="../../../files/lib/net/sftp/protocol/02/packet-assistant_rb.html">lib/net/sftp/protocol/02/packet-assistant.rb</a>
<a href="../../../files/lib/net/sftp/protocol/02/services_rb.html">lib/net/sftp/protocol/02/services.rb</a>
<a href="../../../files/lib/net/sftp/protocol/03/impl_rb.html">lib/net/sftp/protocol/03/impl.rb</a>
<a href="../../../files/lib/net/sftp/protocol/03/packet-assistant_rb.html">lib/net/sftp/protocol/03/packet-assistant.rb</a>
<a href="../../../files/lib/net/sftp/protocol/03/services_rb.html">lib/net/sftp/protocol/03/services.rb</a>
<a href="../../../files/lib/net/sftp/protocol/04/attributes_rb.html">lib/net/sftp/protocol/04/attributes.rb</a>
<a href="../../../files/lib/net/sftp/protocol/04/impl_rb.html">lib/net/sftp/protocol/04/impl.rb</a>
<a href="../../../files/lib/net/sftp/protocol/04/packet-assistant_rb.html">lib/net/sftp/protocol/04/packet-assistant.rb</a>
<a href="../../../files/lib/net/sftp/protocol/04/services_rb.html">lib/net/sftp/protocol/04/services.rb</a>
<a href="../../../files/lib/net/sftp/protocol/05/impl_rb.html">lib/net/sftp/protocol/05/impl.rb</a>
<a href="../../../files/lib/net/sftp/protocol/05/packet-assistant_rb.html">lib/net/sftp/protocol/05/packet-assistant.rb</a>
<a href="../../../files/lib/net/sftp/protocol/05/services_rb.html">lib/net/sftp/protocol/05/services.rb</a>
<a href="../../../files/lib/net/sftp/protocol/constants_rb.html">lib/net/sftp/protocol/constants.rb</a>
<a href="../../../files/lib/net/sftp/protocol/driver_rb.html">lib/net/sftp/protocol/driver.rb</a>
<a href="../../../files/lib/net/sftp/protocol/packet-assistant_rb.html">lib/net/sftp/protocol/packet-assistant.rb</a>
<a href="../../../files/lib/net/sftp/protocol/services_rb.html">lib/net/sftp/protocol/services.rb</a>
        </td>
      </tr>
         </table>
        </td>
        </tr>
      </table>
 <!-- banner header -->

  <div id="bodyContent">
      <div id="content">




  <div class="sectiontitle">Methods</div>
  <ul>
  <li><a href="#M000037">register_services</a></li>
  </ul>



  <div class="sectiontitle">Classes and Modules</div>
  Module <a href="Protocol/Constants.html" class="link">Net::SFTP::Protocol::Constants</a><br />
Module <a href="Protocol/V_01.html" class="link">Net::SFTP::Protocol::V_01</a><br />
Module <a href="Protocol/V_02.html" class="link">Net::SFTP::Protocol::V_02</a><br />
Module <a href="Protocol/V_03.html" class="link">Net::SFTP::Protocol::V_03</a><br />
Module <a href="Protocol/V_04.html" class="link">Net::SFTP::Protocol::V_04</a><br />
Module <a href="Protocol/V_05.html" class="link">Net::SFTP::Protocol::V_05</a><br />
Class <a href="Protocol/Driver.html" class="link">Net::SFTP::Protocol::Driver</a><br />
Class <a href="Protocol/PacketAssistant.html" class="link">Net::SFTP::Protocol::PacketAssistant</a><br />




<div class="sectiontitle">Public Instance methods</div>
<div class="method">
  <div class="title">
    <a name="M000037"></a><b>register_services</b>( container )
  </div>
<div class="sourcecode">
  <p class="source-link">[ <a href="javascript:toggleSource('M000037_source')" id="l_M000037_source">show source</a> ]</p>
  <div id="M000037_source" class="dyn-source">
<pre>
    <span class="ruby-comment cmt"># File lib/net/sftp/protocol/services.rb, line 19</span>
19:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">register_services</span>( <span class="ruby-identifier">container</span> )
20:     <span class="ruby-identifier">container</span>.<span class="ruby-identifier">namespace_define</span> <span class="ruby-identifier">:protocol</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ns</span><span class="ruby-operator">|</span>
21: 
22:       <span class="ruby-comment cmt"># The maximum version of the SFTP protocol supported by this</span>
23:       <span class="ruby-comment cmt"># implementation. Clients may set this to a lower value to force the</span>
24:       <span class="ruby-comment cmt"># usage of a specific SFTP version. It should _not_ be set higher than</span>
25:       <span class="ruby-comment cmt"># the value that is given below.</span>
26:       <span class="ruby-identifier">ns</span>.<span class="ruby-identifier">version</span> { <span class="ruby-value">5</span> }
27: 
28:       <span class="ruby-comment cmt"># A proc object that, when invoked, returns a dispatcher object capable</span>
29:       <span class="ruby-comment cmt"># of handling the requested protocol version.</span>
30:       <span class="ruby-identifier">ns</span>.<span class="ruby-identifier">dispatcher_factory</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">c</span>,<span class="ruby-operator">|</span>
31:         <span class="ruby-identifier">lambda</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">version</span>, <span class="ruby-identifier">extensions</span><span class="ruby-operator">|</span>
32:           <span class="ruby-identifier">version</span> = <span class="ruby-value str">&quot;%02d&quot;</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">version</span>
33:           <span class="ruby-identifier">c</span>.<span class="ruby-identifier">require</span> <span class="ruby-node">&quot;net/sftp/protocol/#{version}/services&quot;</span>,
34:             <span class="ruby-node">&quot;#{self}::V_#{version}&quot;</span>
35:           <span class="ruby-identifier">impl</span> = <span class="ruby-identifier">c</span>[<span class="ruby-node">&quot;v_#{version}&quot;</span>.<span class="ruby-identifier">to_sym</span>][<span class="ruby-identifier">:impl</span>]
36:           <span class="ruby-identifier">impl</span>.<span class="ruby-identifier">extensions</span> = <span class="ruby-identifier">extensions</span>
37:           <span class="ruby-identifier">impl</span>
38:         <span class="ruby-keyword kw">end</span>
39:       <span class="ruby-keyword kw">end</span>
40: 
41:       <span class="ruby-comment cmt"># The driver service that manages the SFTP protocol-level communications</span>
42:       <span class="ruby-identifier">ns</span>.<span class="ruby-identifier">driver</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">c</span>,<span class="ruby-identifier">p</span><span class="ruby-operator">|</span>
43:         <span class="ruby-identifier">require</span> <span class="ruby-value str">'net/sftp/protocol/driver'</span>
44:         <span class="ruby-constant">Driver</span>.<span class="ruby-identifier">new</span>( <span class="ruby-identifier">c</span>[<span class="ruby-identifier">:connection</span>][<span class="ruby-identifier">:driver</span>],
45:                     <span class="ruby-identifier">c</span>[<span class="ruby-identifier">:transport</span>][<span class="ruby-identifier">:buffers</span>],
46:                     <span class="ruby-identifier">c</span>[<span class="ruby-identifier">:version</span>],
47:                     <span class="ruby-identifier">c</span>[<span class="ruby-identifier">:dispatcher_factory</span>],
48:                     <span class="ruby-identifier">c</span>[<span class="ruby-identifier">:log_for</span>, <span class="ruby-identifier">p</span>] )
49:       <span class="ruby-keyword kw">end</span>
50: 
51:     <span class="ruby-keyword kw">end</span>
52:   <span class="ruby-keyword kw">end</span>
</pre>
  </div>
</div>
</div>
</div>

  </div>

    </body>
</html>