mirror of
https://github.com/curl/curl.git
synced 2026-06-13 16:35:38 +03:00
Move as sockaddr2string() into cf-socket.c where its only callers are. Mark as UNITTEST for unit1609. Move "struct Curl_sockaddr_ex" into sockaddr.h, so connect.h and cf-socket.h can be included without all the system headers needed. Closes #21946
61 lines
2 KiB
C
61 lines
2 KiB
C
#ifndef HEADER_CURL_SOCKADDR_H
|
|
#define HEADER_CURL_SOCKADDR_H
|
|
/***************************************************************************
|
|
* _ _ ____ _
|
|
* Project ___| | | | _ \| |
|
|
* / __| | | | |_) | |
|
|
* | (__| |_| | _ <| |___
|
|
* \___|\___/|_| \_\_____|
|
|
*
|
|
* Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
|
*
|
|
* This software is licensed as described in the file COPYING, which
|
|
* you should have received as part of this distribution. The terms
|
|
* are also available at https://curl.se/docs/copyright.html.
|
|
*
|
|
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
|
* copies of the Software, and permit persons to whom the Software is
|
|
* furnished to do so, under the terms of the COPYING file.
|
|
*
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
* KIND, either express or implied.
|
|
*
|
|
* SPDX-License-Identifier: curl
|
|
*
|
|
***************************************************************************/
|
|
#include "curl_setup.h"
|
|
|
|
struct Curl_sockaddr_storage {
|
|
union {
|
|
struct sockaddr sa;
|
|
struct sockaddr_in sa_in;
|
|
#ifdef USE_IPV6
|
|
struct sockaddr_in6 sa_in6;
|
|
#endif
|
|
#ifdef HAVE_STRUCT_SOCKADDR_STORAGE
|
|
struct sockaddr_storage sa_stor;
|
|
#else
|
|
char cbuf[256]; /* this should be big enough to fit a lot */
|
|
#endif
|
|
} buffer;
|
|
};
|
|
|
|
/*
|
|
* The Curl_sockaddr_ex structure is libcurl's external API curl_sockaddr
|
|
* structure with enough space available to directly hold any
|
|
* protocol-specific address structures. The variable declared here will be
|
|
* used to pass / receive data to/from the fopensocket callback if this has
|
|
* been set, before that, it is initialized from parameters.
|
|
*/
|
|
struct Curl_sockaddr_ex {
|
|
int family;
|
|
int socktype;
|
|
int protocol;
|
|
unsigned int addrlen;
|
|
union {
|
|
struct sockaddr sa;
|
|
struct Curl_sockaddr_storage buf;
|
|
} addr;
|
|
};
|
|
|
|
#endif /* HEADER_CURL_SOCKADDR_H */
|