Changeset fb4d788 in mainline for uspace/srv/net/udp/udp_type.h
- Timestamp:
- 2015-07-28T11:28:14Z (9 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6accc5cf
- Parents:
- df2bce3 (diff), 47726b5e (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/udp/udp_type.h
rdf2bce3 rfb4d788 1 1 /* 2 * Copyright (c) 201 2Jiri Svoboda2 * Copyright (c) 2015 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 36 36 #define UDP_TYPE_H 37 37 38 #include <async.h> 38 39 #include <fibril.h> 39 40 #include <fibril_synch.h> 41 #include <inet/endpoint.h> 40 42 #include <ipc/loc.h> 41 #include <socket_core.h>42 43 #include <sys/types.h> 43 44 #include <inet/addr.h> … … 49 50 /* Insufficient resources */ 50 51 UDP_ENORES, 51 /* Foreign socket unspecified */52 /* Remote endpoint unspecified */ 52 53 UDP_EUNSPEC, 53 54 /* No route to destination */ … … 60 61 XF_DUMMY = 0x1 61 62 } xflags_t; 62 63 enum udp_port {64 UDP_PORT_ANY = 065 };66 67 typedef struct {68 inet_addr_t addr;69 uint16_t port;70 } udp_sock_t;71 72 typedef struct {73 service_id_t iplink;74 udp_sock_t local;75 udp_sock_t foreign;76 } udp_sockpair_t;77 63 78 64 /** Unencoded UDP message (datagram) */ … … 99 85 100 86 typedef struct { 101 async_sess_t *sess; 102 socket_cores_t sockets; 103 } udp_client_t; 87 void (*recv_msg)(void *, inet_ep2_t *, udp_msg_t *); 88 } udp_assoc_cb_t; 104 89 105 90 /** UDP association … … 107 92 * This is a rough equivalent of a TCP connection endpoint. It allows 108 93 * sending and receiving UDP datagrams and it is uniquely identified 109 * by a socket pair.94 * by an endpoint pair. 110 95 */ 111 96 typedef struct { … … 113 98 link_t link; 114 99 115 /** Association identification ( local and foreign socket) */116 udp_sockpair_t ident;100 /** Association identification (endpoint pair) */ 101 inet_ep2_t ident; 117 102 118 103 /** True if association was reset by user */ … … 131 116 /** Receive queue CV. Broadcast when new datagram is inserted */ 132 117 fibril_condvar_t rcv_queue_cv; 118 119 udp_assoc_cb_t *cb; 120 void *cb_arg; 133 121 } udp_assoc_t; 134 122 … … 136 124 } udp_assoc_status_t; 137 125 138 typedef struct udp_sockdata { 139 /** Lock */ 140 fibril_mutex_t lock; 141 /** Socket core */ 142 socket_core_t *sock_core; 126 typedef struct { 127 /** Link to receive queue */ 128 link_t link; 129 /** Endpoint pair */ 130 inet_ep2_t epp; 131 /** Message */ 132 udp_msg_t *msg; 133 } udp_rcv_queue_entry_t; 134 135 typedef struct udp_cassoc { 136 /** Association */ 137 udp_assoc_t *assoc; 138 /** Association ID for the client */ 139 sysarg_t id; 143 140 /** Client */ 144 udp_client_t *client; 145 /** Connection */ 146 udp_assoc_t *assoc; 147 /** User-configured IP link */ 148 service_id_t iplink; 149 /** Receiving fibril */ 150 fid_t recv_fibril; 151 uint8_t recv_buffer[UDP_FRAGMENT_SIZE]; 152 size_t recv_buffer_used; 153 udp_sock_t recv_fsock; 154 fibril_mutex_t recv_buffer_lock; 155 fibril_condvar_t recv_buffer_cv; 156 udp_error_t recv_error; 157 } udp_sockdata_t; 141 struct udp_client *client; 142 link_t lclient; 143 } udp_cassoc_t; 158 144 159 145 typedef struct { 160 146 /** Link to receive queue */ 161 147 link_t link; 162 /** Socket pair */163 udp_sockpair_t sp;148 /** Endpoint pair */ 149 inet_ep2_t epp; 164 150 /** Message */ 165 151 udp_msg_t *msg; 166 } udp_rcv_queue_entry_t; 152 /** Client association */ 153 udp_cassoc_t *cassoc; 154 } udp_crcv_queue_entry_t; 155 156 typedef struct udp_client { 157 /** Client callback session */ 158 async_sess_t *sess; 159 /** Client assocations */ 160 list_t cassoc; /* of udp_cassoc_t */ 161 /** Client receive queue */ 162 list_t crcv_queue; 163 } udp_client_t; 167 164 168 165 #endif
Note:
See TracChangeset
for help on using the changeset viewer.