|
1
2
3
4
5
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
|
6
|
<meta name="generator" content="Doxygen 1.8.4"/>
|
|
7
|
<title>Socket: Fichero Fuente /home/imanol/devel/eclipse/PAD/JChatClient/src/include/server.h</title>
|
|
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
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">Socket
</div>
<div id="projectbrief">Librería para comunicar via TCP/IP</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
|
|
34
|
<!-- Generado por Doxygen 1.8.4 -->
|
|
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
|
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Buscar');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Página principal</span></a></li>
<li><a href="pages.html"><span>Páginas relacionadas</span></a></li>
<li><a href="annotated.html"><span>Clases</span></a></li>
<li class="current"><a href="files.html"><span>Archivos</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Buscar" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>Lista de archivos</span></a></li>
<li><a href="globals.html"><span>Miembros de los ficheros</span></a></li>
</ul>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>Todo</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Clases</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Archivos</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Funciones</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>'defines'</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Páginas</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
|
|
84
|
<li class="navelem"><a class="el" href="dir_75b82e7e4a5feb05200b9ad7adf06257.html">home</a></li><li class="navelem"><a class="el" href="dir_ade356989cf64bc7da597536eeab2615.html">imanol</a></li><li class="navelem"><a class="el" href="dir_8f7199732ad0be50edd1dbedbf9226de.html">devel</a></li><li class="navelem"><a class="el" href="dir_86dc413d07e0b16a37ceb0e2a17fed53.html">eclipse</a></li><li class="navelem"><a class="el" href="dir_c63cc34e984e21a69fd262eeef6a5cbb.html">PAD</a></li><li class="navelem"><a class="el" href="dir_74bdbd27aa6df54b6fb8f419761ac887.html">JChatClient</a></li><li class="navelem"><a class="el" href="dir_15c52bfb9a80984ec0ac7c94446ac4fc.html">src</a></li><li class="navelem"><a class="el" href="dir_c16c2f6bdf6587439d9ad3d8f0d21517.html">include</a></li> </ul>
|
|
85
86
87
88
89
90
91
92
93
94
95
|
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">server.h</div> </div>
</div><!--header-->
<div class="contents">
<a href="server_8h.html">Ir a la documentación de este archivo.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> </div>
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="preprocessor">#ifndef SERVER_H_</span></div>
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="preprocessor"></span><span class="preprocessor">#define SERVER_H_</span></div>
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="preprocessor"></span></div>
|
|
96
97
|
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="preprocessor">#include "<a class="code" href="_socket_8h.html" title="Header de la clase Socket. ">Socket.h</a>"</span></div>
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="preprocessor">#include "<a class="code" href="_socket_exception_8h.html" title="Header de excepción de Sockets. ">SocketException.h</a>"</span></div>
|
|
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="preprocessor">#include <iostream></span></div>
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="preprocessor">#include <sstream></span></div>
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="preprocessor">#include <signal.h></span></div>
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="preprocessor">#include <fstream></span></div>
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="preprocessor">#include <list></span></div>
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="preprocessor">#include <fstream></span></div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span> </div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span> </div>
<div class="line"><a name="l00024"></a><span class="lineno"><a class="code" href="server_8h.html#a0240ac851181b84ac374872dc5434ee4"> 24</a></span> <span class="preprocessor">#define N 5</span></div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="preprocessor"></span></div>
<div class="line"><a name="l00027"></a><span class="lineno"><a class="code" href="server_8h.html#ad22e7f0ef164a8dafb32f779f737a1bd"> 27</a></span> <span class="preprocessor">#define CONFFILE "socket.conf"</span></div>
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span> <span class="preprocessor"></span></div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span> <span class="keyword">using namespace </span>std;</div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span> </div>
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span> </div>
|
|
113
|
<div class="line"><a name="l00038"></a><span class="lineno"><a class="code" href="class_server.html"> 38</a></span> <span class="keyword">class </span><a class="code" href="class_server.html" title="Clase de aplicación servidor. ">Server</a></div>
|
|
114
115
116
|
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span> {</div>
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  <span class="keyword">private</span>:</div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span> </div>
|
|
117
|
<div class="line"><a name="l00044"></a><span class="lineno"><a class="code" href="class_server.html#a690955b1e335072c061df67014a6e698"> 44</a></span>  <span class="keywordtype">int</span> <a class="code" href="class_server.html#a690955b1e335072c061df67014a6e698" title="Contador de threads. ">nWorkers</a>;</div>
|
|
118
|
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span> </div>
|
|
119
|
<div class="line"><a name="l00048"></a><span class="lineno"><a class="code" href="class_server.html#aa9231b38adc787954a13f04372de8ed2"> 48</a></span>  <span class="keywordtype">bool</span> <a class="code" href="class_server.html#aa9231b38adc787954a13f04372de8ed2" title="Variable de apagado. ">shutdownServer</a>;</div>
|
|
120
|
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span> </div>
|
|
121
|
<div class="line"><a name="l00052"></a><span class="lineno"><a class="code" href="class_server.html#ae10d91b60157ccfcc06cc463e8443007"> 52</a></span>  <span class="keywordtype">int</span> <a class="code" href="class_server.html#ae10d91b60157ccfcc06cc463e8443007" title="Contador de ID de thread. ">workerID</a>;</div>
|
|
122
|
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span> </div>
|
|
123
|
<div class="line"><a name="l00056"></a><span class="lineno"><a class="code" href="class_server.html#a36a18616b526f3053a1036641a62cb0a"> 56</a></span>  list<pthread_t*> <a class="code" href="class_server.html#a36a18616b526f3053a1036641a62cb0a" title="Pila de threads terminados. ">stoppedThreads</a>;</div>
|
|
124
|
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span> </div>
|
|
125
|
<div class="line"><a name="l00063"></a><span class="lineno"><a class="code" href="class_server.html#a40fdc13e227f651943e0aa3757824396"> 63</a></span>  list<pthread_t*> <a class="code" href="class_server.html#a40fdc13e227f651943e0aa3757824396" title="Pila de threads empezados. ">startedThreads</a>;</div>
|
|
126
|
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span> </div>
|
|
127
|
<div class="line"><a name="l00068"></a><span class="lineno"><a class="code" href="class_server.html#af9e1a6848bdd627741b85e75777e3b45"> 68</a></span>  <a class="code" href="class_socket.html" title="Clase del socket. ">Socket</a> <a class="code" href="class_server.html#af9e1a6848bdd627741b85e75777e3b45" title="Socket de comunicación. ">ss</a>;</div>
|
|
128
129
130
|
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span> </div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  <span class="keyword">public</span>:</div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span> </div>
|
|
131
|
<div class="line"><a name="l00073"></a><span class="lineno"><a class="code" href="class_server.html#ad5ec9462b520e59f7ea831e157ee5e59"> 73</a></span>  <a class="code" href="class_server.html#ad5ec9462b520e59f7ea831e157ee5e59" title="Constructor de la clase Server. ">Server</a>() : nWorkers(0), workerID(0), shutdownServer(false) {}</div>
|
|
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span> </div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>  <span class="keywordtype">int</span> getNWorkers();</div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span> </div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  <span class="keywordtype">void</span> setNWorkers(<span class="keywordtype">int</span> n );</div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span> </div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  list<pthread_t*>* getStartedThreads();</div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span> </div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  list<pthread_t*>* getStoppedThreads();</div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span> </div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  <span class="keywordtype">void</span> startServer(<span class="keywordtype">string</span> i , <span class="keywordtype">int</span> p);</div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span> </div>
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  <span class="keywordtype">void</span> freeRAM(list<pthread_t*> *threadList);</div>
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span> </div>
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  <span class="keywordtype">void</span> requestExit();</div>
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span> };</div>
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span> </div>
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span> </div>
|
|
149
|
<div class="line"><a name="l00102"></a><span class="lineno"><a class="code" href="structthread__args.html"> 102</a></span> <span class="keyword">struct </span><a class="code" href="structthread__args.html" title="Argumentos de los threads. ">thread_args</a></div>
|
|
150
151
|
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span> {</div>
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span> </div>
|
|
152
|
<div class="line"><a name="l00106"></a><span class="lineno"><a class="code" href="structthread__args.html#ad5d64499f5f6e2df467c96b52a94c520"> 106</a></span>  pthread_mutex_t *<a class="code" href="structthread__args.html#ad5d64499f5f6e2df467c96b52a94c520" title="Variable de control de la exclusión mútua entre threads. ">mutex</a>;</div>
|
|
153
|
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span> </div>
|
|
154
|
<div class="line"><a name="l00112"></a><span class="lineno"><a class="code" href="structthread__args.html#a96ee28beaed4175257db3d8794245f25"> 112</a></span>  pthread_cond_t *<a class="code" href="structthread__args.html#a96ee28beaed4175257db3d8794245f25" title="Variable de notificación a otros threads. ">condition</a>;</div>
|
|
155
|
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span> </div>
|
|
156
|
<div class="line"><a name="l00116"></a><span class="lineno"><a class="code" href="structthread__args.html#acdcd2db4307e5e75d5110067e196a70e"> 116</a></span>  pthread_t *<a class="code" href="structthread__args.html#acdcd2db4307e5e75d5110067e196a70e" title="Puntero al thread. ">thread</a>;</div>
|
|
157
|
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span> </div>
|
|
158
|
<div class="line"><a name="l00120"></a><span class="lineno"><a class="code" href="structthread__args.html#aede3ef61778d02bdf25c368d1cf9d489"> 120</a></span>  <a class="code" href="class_socket.html" title="Clase del socket. ">Socket</a> *<a class="code" href="structthread__args.html#aede3ef61778d02bdf25c368d1cf9d489" title="Puntero al socket. ">s</a>;</div>
|
|
159
|
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span> </div>
|
|
160
|
<div class="line"><a name="l00124"></a><span class="lineno"><a class="code" href="structthread__args.html#ab29508135b033282f374d0fb47028fbd"> 124</a></span>  <a class="code" href="class_server.html" title="Clase de aplicación servidor. ">Server</a> *<a class="code" href="structthread__args.html#ab29508135b033282f374d0fb47028fbd" title="Puntero al servidor. ">serv</a>;</div>
|
|
161
|
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span> </div>
|
|
162
|
<div class="line"><a name="l00127"></a><span class="lineno"><a class="code" href="structthread__args.html#a6322b3468fd88f8f49977a6439e9f352"> 127</a></span>  <span class="keywordtype">int</span> <a class="code" href="structthread__args.html#a6322b3468fd88f8f49977a6439e9f352" title="ID del thread. ">id</a>;</div>
|
|
163
164
165
|
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span> };</div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span> </div>
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span> </div>
|
|
166
|
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span> <span class="keywordtype">void</span> <a class="code" href="server_8h.html#ab99831172d1d4bca2c79bb37c7c062df" title="Método de finalización de Threads. ">killThread</a>(<a class="code" href="structthread__args.html" title="Argumentos de los threads. ">thread_args</a> *t_arg );</div>
|
|
167
|
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span> </div>
|
|
168
|
<div class="line"><a name="l00139"></a><span class="lineno"> 139</span> <span class="keywordtype">void</span> *<a class="code" href="server_8h.html#a7d13c650ec7a525ad17cabba4f371745" title="Método gestión de conexiones. ">WorkerThread</a>(<span class="keywordtype">void</span>* args );</div>
|
|
169
|
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span> </div>
|
|
170
|
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span> <span class="keywordtype">void</span> <a class="code" href="server_8h.html#aa6328bc358b87d3e11c3f460d6427c5b" title="Método auxiliar de procesado de texto. ">processText</a>(<span class="keywordtype">string</span> *str);</div>
|
|
171
|
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span> </div>
|
|
172
|
<div class="line"><a name="l00147"></a><span class="lineno"> 147</span> <span class="keywordtype">bool</span> <a class="code" href="server_8h.html#a4f850f08d755a0d0ebe936b5b84975e3" title="Método de lectura de configuración. ">readConf</a>(<span class="keywordtype">string</span> *ip, <span class="keywordtype">int</span> *port);</div>
|
|
173
174
175
176
177
|
<div class="line"><a name="l00148"></a><span class="lineno"> 148</span> </div>
<div class="line"><a name="l00149"></a><span class="lineno"> 149</span> <span class="preprocessor">#endif </span><span class="comment">/* SERVER_H_ */</span><span class="preprocessor"></span></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
|
|
178
|
Generado el Sábado, 7 de Diciembre de 2013 03:17:07 para Socket por  <a href="http://www.doxygen.org/index.html">
|
|
179
|
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
|
180
|
</a> 1.8.4
|
|
181
182
183
|
</small></address>
</body>
</html>
|