Changeset 048cd69 in mainline for uspace/srv/net/tcp/tcp_type.h
- Timestamp:
- 2015-06-07T15:41:04Z (9 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 204ba47
- Parents:
- 4d11204 (diff), c3f7d37 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/tcp/tcp_type.h
r4d11204 r048cd69 1 1 /* 2 * Copyright (c) 201 1Jiri Svoboda2 * Copyright (c) 2015 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 41 41 #include <fibril.h> 42 42 #include <fibril_synch.h> 43 #include <socket_core.h>44 43 #include <sys/types.h> 45 44 #include <inet/addr.h> 45 #include <inet/endpoint.h> 46 46 47 47 struct tcp_conn; … … 90 90 /* Connection reset */ 91 91 TCP_ERESET, 92 /* Foreign socket unspecified */92 /* Remote endpoint unspecified */ 93 93 TCP_EUNSPEC, 94 94 /* Insufficient resources */ … … 97 97 TCP_EINVPREC, 98 98 /* Security/compartment not allowed */ 99 TCP_EINVCOMP 99 TCP_EINVCOMP, 100 TCP_EAGAIN 100 101 } tcp_error_t; 101 102 … … 112 113 } tcp_control_t; 113 114 114 typedef struct {115 inet_addr_t addr;116 uint16_t port;117 } tcp_sock_t;118 119 enum tcp_port {120 TCP_PORT_ANY = 0121 };122 123 typedef struct {124 tcp_sock_t local;125 tcp_sock_t foreign;126 } tcp_sockpair_t;127 128 115 /** Connection incoming segments queue */ 129 116 typedef struct { … … 155 142 typedef void (*tcp_cstate_cb_t)(tcp_conn_t *, void *); 156 143 144 /** Connection callbacks */ 145 typedef struct { 146 void (*cstate_change)(tcp_conn_t *, void *, tcp_cstate_t); 147 void (*recv_data)(tcp_conn_t *, void *); 148 } tcp_cb_t; 149 157 150 /** Connection */ 158 151 struct tcp_conn { … … 160 153 link_t link; 161 154 162 /** Connection state change callbackfunction */163 tcp_c state_cb_t cstate_cb;155 /** Connection callbacks function */ 156 tcp_cb_t *cb; 164 157 /** Argument to @c cstate_cb */ 165 void *c state_cb_arg;166 167 /** Connection identification (local and foreign socket) */168 tcp_sockpair_t ident;158 void *cb_arg; 159 160 /** Connection identification (local and remote endpoint) */ 161 inet_ep2_t ident; 169 162 170 163 /** Active or passive connection */ … … 274 267 typedef struct { 275 268 link_t link; 276 tcp_sockpair_t sp;269 inet_ep2_t epp; 277 270 tcp_segment_t *seg; 278 271 } tcp_rqueue_entry_t; … … 282 275 link_t link; 283 276 suseconds_t delay; 284 tcp_sockpair_t sp;277 inet_ep2_t epp; 285 278 tcp_segment_t *seg; 286 279 } tcp_squeue_entry_t; … … 319 312 } tcp_pdu_t; 320 313 321 typedef struct { 322 async_sess_t *sess; 323 socket_cores_t sockets; 324 } tcp_client_t; 325 326 #define TCP_SOCK_FRAGMENT_SIZE 1024 327 328 typedef struct tcp_sockdata { 329 /** Lock */ 330 fibril_mutex_t lock; 331 /** Socket core */ 332 socket_core_t *sock_core; 333 /** Client */ 334 tcp_client_t *client; 314 /** TCP client connection */ 315 typedef struct tcp_cconn { 335 316 /** Connection */ 336 317 tcp_conn_t *conn; 337 /** Local address */ 338 inet_addr_t laddr; 339 /** Backlog size */ 340 int backlog; 341 /** Array of listening connections, @c backlog elements */ 342 struct tcp_sock_lconn **lconn; 343 /** List of connections (from lconn) that are ready to be accepted */ 344 list_t ready; 345 /** Receiving fibril */ 346 fid_t recv_fibril; 347 uint8_t recv_buffer[TCP_SOCK_FRAGMENT_SIZE]; 348 size_t recv_buffer_used; 349 fibril_mutex_t recv_buffer_lock; 350 fibril_condvar_t recv_buffer_cv; 351 tcp_error_t recv_error; 352 } tcp_sockdata_t; 353 354 typedef struct tcp_sock_lconn { 318 /** Connection ID for the client */ 319 sysarg_t id; 320 /** Client */ 321 struct tcp_client *client; 322 link_t lclient; 323 } tcp_cconn_t; 324 325 /** TCP client listener */ 326 typedef struct tcp_clst { 327 /** Local endpoint */ 328 inet_ep_t elocal; 329 /** Connection */ 355 330 tcp_conn_t *conn; 356 tcp_sockdata_t *socket; 357 int index; 358 link_t ready_list; 359 } tcp_sock_lconn_t; 360 331 /** Listener ID for the client */ 332 sysarg_t id; 333 /** Client */ 334 struct tcp_client *client; 335 /** Link to tcp_client_t.clst */ 336 link_t lclient; 337 } tcp_clst_t; 338 339 /** TCP client */ 340 typedef struct tcp_client { 341 /** Client callbac session */ 342 async_sess_t *sess; 343 /** Client's connections */ 344 list_t cconn; /* of tcp_cconn_t */ 345 /** Client's listeners */ 346 list_t clst; 347 } tcp_client_t; 361 348 362 349 #endif
Note:
See TracChangeset
for help on using the changeset viewer.