Comment: | of_socket_address_t -> OFSocketAddress |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | new-naming-convention |
Files: | files | file ages | folders |
SHA3-256: |
e3c5bb70ddedf565b0837ee4bda98ea4 |
User & Date: | js on 2021-04-17 13:58:44 |
Other Links: | branch diff | manifest | tags |
2021-04-17
| ||
14:05 | Minor fixes for last commit check-in: c45a108585 user: js tags: new-naming-convention | |
13:58 | of_socket_address_t -> OFSocketAddress check-in: e3c5bb70dd user: js tags: new-naming-convention | |
12:32 | Rename of_socket_address_family_t check-in: d3fb3e902d user: js tags: new-naming-convention | |
Modified src/OFDNSResolver.h from [ee088942f0] to [a855f12ad3].
︙ | |||
97 98 99 100 101 102 103 | 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | - + | @protocol OFDNSResolverHostDelegate <OFObject> /** * @brief This method is called when a DNS resolver resolved a host to * addresses. * * @param resolver The acting resolver * @param host The host the resolver resolved |
︙ | |||
255 256 257 258 259 260 261 | 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | - + | delegate: (id <OFDNSResolverHostDelegate>)delegate; /** * @brief Synchronously resolves the specified host to socket addresses. * * @param host The host to resolve * @param addressFamily The desired socket address family |
Modified src/OFDNSResolver.m from [38aa9ebc9e] to [33f15c9fa5].
︙ | |||
70 71 72 73 74 75 76 | 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | - + | OFDNSQuery *_query; OFNumber *_ID; OFDNSResolverSettings *_settings; size_t _nameServersIndex; unsigned int _attempt; id <OFDNSResolverQueryDelegate> _delegate; OFData *_queryData; |
︙ | |||
169 170 171 172 173 174 175 | 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | - + - + | static OF_KINDOF(OFDNSResourceRecord *) parseResourceRecord(OFString *name, of_dns_class_t DNSClass, of_dns_record_type_t recordType, uint32_t TTL, const unsigned char *buffer, size_t length, size_t i, uint16_t dataLength) { if (recordType == OF_DNS_RECORD_TYPE_A && DNSClass == OF_DNS_CLASS_IN) { |
︙ | |||
356 357 358 359 360 361 362 | 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 | - + - + | initWithName: name DNSClass: DNSClass mailbox: mailbox TXTDomainName: TXTDomainName TTL: TTL] autorelease]; } else if (recordType == OF_DNS_RECORD_TYPE_AAAA && DNSClass == OF_DNS_CLASS_IN) { |
︙ | |||
733 734 735 736 737 738 739 | 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 | - + - + - - + + - + - - + + | context->_TCPSocket.delegate = self; [context->_TCPSocket asyncConnectToHost: nameServer port: 53 runLoopMode: runLoopMode]; return; } |
︙ | |||
877 878 879 880 881 882 883 | 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 | - + | didPerformQuery: context->_query response: nil exception: exception]; } - (bool)of_handleResponseBuffer: (unsigned char *)buffer length: (size_t)length |
︙ | |||
899 900 901 902 903 904 905 | 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 | - + | if (context == nil) return true; if (context->_TCPSocket != nil) { if ([_TCPQueries objectForKey: context->_TCPSocket] != context) return true; |
︙ | |||
1039 1040 1041 1042 1043 1044 1045 | 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 | - + | return false; } - (bool)socket: (OFDatagramSocket *)sock didReceiveIntoBuffer: (void *)buffer length: (size_t)length |
︙ | |||
1177 1178 1179 1180 1181 1182 1183 | 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 | - + | return false; } - (void)asyncResolveAddressesForHost: (OFString *)host delegate: (id <OFDNSResolverHostDelegate>)delegate { [self asyncResolveAddressesForHost: host |
︙ |
Modified src/OFDNSResolverSettings.m from [b173bc8c7c] to [711318f6b6].
︙ | |||
72 73 74 75 76 77 78 | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | - + | static OFString * domainFromHostname(OFString *hostname) { if (hostname == nil) return nil; @try { |
︙ |
Modified src/OFDNSResourceRecord.h from [cfe4c4fb24] to [7dd514f0ed].
︙ | |||
120 121 122 123 124 125 126 | 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 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | - + - + - + - + - + - + | * @class OFADNSResourceRecord OFDNSResourceRecord.h ObjFW/OFDNSResourceRecord.h * * @brief A class representing an A DNS resource record. */ OF_SUBCLASSING_RESTRICTED @interface OFADNSResourceRecord: OFDNSResourceRecord { |
︙ |
Modified src/OFDNSResourceRecord.m from [50a5f9e1de] to [5cb904a9e3].
︙ | |||
192 193 194 195 196 197 198 | 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | - + - + | recordType: (of_dns_record_type_t)recordType TTL: (uint32_t)TTL { OF_INVALID_INIT_METHOD } - (instancetype)initWithName: (OFString *)name |
︙ | |||
231 232 233 234 235 236 237 | 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | - + - + - + - - + - + | if (record->_DNSClass != _DNSClass) return false; if (record->_recordType != _recordType) return false; |
︙ | |||
317 318 319 320 321 322 323 | 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 | - + - + - + - | if (record->_DNSClass != _DNSClass) return false; if (record->_recordType != _recordType) return false; |
︙ |
Modified src/OFDatagramSocket.h from [4f3cf63b76] to [8778942db1].
︙ | |||
33 34 35 36 37 38 39 | 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 | - + - + | * @param length The length of the packet * @param sender The address of the sender of the packet * @param exception An exception which occurred while receiving or `nil` on * success * @return A bool whether the same block should be used for the next receive */ typedef bool (^OFDatagramSocketAsyncReceiveBlock)(size_t length, |
︙ | |||
71 72 73 74 75 76 77 | 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 | - + - + | * @param exception An exception that occurred while receiving, or nil on * success * @return A bool whether the same block should be used for the next receive */ - (bool)socket: (OFDatagramSocket *)socket didReceiveIntoBuffer: (void *)buffer length: (size_t)length |
︙ | |||
148 149 150 151 152 153 154 | 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | - - + + - + | /** * @brief Receives a datagram and stores it into the specified buffer. * * If the buffer is too small, the datagram is truncated. * * @param buffer The buffer to write the datagram to * @param length The length of the buffer |
︙ | |||
228 229 230 231 232 233 234 | 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + | #endif /** * @brief Sends the specified datagram to the specified address. * * @param buffer The buffer to send as a datagram * @param length The length of the buffer |
︙ |
Modified src/OFDatagramSocket.m from [05b31b2631] to [a91f3ff6b6].
︙ | |||
163 164 165 166 167 168 169 | 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | - + | #else return _canSendToBroadcastAddresses; #endif } - (size_t)receiveIntoBuffer: (void *)buffer length: (size_t)length |
︙ | |||
193 194 195 196 197 198 199 | 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | - + - + - + - + | exceptionWithObject: self requestedLength: length errNo: of_socket_errno()]; #endif switch (sender->sockaddr.sockaddr.sa_family) { case AF_INET: |
︙ | |||
261 262 263 264 265 266 267 | 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | - + | block: block delegate: nil]; } #endif - (void)sendBuffer: (const void *)buffer length: (size_t)length |
︙ | |||
303 304 305 306 307 308 309 | 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 | - + - + - + - + | @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length bytesWritten: bytesWritten errNo: 0]; } - (void)asyncSendData: (OFData *)data |
︙ |
Modified src/OFHTTPRequest.h from [3c89198066] to [9c2534e693].
︙ | |||
71 72 73 74 75 76 77 | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | - + | */ @interface OFHTTPRequest: OFObject <OFCopying> { OFURL *_URL; of_http_request_method_t _method; of_http_request_protocol_version_t _protocolVersion; OFDictionary OF_GENERIC(OFString *, OFString *) *_Nullable _headers; |
︙ | |||
107 108 109 110 111 112 113 | 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | - + - | OFDictionary OF_GENERIC(OFString *, OFString *) *headers; /** * @brief The remote address from which the request originates. * * @note The setter creates a copy of the remote address. */ |
︙ |
Modified src/OFHTTPRequest.m from [c73164e676] to [46acd12d86].
︙ | |||
119 120 121 122 123 124 125 | 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | - + - + | { [_URL release]; [_headers release]; [super dealloc]; } |
︙ | |||
173 174 175 176 177 178 179 | 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | - + - + | request->_protocolVersion.major != _protocolVersion.major || request->_protocolVersion.minor != _protocolVersion.minor || ![request->_URL isEqual: _URL] || ![request->_headers isEqual: _headers]) return false; if (request.remoteAddress != self.remoteAddress && |
︙ | |||
256 257 258 259 260 261 262 | 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | - + - | OFString *indentedHeaders, *remoteAddress, *ret; indentedHeaders = [_headers.description stringByReplacingOccurrencesOfString: @"\n" withString: @"\n\t"]; if (_hasRemoteAddress) |
︙ |
Modified src/OFHostAddressResolver.m from [9b646be9f3] to [d50e89fde3].
︙ | |||
62 63 64 65 66 67 68 | 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 | - + - - + + - - + + | dots++; return (dots >= minNumberOfDotsInAbsoluteName); } static bool addressForRecord(OF_KINDOF(OFDNSResourceRecord *) record, |
︙ | |||
158 159 160 161 162 163 164 | 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | - - + + - - + + | domainName = [OFString stringWithFormat: @"%@.%@", _host, searchDomain]; } else domainName = _host; #ifdef OF_HAVE_IPV6 |
︙ | |||
202 203 204 205 206 207 208 | 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | - + | _searchDomainIndex++; [self sendQueries]; return; } for (OF_KINDOF(OFDNSResourceRecord *) record in [response.answerRecords objectForKey: query.domainName]) { |
︙ | |||
264 265 266 267 268 269 270 | 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | - + - - + - + - + - + - + | - (void)asyncResolve { void *pool = objc_autoreleasePoolPush(); OFArray OF_GENERIC(OFString *) *aliases; @try { |
︙ | |||
325 326 327 328 329 330 331 | 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 | - + | objc_autoreleasePoolPop(pool); return; } _isFQDN = isFQDN(_host, _settings->_minNumberOfDotsInAbsoluteName); _addresses = [[OFMutableData alloc] |
︙ |
Modified src/OFIPSocketAsyncConnector.h from [be1f67a820] to [185e130707].
︙ | |||
16 17 18 19 20 21 22 | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | - + - + | #import "OFDNSResolver.h" #import "OFRunLoop.h" #import "OFRunLoop+Private.h" OF_ASSUME_NONNULL_BEGIN @protocol OFIPSocketAsyncConnecting |
︙ |
Modified src/OFIPSocketAsyncConnector.m from [c25b7c4d07] to [853854160a].
︙ | |||
130 131 132 133 134 135 136 | 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | - + - + | port: _port socket: _socket errNo: errNo]; } - (void)tryNextAddressWithRunLoopMode: (OFRunLoopMode)runLoopMode { |
︙ | |||
222 223 224 225 226 227 228 | 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | - - + - + | [self tryNextAddressWithRunLoopMode: [OFRunLoop currentRunLoop].currentMode]; } - (void)startWithRunLoopMode: (OFRunLoopMode)runLoopMode { @try { |
Modified src/OFIPXSocket.h from [3a07b6e6f2] to [716204a756].
︙ | |||
28 29 30 31 32 33 34 | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | - - - - - + + + + + | @end /** * @class OFIPXSocket OFIPXSocket.h ObjFW/OFIPXSocket.h * * @brief A class which provides methods to create and use IPX sockets. * |
︙ | |||
68 69 70 71 72 73 74 | 68 69 70 71 72 73 74 75 76 77 78 | - - + | * specified packet type. * * @param port The port (sometimes called socket number) to bind to. 0 means to * pick one and return it. * @param packetType The packet type to use on the socket * @return The address on which this socket can be reached */ |
Modified src/OFIPXSocket.m from [8d511b567a] to [0cad159968].
︙ | |||
28 29 30 31 32 33 34 | 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 | - - + - + - + | #import "socket.h" #import "socket_helpers.h" @implementation OFIPXSocket @dynamic delegate; |
︙ | |||
77 78 79 80 81 82 83 | 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | - + | @throw [OFBindFailedException exceptionWithPort: port packetType: packetType socket: self errNo: errNo]; } memset(&address, 0, sizeof(address)); |
︙ | |||
109 110 111 112 113 114 115 | 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | - + - + - + | return address; } #ifndef OF_WINDOWS - (void)sendBuffer: (const void *)buffer length: (size_t)length |
Modified src/OFRunLoop+Private.h from [6eec0e29b2] to [b73b1c9760].
︙ | |||
93 94 95 96 97 98 99 | 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | - + | mode: (OFRunLoopMode)mode # ifdef OF_HAVE_BLOCKS block: (nullable OFDatagramSocketAsyncReceiveBlock)block # endif delegate: (nullable id <OFDatagramSocketDelegate>) delegate; + (void)of_addAsyncSendForDatagramSocket: (OFDatagramSocket *)socket data: (OFData *)data |
︙ |
Modified src/OFRunLoop.m from [4c3afea7cc] to [4440700fb9].
︙ | |||
169 170 171 172 173 174 175 | 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | - + | @interface OFRunLoopDatagramSendQueueItem: OFRunLoopQueueItem { @public # ifdef OF_HAVE_BLOCKS OFDatagramSocketAsyncSendDataBlock _block; # endif OFData *_data; |
︙ | |||
786 787 788 789 790 791 792 | 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 | - + | # endif @end @implementation OFRunLoopDatagramReceiveQueueItem - (bool)handleObject: (id)object { size_t length; |
︙ | |||
1236 1237 1238 1239 1240 1241 1242 | 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 | - + | queueItem->_length = length; QUEUE_ITEM } + (void)of_addAsyncSendForDatagramSocket: (OFDatagramSocket *)sock data: (OFData *)data |
︙ |
Modified src/OFSPXSocket.h from [3613243cdb] to [26e1e49cc2].
︙ | |||
155 156 157 158 159 160 161 | 155 156 157 158 159 160 161 162 163 164 165 | - + | /** * @brief Bind the socket to the specified network, node and port. * * @param port The port (sometimes called socket number) to bind to. 0 means to * pick one and return it. * @return The address on which this socket can be reached */ |
Modified src/OFSPXSocket.m from [52c6bd502b] to [823860587e].
︙ | |||
32 33 34 35 36 37 38 | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | - + - + | #ifndef NSPROTO_SPX # define NSPROTO_SPX 0 #endif #define SPX_PACKET_TYPE 5 @interface OFSPXSocket () |
︙ | |||
101 102 103 104 105 106 107 | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | - - + + | #endif [super dealloc]; } - (void)startWithRunLoopMode: (OFRunLoopMode)runLoopMode { |
︙ | |||
170 171 172 173 174 175 176 | 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | - + | errNo: errNo]; } @end @implementation OFSPXSocket @dynamic delegate; |
︙ | |||
194 195 196 197 198 199 200 | 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | - + | if ((flags = fcntl(_socket, F_GETFD, 0)) != -1) fcntl(_socket, F_SETFD, flags | FD_CLOEXEC); #endif return true; } |
︙ | |||
219 220 221 222 223 224 225 | 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | - - + | _socket = INVALID_SOCKET; } - (void)connectToNode: (unsigned char [_Nonnull IPX_NODE_LEN])node network: (uint32_t)network port: (uint16_t)port { |
︙ | |||
306 307 308 309 310 311 312 | 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 | - + - + - + | block: block ] autorelease] startWithRunLoopMode: runLoopMode]; objc_autoreleasePoolPop(pool); } #endif |
︙ | |||
347 348 349 350 351 352 353 | 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 | - + | @throw [OFBindFailedException exceptionWithPort: port packetType: SPX_PACKET_TYPE socket: self errNo: errNo]; } memset(&address, 0, sizeof(address)); |
︙ |
Modified src/OFSPXStreamSocket.h from [83c06e9779] to [8a40db9be9].
︙ | |||
160 161 162 163 164 165 166 | 160 161 162 163 164 165 166 167 168 169 170 | - + | /** * @brief Bind the socket to the specified network, node and port. * * @param port The port (sometimes called socket number) to bind to. 0 means to * pick one and return it. * @return The address on which this socket can be reached */ |
Modified src/OFSPXStreamSocket.m from [0c0bb7951d] to [083a1554bc].
︙ | |||
32 33 34 35 36 37 38 | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | - + - + | #ifndef NSPROTO_SPX # define NSPROTO_SPX 0 #endif #define SPX_PACKET_TYPE 5 @interface OFSPXStreamSocket () |
︙ | |||
102 103 104 105 106 107 108 | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | - - + + | #endif [super dealloc]; } - (void)startWithRunLoopMode: (OFRunLoopMode)runLoopMode { |
︙ | |||
172 173 174 175 176 177 178 | 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | - + | errNo: errNo]; } @end @implementation OFSPXStreamSocket @dynamic delegate; |
︙ | |||
196 197 198 199 200 201 202 | 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | - + | if ((flags = fcntl(_socket, F_GETFD, 0)) != -1) fcntl(_socket, F_SETFD, flags | FD_CLOEXEC); #endif return true; } |
︙ | |||
221 222 223 224 225 226 227 | 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | - - + | _socket = INVALID_SOCKET; } - (void)connectToNode: (unsigned char [_Nonnull IPX_NODE_LEN])node network: (uint32_t)network port: (uint16_t)port { |
︙ | |||
308 309 310 311 312 313 314 | 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | - + - + - + | block: block ] autorelease] startWithRunLoopMode: runLoopMode]; objc_autoreleasePoolPop(pool); } #endif |
︙ | |||
349 350 351 352 353 354 355 | 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 | - + | @throw [OFBindFailedException exceptionWithPort: port packetType: SPX_PACKET_TYPE socket: self errNo: errNo]; } memset(&address, 0, sizeof(address)); |
︙ |
Modified src/OFSequencedPacketSocket.h from [e767c073e8] to [6e79cc4304].
︙ | |||
125 126 127 128 129 130 131 | 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | - + | * was called to create one "instance" for every thread! */ @interface OFSequencedPacketSocket: OFObject <OFCopying, OFReadyForReadingObserving, OFReadyForWritingObserving> { OFSocketHandle _socket; bool _canBlock, _listening; |
︙ | |||
147 148 149 150 151 152 153 | 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | - + | @property (readonly, nonatomic, getter=isListening) bool listening; /** * @brief The remote address. * * @note This only works for accepted sockets! */ |
︙ |
Modified src/OFSequencedPacketSocket.m from [2fe1b9a9ce] to [1b0099da29].
︙ | |||
360 361 362 363 364 365 366 | 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 | - + - + - + - + - | #endif assert(client->_remoteAddress.length <= (socklen_t)sizeof(client->_remoteAddress.sockaddr)); switch (client->_remoteAddress.sockaddr.sockaddr.sa_family) { case AF_INET: |
︙ | |||
411 412 413 414 415 416 417 | 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 | - + | [OFRunLoop of_addAsyncAcceptForSocket: self mode: runLoopMode block: block delegate: nil]; } #endif |
︙ |
Modified src/OFStreamSocket.h from [371fee3da0] to [3d3d625aa6].
︙ | |||
64 65 66 67 68 69 70 | 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 | - + - + | * @brief A class which provides methods to create and use stream sockets. */ @interface OFStreamSocket: OFStream <OFReadyForReadingObserving, OFReadyForWritingObserving> { OFSocketHandle _socket; bool _atEndOfStream, _listening; |
︙ |
Modified src/OFStreamSocket.m from [81e1bbc5f7] to [3262c13b9d].
︙ | |||
284 285 286 287 288 289 290 | 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | - + - + - + - + - | #endif assert(client->_remoteAddress.length <= (socklen_t)sizeof(client->_remoteAddress.sockaddr)); switch (client->_remoteAddress.sockaddr.sockaddr.sa_family) { case AF_INET: |
︙ | |||
334 335 336 337 338 339 340 | 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | - + | [OFRunLoop of_addAsyncAcceptForSocket: self mode: runLoopMode block: block delegate: nil]; } #endif |
︙ |
Modified src/OFTCPSocket.m from [2ec643758e] to [98d3158581].
︙ | |||
132 133 134 135 136 137 138 | 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | - + | - (void)dealloc { [_SOCKS5Host release]; [super dealloc]; } |
︙ | |||
156 157 158 159 160 161 162 | 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | - + | if ((flags = fcntl(_socket, F_GETFD, 0)) != -1) fcntl(_socket, F_SETFD, flags | FD_CLOEXEC); #endif return true; } |
︙ | |||
298 299 300 301 302 303 304 | 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | - + - + - - + + | #endif - (uint16_t)bindToHost: (OFString *)host port: (uint16_t)port { const int one = 1; void *pool = objc_autoreleasePoolPush(); OFData *socketAddresses; |
︙ | |||
359 360 361 362 363 364 365 | 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 | - + | for (;;) { uint16_t rnd = 0; int ret; while (rnd < 1024) rnd = (uint16_t)rand(); |
︙ |
Modified src/OFUDPSocket+Private.h from [de17aba506] to [6c9ef7ed56].
︙ | |||
15 16 17 18 19 20 21 | 15 16 17 18 19 20 21 22 23 24 25 26 | - + | #import "OFUDPSocket.h" OF_ASSUME_NONNULL_BEGIN OF_DIRECT_MEMBERS @interface OFUDPSocket () |
Modified src/OFUDPSocket.h from [0c69733f4b] to [758612bc48].
︙ | |||
28 29 30 31 32 33 34 | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | - - - - - + + + + + + | @end /** * @class OFUDPSocket OFUDPSocket.h ObjFW/OFUDPSocket.h * * @brief A class which provides methods to create and use UDP sockets. * |
︙ |
Modified src/OFUDPSocket.m from [ab91d5347a] to [b4763512f7].
︙ | |||
37 38 39 40 41 42 43 | 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 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | - + - - + - - - + + - - + - - - - - + + + + + - + + + - - - + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - + - + - - + + | #import "socket.h" #import "socket_helpers.h" @implementation OFUDPSocket @dynamic delegate; |
Modified src/socket.h from [3e36de663a] to [5c14e5d604].
︙ | |||
80 81 82 83 84 85 86 | 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | - + - + - + - + - + | #endif /** * @brief A socket address family. */ typedef enum { /** An unknown address family. */ |
︙ | |||
122 123 124 125 126 127 128 | 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 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | - + - + - + - + + - + - - + - + - + - - + - + - + - - + - + - + - - - + + - + - + - - + + - + - - - - + + - + - + - + - - + - + - - + + - + - - + + - + - - + - + - - + | # define sipx_family sa_family # define sipx_network sa_netnum # define sipx_node sa_nodenum # define sipx_port sa_socket #endif /** |
︙ |
Modified src/socket.m from [debecc65de] to [b7f2de7d48].
︙ | |||
344 345 346 347 348 349 350 | 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 | - - + + - + - + | [mutex unlock]; # endif return ret; } #endif |
︙ | |||
418 419 420 421 422 423 424 | 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 | - - + + - + - + | if (number > UINT16_MAX) @throw [OFInvalidFormatException exception]; return (uint16_t)number; } |
︙ | |||
497 498 499 500 501 502 503 | 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 | - - + + - + - + - + - - + + - + - + - - + + - + - + - + | } objc_autoreleasePoolPop(pool); return ret; } |
︙ | |||
608 609 610 611 612 613 614 | 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 | - + - + - + - + | @throw [OFInvalidArgumentException exception]; } return true; } unsigned long |
︙ | |||
676 677 678 679 680 681 682 | 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 | - + - - - - + | OF_HASH_FINALIZE(hash); return hash; } static OFString * |
︙ | |||
756 757 758 759 760 761 762 | 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 | - - - - + - - - - + + + + - + - + - + - + - + - + - + - + - - + - + - + - + - + - + - + - + | addrIn6->sin6_addr.s6_addr[i + 1]]; first = false; } } [string makeImmutable]; |
Modified tests/OFIPXSocketTests.m from [5b53a7c15d] to [fbc341af78].
︙ | |||
22 23 24 25 26 27 28 | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | - + | static OFString *module = @"OFIPXSocket"; @implementation TestsAppDelegate (OFIPXSocketTests) - (void)IPXSocketTests { void *pool = objc_autoreleasePoolPush(); OFIPXSocket *sock; |
︙ | |||
58 59 60 61 62 63 64 | 58 59 60 61 62 63 64 65 66 67 68 69 70 | - - + + - | TEST(@"-[sendBuffer:length:receiver:]", R([sock sendBuffer: "Hello" length: 5 receiver: &address1])) TEST(@"-[receiveIntoBuffer:length:sender:]", [sock receiveIntoBuffer: buffer length: 5 sender: &address2] == 5 && memcmp(buffer, "Hello", 5) == 0 && |
Modified tests/OFSPXSocketTests.m from [b491e5d645] to [2f37ba742a].
︙ | |||
69 70 71 72 73 74 75 | 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | - - + + | @end @implementation TestsAppDelegate (OFSPXSocketTests) - (void)SPXSocketTests { void *pool = objc_autoreleasePoolPush(); OFSPXSocket *sockClient, *sockServer, *sockAccepted;; |
︙ | |||
111 112 113 114 115 116 117 | 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 | - - - + + + - + - + - + - - + + | @throw e; } objc_autoreleasePoolPop(pool); return; } |
︙ |
Modified tests/OFSPXStreamSocketTests.m from [3affd4c53c] to [f71b3b4551].
︙ | |||
69 70 71 72 73 74 75 | 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | - - + + | @end @implementation TestsAppDelegate (OFSPXStreamSocketTests) - (void)SPXStreamSocketTests { void *pool = objc_autoreleasePoolPush(); OFSPXStreamSocket *sockClient, *sockServer, *sockAccepted;; |
︙ | |||
111 112 113 114 115 116 117 | 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 169 170 | - - - + + + - + - + - + - - + + | @throw e; } objc_autoreleasePoolPop(pool); return; } |
︙ |
Modified tests/OFTCPSocketTests.m from [da7e6e6092] to [dfc17ad706].
︙ | |||
39 40 41 42 43 44 45 | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | - + | TEST(@"-[connectToHost:port:]", R([client connectToHost: @"127.0.0.1" port: port])) TEST(@"-[accept]", (accepted = [server accept])) TEST(@"-[remoteAddress]", |
Modified tests/OFUDPSocketTests.m from [29ec231a7f] to [c440a7c2a6].
︙ | |||
22 23 24 25 26 27 28 | 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 | - - + + - - + - - + + - + - - - + + + - - - + + + | static OFString *module = @"OFUDPSocket"; @implementation TestsAppDelegate (OFUDPSocketTests) - (void)UDPSocketTests { void *pool = objc_autoreleasePoolPush(); OFUDPSocket *sock; |
Modified tests/SocketTests.m from [a3c28758aa] to [ca5a359d97].
︙ | |||
54 55 56 57 58 59 60 | 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 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | - + - - + - + - - + - + - - + - + - - + - + - - + - + - - + - + - - + + + - + - - + - + - + - + - + - + - - + - + - - + - + - - + - + - - + - + - - + - + - - + - + - - + - + - - + - + - - + - - - + + + + - + - - + - - + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + - - - + + - | static OFString *module = @"Socket"; @implementation TestsAppDelegate (SocketTests) - (void)socketTests { void *pool = objc_autoreleasePoolPush(); |