17:39
[skypekit:skypekit.git] / skypekit_2.0.0.190_29281_CB30 / interfaces / skype / cpp_embedded / documentation / html / skype-transport_8h_source.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml">
3 <head>
4 <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
5 <title>SkypeKit C++ Wrapper: Main Page</title>
6 <link href="tabs.css" rel="stylesheet" type="text/css"/>
7 <link href="islander.css" rel="stylesheet" type="text/css"/>
8 </head>
9 <body>
10 <img src="..\skypekit.png" align="right">
11 <!-- Generated by Doxygen 1.6.2 -->
12 <script type="text/javascript">
13 <!--
14 function changeDisplayState (e){
15   var num=this.id.replace(/[^[0-9]/g,'');
16   var button=this.firstChild;
17   var sectionDiv=document.getElementById('dynsection'+num);
18   if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){
19     sectionDiv.style.display='block';
20     button.src='open.gif';
21   }else{
22     sectionDiv.style.display='none';
23     button.src='closed.gif';
24   }
25 }
26 function initDynSections(){
27   var divs=document.getElementsByTagName('div');
28   var sectionCounter=1;
29   for(var i=0;i<divs.length-1;i++){
30     if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){
31       var header=divs[i];
32       var section=divs[i+1];
33       var button=header.firstChild;
34       if (button!='IMG'){
35         divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild);
36         button=document.createElement('img');
37         divs[i].insertBefore(button,divs[i].firstChild);
38       }
39       header.style.cursor='pointer';
40       header.onclick=changeDisplayState;
41       header.id='dynheader'+sectionCounter;
42       button.src='closed.gif';
43       section.id='dynsection'+sectionCounter;
44       section.style.display='none';
45       section.style.marginLeft='14px';
46       sectionCounter++;
47     }
48   }
49 }
50 window.onload = initDynSections;
51 -->
52 </script>
53 <div class="navigation" id="top">
54   <div class="tabs">
55     <ul>
56       <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
57       <li><a href="annotated.html"><span>Classes</span></a></li>
58       <li class="current"><a href="files.html"><span>Files</span></a></li>
59       <li><a href="examples.html"><span>Examples</span></a></li>
60     </ul>
61   </div>
62   <div class="tabs">
63     <ul>
64       <li><a href="files.html"><span>File&nbsp;List</span></a></li>
65       <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
66     </ul>
67   </div>
68 <h1>skype-transport.h</h1><a href="skype-transport_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
69 <a name="l00002"></a>00002 <span class="preprocessor">#ifndef __SKYPE_TRANSPORT_H</span>
70 <a name="l00003"></a>00003 <span class="preprocessor"></span><span class="preprocessor">#define __SKYPE_TRANSPORT_H</span>
71 <a name="l00004"></a>00004 <span class="preprocessor"></span>
72 <a name="l00005"></a>00005 
73 <a name="l00006"></a>00006 <span class="preprocessor">#include &quot;<a class="code" href="skype-string_8h.html">skype-string.h</a>&quot;</span>
74 <a name="l00007"></a>00007 <span class="comment"></span>
75 <a name="l00008"></a>00008 <span class="comment">/**</span>
76 <a name="l00009"></a>00009 <span class="comment"> * \class SETransport</span>
77 <a name="l00010"></a>00010 <span class="comment"> * \brief Abstract interface for transport layer</span>
78 <a name="l00011"></a>00011 <span class="comment"> *</span>
79 <a name="l00012"></a>00012 <span class="comment"> * You can&#39;t create instance of that class. Use one of successors instead.</span>
80 <a name="l00013"></a>00013 <span class="comment"> *</span>
81 <a name="l00014"></a>00014 <span class="comment"> * The SETransport class defines the way the Skype client communicates with skypekit.</span>
82 <a name="l00015"></a>00015 <span class="comment"> * SETransport is an abstract class, the actual transport implementation is in one</span>
83 <a name="l00016"></a>00016 <span class="comment"> * of the sub-class.</span>
84 <a name="l00017"></a>00017 <span class="comment"> *</span>
85 <a name="l00018"></a>00018 <span class="comment"> * The functions are called by the API wrapper code, so the UI doesn&#39;t have to call</span>
86 <a name="l00019"></a>00019 <span class="comment"> * them. The UI developer should also not need to implement a transport class: They</span>
87 <a name="l00020"></a>00020 <span class="comment"> * are normally provided by Skype since the corresponding transport mechanism needs</span>
88 <a name="l00021"></a>00021 <span class="comment"> * to be supported by skypekit.</span>
89 <a name="l00022"></a>00022 <span class="comment"> *</span>
90 <a name="l00023"></a>00023 <span class="comment"> * In summary, the UI developer should only have to create an instance of the proper</span>
91 <a name="l00024"></a>00024 <span class="comment"> * transport class and pass it to the Skype constructor.</span>
92 <a name="l00025"></a>00025 <span class="comment"> *</span>
93 <a name="l00026"></a>00026 <span class="comment"> * \sa SESocketTransport</span>
94 <a name="l00027"></a>00027 <span class="comment"> * \sa SETCPTransport</span>
95 <a name="l00028"></a>00028 <span class="comment"> */</span>
96 <a name="l00029"></a><a class="code" href="class_s_e_transport.html">00029</a> <span class="keyword">class </span><a class="code" href="class_s_e_transport.html" title="Abstract interface for transport layer.">SETransport</a>
97 <a name="l00030"></a>00030 {
98 <a name="l00031"></a>00031 <span class="keyword">public</span>:<span class="comment"></span>
99 <a name="l00032"></a>00032 <span class="comment">        /** Enables transport level debugging, i.e. logs the messages exchanged with skypekit.</span>
100 <a name="l00033"></a>00033 <span class="comment">         * Please note that is for debugging the wrapper only. It might log binary on the console</span>
101 <a name="l00034"></a>00034 <span class="comment">         * and create weird behaviour then (such when getting the avatar property).</span>
102 <a name="l00035"></a>00035 <span class="comment">         */</span>
103 <a name="l00036"></a><a class="code" href="class_s_e_transport.html#a5e680ec4f492e3db6b5e27da9851ec1f">00036</a>         <span class="keywordtype">bool</span> <a class="code" href="class_s_e_transport.html#a5e680ec4f492e3db6b5e27da9851ec1f">debug</a>;
104 <a name="l00037"></a>00037 <span class="comment"></span>
105 <a name="l00038"></a>00038 <span class="comment">        /** \cond INTERNAL */</span><span class="comment"></span>
106 <a name="l00039"></a>00039 <span class="comment">        /** Used by the transport class to display debug messages */</span>
107 <a name="l00040"></a>00040         void (*log)(<span class="keyword">const</span> <span class="keywordtype">char</span> *out);<span class="comment"></span>
108 <a name="l00041"></a>00041 <span class="comment">        /** \endcond */</span>
109 <a name="l00042"></a>00042 
110 <a name="l00043"></a>00043 <span class="keyword">public</span>:
111 <a name="l00044"></a><a class="code" href="class_s_e_transport.html#a907c927da81aec7894dbdcc14d905d05">00044</a>         <span class="keywordtype">void</span> <a class="code" href="class_s_e_transport.html#a907c927da81aec7894dbdcc14d905d05">LOG</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* format, ...) {
112 <a name="l00045"></a>00045                 <span class="keywordflow">if</span> (log) {
113 <a name="l00046"></a>00046                         <a class="code" href="class_s_e_string.html" title="SEString is basic char* based string class.">SEString</a> out;
114 <a name="l00047"></a>00047                         va_list args;
115 <a name="l00048"></a>00048                         va_start(args, format);
116 <a name="l00049"></a>00049                         out.<a class="code" href="class_s_e_string.html#a5761ebbb7662089c0f4ede51d4daac26">Format</a>(format, args);
117 <a name="l00050"></a>00050                         va_end(args);
118 <a name="l00051"></a>00051                         log((<span class="keyword">const</span> <span class="keywordtype">char</span>*)out);
119 <a name="l00052"></a>00052                 }
120 <a name="l00053"></a>00053         }
121 <a name="l00054"></a>00054 
122 <a name="l00055"></a>00055 <span class="keyword">public</span>:
123 <a name="l00056"></a><a class="code" href="class_s_e_transport.html#a51e11e9316a22cb72d69976042eb2078">00056</a>         <a class="code" href="class_s_e_transport.html#a51e11e9316a22cb72d69976042eb2078">SETransport</a> () : <a class="code" href="class_s_e_transport.html#a5e680ec4f492e3db6b5e27da9851ec1f">debug</a>(false), log(NULL) { }
124 <a name="l00057"></a><a class="code" href="class_s_e_transport.html#af265d87ae61eeb276948784cae5a76e7">00057</a>         <span class="keyword">virtual</span> <a class="code" href="class_s_e_transport.html#af265d87ae61eeb276948784cae5a76e7">~SETransport</a> () { }
125 <a name="l00058"></a>00058 
126 <a name="l00059"></a>00059 <span class="keyword">public</span>:<span class="comment"></span>
127 <a name="l00060"></a>00060 <span class="comment">        /**</span>
128 <a name="l00061"></a>00061 <span class="comment">         * \brief Connects to skypekit.</span>
129 <a name="l00062"></a>00062 <span class="comment">         *  When this function returns successfully, you can start sending and receiving messages.</span>
130 <a name="l00063"></a>00063 <span class="comment">         */</span>
131 <a name="l00064"></a>00064         <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="class_s_e_transport.html#a21af4c91e511ac90faa8d81bbc75b768" title="Connects to skypekit. When this function returns successfully, you can start sending...">connect</a>() = 0;
132 <a name="l00065"></a>00065 <span class="comment"></span>
133 <a name="l00066"></a>00066 <span class="comment">        /** \brief Disconnects from skypekit. */</span>
134 <a name="l00067"></a>00067         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_s_e_transport.html#ad72121a97ce0cab2e697b0f82512b2da" title="Disconnects from skypekit.">disconnect</a>() = 0;
135 <a name="l00068"></a>00068 
136 <a name="l00069"></a>00069         <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="class_s_e_transport.html#a6ac0733481dec47755d90d1f410c16d5">read</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> num_bytes, <span class="keywordtype">char</span>* dest) = 0;
137 <a name="l00070"></a>00070         <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="class_s_e_transport.html#a843aa0ef28b3e3bd82faf858cda5db85">write</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> num_bytes, <span class="keyword">const</span> <span class="keywordtype">char</span>* dest) = 0;
138 <a name="l00071"></a>00071 <span class="comment"></span>
139 <a name="l00072"></a>00072 <span class="comment">        /** \brief Check if the connection to skypekit is still there. */</span>
140 <a name="l00073"></a>00073         <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="class_s_e_transport.html#a75af518d0ee4247dc9a765ac4db24d72" title="Check if the connection to skypekit is still there.">isConnected</a>() <span class="keyword">const</span> = 0;
141 <a name="l00074"></a>00074 <span class="comment"></span>
142 <a name="l00075"></a>00075 <span class="comment">        /**</span>
143 <a name="l00076"></a>00076 <span class="comment">         * \brief Returns the socket descriptor which can be used to manually call select on.</span>
144 <a name="l00077"></a>00077 <span class="comment">         * If the implementation doesn&#39;t support this functionality it returns -1.</span>
145 <a name="l00078"></a>00078 <span class="comment">         */</span>
146 <a name="l00079"></a>00079         <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="class_s_e_transport.html#a2a2ea09333e9a0a9cb7c76042becbf4f" title="Returns the socket descriptor which can be used to manually call select on. If the...">getSocket</a>() <span class="keyword">const</span> = 0;
147 <a name="l00080"></a>00080 };
148 <a name="l00081"></a>00081 
149 <a name="l00082"></a>00082 <span class="preprocessor">#endif // __SKYPE_TRANSPORT_H</span>
150 </pre></div></div>
151
152 <hr/>   
153                 <p><b>(c) Skype Technologies S.A. Confidential/Proprietary</b></p>              
154                 <p>Last updated: 18 Jun 2010</p>                
155                 </BODY>
156 </HTML>