summaryrefslogtreecommitdiffstats
path: root/lldb/source/Host/common/SocketAddress.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Remove header grouping comments.Jonas Devlieghere2018-11-111-4/+0
| | | | | | | | This patch removes the comments grouping header includes. They were added after running IWYU over the LLDB codebase. However they add little value, are often outdates and burdensome to maintain. llvm-svn: 346626
* Fix debugserver accepting remote connectionsChris Bieneman2017-07-131-0/+7
| | | | | | | | While adding IPv6 support to debugserver I broke handling wildcard addresses and fully qualified address filtering. This patch resolves that bug and adds a test for matching the address "*". <rdar://problem/32947613> llvm-svn: 307957
* Fix assorted compiler warnings (mismatched signedness and printf specifiers)Pavel Labath2017-07-051-1/+1
| | | | llvm-svn: 307161
* NFC. Add comment about debugserver usageChris Bieneman2017-04-271-0/+6
| | | | | | | | This just adds a comment to SocketAddress about it being used by debugserver and the implications of that. If we need to make changes to this class that make it unsuitable for debugserver we can re-implement the minimal abstractions we need from this file in debugserver. I would prefer not to do that because code duplication is bad. Nuff said. llvm-svn: 301580
* Re-landing IPv6 support for LLDB HostChris Bieneman2017-04-261-1/+2
| | | | | | | | | | | | | | | | | | | | | | This support was landed in r300579, and reverted in r300669 due to failures on the bots. The failures were caused by sockets not being properly closed, and this updated version of the patches should resolve that. Summary from the original change: This patch adds IPv6 support to LLDB/Host's TCP socket implementation. Supporting IPv6 involved a few significant changes to the implementation of the socket layers, and I have performed some significant code cleanup along the way. This patch changes the Socket constructors for all types of sockets to not create sockets until first use. This is required for IPv6 support because the socket type will vary based on the address you are connecting to. This also has the benefit of removing code that could have errors from the Socket subclass constructors (which seems like a win to me). The patch also slightly changes the API and behaviors of the Listen/Accept pattern. Previously both Listen and Accept calls took an address specified as a string. Now only listen does. This change was made because the Listen call can result in opening more than one socket. In order to support listening for both IPv4 and IPv6 connections we need to open one AF_INET socket and one AF_INET6 socket. During the listen call we construct a map of file descriptors to addrin structures which represent the allowable incoming connection address. This map removes the need for taking an address into the Accept call. This does have a change in functionality. Previously you could Listen for connections based on one address, and Accept connections from a different address. This is no longer supported. I could not find anywhere in LLDB where we actually used the APIs in that way. The new API does still support AnyAddr for allowing incoming connections from any address. The Listen implementation is implemented using kqueue on FreeBSD and Darwin, WSAPoll on Windows and poll(2) everywhere else. https://reviews.llvm.org/D31823 llvm-svn: 301492
* Add more arguments to SocketAddress::GetAddressInfoPavel Labath2017-04-241-19/+13
| | | | | | | | | | | | | | | | | | | Summary: the reason for this is two-fold: - getaddrinfo without the extra arguments will return the same (network-level) address multiple times, once for each supported transport protocol, which is not what is usually intended (it certainly wasn't in D31823) - it enables us to rewrite the getaddrinfo member function in terms of the static GetAddressInfo function. Reviewers: beanz, tberghammer Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D32357 llvm-svn: 301168
* [NFC] Adding a new wrapper for getaddrinfoChris Bieneman2017-04-121-0/+48
| | | | | | | | | | | | | | Summary: This patch adds a new wrapper for getaddrinfo which returns a std::vector of SocketAddresses. While this patch doesn't add any uses of the new function, I have two separable patches that are dependent on this, so I put it in its own patch. Reviewers: zturner Reviewed By: zturner Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D31822 llvm-svn: 300112
* Make lldb -Werror clean on Windows.Zachary Turner2016-10-051-1/+5
| | | | | | Differential Revision: https://reviews.llvm.org/D25247 llvm-svn: 283344
* *** This commit represents a complete reformatting of the LLDB source codeKate Stone2016-09-061-261/+179
| | | | | | | | | | | | | | | | | | | | | | | *** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
* Delete Host/windows/win32.hZachary Turner2016-08-091-2/+2
| | | | | | | | | | | | | | | | | | | It's always hard to remember when to include this file, and when you do include it it's hard to remember what preprocessor check it needs to be behind, and then you further have to remember whether it's windows.h or win32.h which you need to include. This patch changes the name to PosixApi.h, which is more appropriately named, and makes it independent of any preprocessor setting. There's still the issue of people not knowing when to include this, because there's not a well-defined set of things it exposes other than "whatever is missing on Windows", but at least this should make it less painful to fix when problems arise. This patch depends on LLVM revision r278170. llvm-svn: 278177
* Fix all of the unannotated switch cases to annotate the fall through or do ↵Greg Clayton2016-02-261-4/+2
| | | | | | the right thing and break. llvm-svn: 261950
* freeaddrinfo(NULL) segfaults on Android.Chaoren Lin2015-07-171-2/+4
| | | | | | | | | | Reviewers: tberghammer Subscribers: tberghammer, danalbert, lldb-commits Differential Revision: http://reviews.llvm.org/D11285 llvm-svn: 242560
* Fix FileSpec::GetPath to return null-terminated stringsIlia K2015-02-271-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Before this fix the FileSpec::GetPath() returned string which might be without '\0' at the end. It could have happened if the size of buffer for path was less than actual path. Test case: ``` FileSpec test("/path/to/file", false); char buf[]="!!!!!!"; test.GetPath(buf, 3); ``` Before fix: ``` 233 FileSpec test("/path/to/file", false); 234 char buf[]="!!!!!!"; 235 test.GetPath(buf, 3); 236 -> 237 if (core_file) 238 { 239 if (!core_file.Exists()) 240 { (lldb) print buf (char [7]) $0 = "/pa!!!" ``` After fix: ``` 233 FileSpec test("/path/to/file", false); 234 char buf[]="!!!!!!"; 235 test.GetPath(buf, 3); 236 -> 237 if (core_file) 238 { 239 if (!core_file.Exists()) 240 { (lldb) print buf (char [7]) $0 = "/p" ``` Reviewers: zturner, abidh, clayborg Reviewed By: abidh, clayborg Subscribers: tberghammer, vharron, lldb-commits, clayborg, zturner, abidh Differential Revision: http://reviews.llvm.org/D7553 llvm-svn: 230787
* Fix Mingw build.Hafiz Abid Qadeer2015-02-111-1/+4
| | | | | | | | | | | | | Following changes are done. Add missing headers. Replace _snprintf with snprintf. It is already changed to _snprintf for MSVC. Add a file in the build for autoconf. Call DynamicLoaderWindows::Terminate and DynamicLoaderWindows::Initialize only for MSVC build. Reviewed in http://reviews.llvm.org/D7536. llvm-svn: 228822
* Compile fix for WIN32Vince Harron2015-01-161-7/+9
| | | | llvm-svn: 226301
* Add Socket::Get[Remote/Local]IpAddress and unit testsVince Harron2015-01-161-0/+70
| | | | | | Differential Revision: http://reviews.llvm.org/D6917 llvm-svn: 226234
* Refactor SocketAddress::getaddrinfo - avoid calling IsValid if ::getaddrinfo ↵Oleksiy Vyalov2014-11-271-3/+7
| | | | | | | | has failed. Otherwise, IsValid crashes on assertation in GetFamilyLength. llvm-svn: 222862
* Fix Windows warnings.Todd Fiala2014-05-281-0/+1
| | | | | | | | | | This fixes a number of trivial warnings in the Windows build. This is part of a larger effort to make the Windows build warning-free. See http://reviews.llvm.org/D3914 for more details. Change by Zachary Turner llvm-svn: 209749
* Replace some _MSC_VER with _WIN32.Hafiz Abid Qadeer2014-03-121-1/+1
| | | | | | | This allows to use some code for mingw which was previously only used for MSVC. llvm-svn: 203651
* FreeBSD and NetBSD have sa_len in struct sockaddrEd Maste2013-12-091-2/+2
| | | | llvm-svn: 196790
* Replace all in_port_t with uint16_t to avoid compilation issues on different ↵Greg Clayton2013-12-061-4/+4
| | | | | | systems. llvm-svn: 196586
* Modified local spawning in debugserver processes to use a new ↵Greg Clayton2013-12-051-21/+47
| | | | | | | | | | | | | | | | | | --reverse-connect option so that debugserver actually connects back to LLDB instead of LLDB connecting to debugserver. This gets rid of our hacky "get_random_port()" which would grab a random port and tell debugserver to open that port. Now LLDB creates, binds, listens and accepts a connection by binding to port zero and sending the correctly bound port down as the host:port to connect back to. Fixed the "ConnectionFileDescriptor" to be able to correctly listen for connections from a specified host, localhost, or any host. Prior to this fix "listen://" only accepted the following format: listen://<port> But now it can accept: listen://<port> // Listen for connection from localhost on port <port> listen://<host>:<port> // Listen for connection from <host> and <port> listen://*:<port> // Listen for connection from any host on port <port> llvm-svn: 196547
* Fixes to get LLDB building on Windows again.Deepak Panickal2013-10-221-0/+2
| | | | llvm-svn: 193159
* arpa/inet.h is the canonical source of htons and friends.Joerg Sonnenberger2013-09-251-0/+1
| | | | | | At least on NetBSD, none of the already included headers pulls it in. llvm-svn: 191386
* Add support for platforms without sa_len to SocketAddress, and modifyPeter Collingbourne2011-07-221-8/+19
| | | | | | some code to use it llvm-svn: 135790
* Avoid calling accessor function more than once when result is already inGreg Clayton2011-07-191-1/+1
| | | | | | a local. llvm-svn: 135512
* Added some more functionality to SocketAddress and modified Greg Clayton2011-07-191-1/+124
| | | | | | ConnectionFileDescriptor to use it. llvm-svn: 135511
* Abstract "struct sockaddr", "struct sockaddr_in", "struct sockaddr_in6" andGreg Clayton2011-07-191-0/+126
"struct sockaddr_storage" into a new host class called SocketAddress. This will allow us to control the host specific implementations (such as how to get the length) into a single Host specific class. llvm-svn: 135488
OpenPOWER on IntegriCloud