Changes In Branch ofsock Through [4eb272eb8b] Excluding Merge-Ins
This is equivalent to a diff from 39863b3503 to 4eb272eb8b
2022-11-07
| ||
00:05 | Merge trunk into branch "ofsock" check-in: e91cba848b user: js tags: ofsock | |
2021-05-01
| ||
02:39 | Fix compiling for AmigaOS check-in: 171f3ba831 user: js tags: trunk | |
2021-04-30
| ||
23:06 | Merge trunk into branch "sctp" check-in: a82e7f4b3d user: js tags: sctp | |
22:26 | Merge trunk into branch "invoke-invocation" check-in: efca87b509 user: js tags: invoke-invocation | |
22:04 | Merge trunk into branch "ofsock" check-in: 4eb272eb8b user: js tags: ofsock | |
21:56 | Merge trunk into branch "asn1" check-in: 4507e0bee3 user: js tags: asn1 | |
21:37 | Merge trunk into 1.0 branch check-in: 9a64964dd0 user: js tags: 1.0 | |
21:23 | Make OFHashSeed private check-in: 39863b3503 user: js tags: trunk | |
21:15 | OFTCPSocketSOCKS5Connector: Move state enum to .m check-in: f7abfde081 user: js tags: trunk | |
2021-04-07
| ||
21:39 | Merge trunk into branch "ofsock" check-in: 771537a7e4 user: js tags: ofsock | |
Modified .fossil-settings/clean-glob from [436c792c19] to [21f56a0dfc].
︙ | ︙ | |||
44 45 46 47 48 49 50 | tests/tests.arm9 tests/tests.nds utils/objfw-config utils/ofarc/ofarc utils/ofdns/ofdns utils/ofhash/ofhash utils/ofhttp/ofhttp | > | 44 45 46 47 48 49 50 51 | tests/tests.arm9 tests/tests.nds utils/objfw-config utils/ofarc/ofarc utils/ofdns/ofdns utils/ofhash/ofhash utils/ofhttp/ofhttp utils/ofsock/ofsock |
Modified .fossil-settings/ignore-glob from [5da8718334] to [7ba37c3560].
︙ | ︙ | |||
49 50 51 52 53 54 55 | tests/tests.arm9 tests/tests.nds utils/objfw-config utils/ofarc/ofarc utils/ofdns/ofdns utils/ofhash/ofhash utils/ofhttp/ofhttp | > | 49 50 51 52 53 54 55 56 | tests/tests.arm9 tests/tests.nds utils/objfw-config utils/ofarc/ofarc utils/ofdns/ofdns utils/ofhash/ofhash utils/ofhttp/ofhttp utils/ofsock/ofsock |
Modified .gitignore from [0c715f3134] to [5a4054131c].
︙ | ︙ | |||
49 50 51 52 53 54 55 | tests/tests.arm9 tests/tests.nds utils/objfw-config utils/ofarc/ofarc utils/ofdns/ofdns utils/ofhash/ofhash utils/ofhttp/ofhttp | > | 49 50 51 52 53 54 55 56 | tests/tests.arm9 tests/tests.nds utils/objfw-config utils/ofarc/ofarc utils/ofdns/ofdns utils/ofhash/ofhash utils/ofhttp/ofhttp utils/ofsock/ofsock |
Modified configure.ac from [efc36f0030] to [6d9079bc6a].
︙ | ︙ | |||
1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 | AC_SUBST(OF_HTTP_CLIENT_TESTS_M, "OFHTTPClientTests.m") ]) AC_SUBST(OFDNS, "ofdns") AS_IF([test x"$enable_files" != x"no"], [ AC_SUBST(OFHTTP, "ofhttp") ]) ]) AC_DEFUN([CHECK_BUILTIN_BSWAP], [ AC_MSG_CHECKING(for __builtin_bswap$1) AC_LINK_IFELSE([ AC_LANG_PROGRAM([ #include <stdint.h> | > | 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 | AC_SUBST(OF_HTTP_CLIENT_TESTS_M, "OFHTTPClientTests.m") ]) AC_SUBST(OFDNS, "ofdns") AS_IF([test x"$enable_files" != x"no"], [ AC_SUBST(OFHTTP, "ofhttp") ]) AC_SUBST(OFSOCK, "ofsock") ]) AC_DEFUN([CHECK_BUILTIN_BSWAP], [ AC_MSG_CHECKING(for __builtin_bswap$1) AC_LINK_IFELSE([ AC_LANG_PROGRAM([ #include <stdint.h> |
︙ | ︙ |
Modified extra.mk.in from [70070944b6] to [4f1fb28660].
︙ | ︙ | |||
38 39 40 41 42 43 44 45 46 47 48 49 50 51 | LOOKUP_ASM_AMIGALIB_A = @LOOKUP_ASM_AMIGALIB_A@ LOOKUP_ASM_LIB_A = @LOOKUP_ASM_LIB_A@ MAP_LDFLAGS = @MAP_LDFLAGS@ OFARC = @OFARC@ OFDNS = @OFDNS@ OFHASH = @OFHASH@ OFHTTP = @OFHTTP@ OF_BLOCK_TESTS_M = @OF_BLOCK_TESTS_M@ OF_EPOLL_KERNEL_EVENT_OBSERVER_M = @OF_EPOLL_KERNEL_EVENT_OBSERVER_M@ OF_HTTP_CLIENT_TESTS_M = @OF_HTTP_CLIENT_TESTS_M@ OF_KQUEUE_KERNEL_EVENT_OBSERVER_M = @OF_KQUEUE_KERNEL_EVENT_OBSERVER_M@ OF_POLL_KERNEL_EVENT_OBSERVER_M = @OF_POLL_KERNEL_EVENT_OBSERVER_M@ OF_SELECT_KERNEL_EVENT_OBSERVER_M = @OF_SELECT_KERNEL_EVENT_OBSERVER_M@ OF_SUBPROCESS_M = @OF_SUBPROCESS_M@ | > | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | LOOKUP_ASM_AMIGALIB_A = @LOOKUP_ASM_AMIGALIB_A@ LOOKUP_ASM_LIB_A = @LOOKUP_ASM_LIB_A@ MAP_LDFLAGS = @MAP_LDFLAGS@ OFARC = @OFARC@ OFDNS = @OFDNS@ OFHASH = @OFHASH@ OFHTTP = @OFHTTP@ OFSOCK = @OFSOCK@ OF_BLOCK_TESTS_M = @OF_BLOCK_TESTS_M@ OF_EPOLL_KERNEL_EVENT_OBSERVER_M = @OF_EPOLL_KERNEL_EVENT_OBSERVER_M@ OF_HTTP_CLIENT_TESTS_M = @OF_HTTP_CLIENT_TESTS_M@ OF_KQUEUE_KERNEL_EVENT_OBSERVER_M = @OF_KQUEUE_KERNEL_EVENT_OBSERVER_M@ OF_POLL_KERNEL_EVENT_OBSERVER_M = @OF_POLL_KERNEL_EVENT_OBSERVER_M@ OF_SELECT_KERNEL_EVENT_OBSERVER_M = @OF_SELECT_KERNEL_EVENT_OBSERVER_M@ OF_SUBPROCESS_M = @OF_SUBPROCESS_M@ |
︙ | ︙ |
Modified utils/Makefile from [521b7f89ce] to [82be3d0820].
1 2 3 4 5 6 7 8 9 10 11 12 13 | include ../extra.mk SUBDIRS += ${OFARC} \ ${OFDNS} \ ${OFHASH} \ ${OFHTTP} \ completions include ../buildsys.mk DISTCLEAN = objfw-config install-extra: objfw-config objfw-compile objfw-new | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | include ../extra.mk SUBDIRS += ${OFARC} \ ${OFDNS} \ ${OFHASH} \ ${OFHTTP} \ ${OFSOCK} \ completions include ../buildsys.mk DISTCLEAN = objfw-config install-extra: objfw-config objfw-compile objfw-new |
︙ | ︙ |
Added utils/ofsock/Makefile version [0438ba0691].
> > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | include ../../extra.mk PROG = ofsock${PROG_SUFFIX} SRCS = OFSock.m include ../../buildsys.mk PACKAGE_NAME = ofsock ${PROG}: ${LIBOBJFW_DEP_LVL2} ${LIBOBJFWRT_DEP_LVL2} CPPFLAGS += -I../../src \ -I../../src/runtime \ -I../../src/exceptions \ -I../.. LIBS := -L../../src -lobjfw \ -L../../src/runtime -L../../src/runtime/linklib ${RUNTIME_LIBS} \ ${LIBS} LD = ${OBJC} LDFLAGS += ${LDFLAGS_RPATH} |
Added utils/ofsock/OFSock.m version [73c30083ac].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 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 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 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 | /* * Copyright (c) 2008-2021 Jonathan Schleifer <js@nil.im> * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in * the packaging of this file. * * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #import "OFApplication.h" #import "OFArray.h" #import "OFNumber.h" #import "OFPair.h" #import "OFStdIOStream.h" #import "OFStream.h" #import "OFString.h" #import "OFTCPSocket.h" #import "OFURL.h" #define bufferLen 4096 @interface OFSock: OFObject <OFApplicationDelegate, OFStreamDelegate> { char _buffer[bufferLen]; OFMutableArray OF_GENERIC(OFPair OF_GENERIC(OFStream *, OFStream *) *) *_streams; int _errors; } @end OF_APPLICATION_DELEGATE(OFSock) static OFPair OF_GENERIC(OFStream *, OFStream *) * streamFromString(OFString *string) { OFURL *URL; OFString *scheme; if ([string isEqual: @"-"]) return [OFPair pairWithFirstObject: OFStdIn secondObject: OFStdOut]; URL = [OFURL URLWithString: string]; scheme = URL.scheme; if ([scheme isEqual: @"tcp"]) { OFTCPSocket *sock = [OFTCPSocket socket]; if (URL.port == nil) { [OFStdErr writeLine: @"Need a port!"]; [OFApplication terminateWithStatus: 1]; } [sock connectToHost: URL.host port: URL.port.shortValue]; return [OFPair pairWithFirstObject: sock secondObject: sock]; } [OFStdErr writeFormat: @"Invalid protocol: %@\n", scheme]; [OFApplication terminateWithStatus: 1]; abort(); } @implementation OFSock - (void)applicationDidFinishLaunching { OFArray OF_GENERIC(OFString *) *arguments = [OFApplication arguments]; if (arguments.count < 1) { [OFStdErr writeLine: @"Need at least one argument!"]; [OFApplication terminateWithStatus: 1]; } _streams = [[OFMutableArray alloc] init]; for (OFString *argument in arguments) { OFPair *pair = streamFromString(argument); [pair.firstObject setDelegate: self]; [_streams addObject: pair]; } if (arguments.count == 1) { OFStdIn.delegate = self; [_streams addObject: [OFPair pairWithFirstObject: OFStdIn secondObject: OFStdOut]]; } for (OFPair *pair in _streams) [pair.firstObject asyncReadIntoBuffer: _buffer length: bufferLen]; } - (void)removeDeadStream: (OFStream *)stream { size_t count = _streams.count; for (size_t i = 0; i < count; i++) { if ([[_streams objectAtIndex: i] firstObject] == stream) { [_streams removeObjectAtIndex: i]; break; } } if (_streams.count < 2) [OFApplication terminateWithStatus: _errors]; } - (bool)stream: (OFStream *)stream didReadIntoBuffer: (void *)buffer length: (size_t)length exception: (id)exception { if (exception != nil) { [OFStdErr writeFormat: @"Exception on stream %@: %@\n", stream, exception]; _errors++; [self removeDeadStream: stream]; return false; } if (stream.atEndOfStream) { [self removeDeadStream: stream]; return false; } for (OFPair *pair in _streams) { if (pair.firstObject == stream) continue; [pair.secondObject writeBuffer: buffer length: length]; } return true; } @end |