\doxysection{socket\+\_\+compat.\+h}
\label{socket__compat_8h_source}\index{include/osmocom/core/socket\_compat.h@{include/osmocom/core/socket\_compat.h}}
\textbf{ Go to the documentation of this file.}
\begin{DoxyCode}{0}
\DoxyCodeLine{1 \textcolor{preprocessor}{\#define \_\_LIBOSMOCORE\_HAVE\_SYS\_SOCKET\_H 1}}
\DoxyCodeLine{2 \textcolor{preprocessor}{\#define \_\_LIBOSMOCORE\_HAVE\_NETINET\_IN\_H 1}}
\DoxyCodeLine{3 }
\DoxyCodeLine{4 \textcolor{preprocessor}{\#if \_\_LIBOSMOCORE\_HAVE\_SYS\_SOCKET\_H}}
\DoxyCodeLine{5 \textcolor{preprocessor}{        \#include <sys/socket.h>}}
\DoxyCodeLine{6 \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{7 \textcolor{comment}{/* Minimal netinet/in.h as per POSIX https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys\_socket.h.html */}}
\DoxyCodeLine{8 \textcolor{preprocessor}{\#include <stdint.h>}}
\DoxyCodeLine{9 \textcolor{keyword}{typedef} uint32\_t socklen\_t;}
\DoxyCodeLine{10 \textcolor{keyword}{typedef} \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{short}  sa\_family\_t;}
\DoxyCodeLine{11 }
\DoxyCodeLine{12 \textcolor{keyword}{struct }sockaddr \{}
\DoxyCodeLine{13         sa\_family\_t sa\_family;}
\DoxyCodeLine{14         \textcolor{keywordtype}{char} sa\_data[14];}
\DoxyCodeLine{15 \};}
\DoxyCodeLine{16 }
\DoxyCodeLine{17 \textcolor{keyword}{struct }sockaddr\_storage \{}
\DoxyCodeLine{18         sa\_family\_t ss\_family;}
\DoxyCodeLine{19         \textcolor{keywordtype}{char} \_\_data[128 -\/ \textcolor{keyword}{sizeof}(sa\_family\_t)];}
\DoxyCodeLine{20 \};}
\DoxyCodeLine{21 \textcolor{preprocessor}{\#endif }\textcolor{comment}{/* if \_\_LIBOSMOCORE\_HAVE\_SYS\_SOCKET\_H */}\textcolor{preprocessor}{}}
\DoxyCodeLine{22 }
\DoxyCodeLine{23 \textcolor{preprocessor}{\#if \_\_LIBOSMOCORE\_HAVE\_NETINET\_IN\_H}}
\DoxyCodeLine{24 \textcolor{preprocessor}{        \#include <netinet/in.h>}}
\DoxyCodeLine{25 \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{26 \textcolor{comment}{/* Minimal netinet/in.h as per POSIX https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet\_in.h.html */}}
\DoxyCodeLine{27 \textcolor{preprocessor}{\#include <stdint.h>}}
\DoxyCodeLine{28 }
\DoxyCodeLine{29 \textcolor{keyword}{typedef} uint32\_t in\_addr\_t;}
\DoxyCodeLine{30 \textcolor{keyword}{struct }in\_addr \{}
\DoxyCodeLine{31         in\_addr\_t s\_addr;}
\DoxyCodeLine{32 \};}
\DoxyCodeLine{33 }
\DoxyCodeLine{34 \textcolor{keyword}{typedef} uint16\_t in\_port\_t;}
\DoxyCodeLine{35 }
\DoxyCodeLine{36 \textcolor{keyword}{struct }in6\_addr \{}
\DoxyCodeLine{37         \textcolor{keyword}{union }\{}
\DoxyCodeLine{38                 uint8\_t \_\_u6\_addr8[16];}
\DoxyCodeLine{39                 uint16\_t \_\_u6\_addr16[8];}
\DoxyCodeLine{40                 uint32\_t \_\_u6\_addr32[4];}
\DoxyCodeLine{41         \} \_\_in6\_u;}
\DoxyCodeLine{42 \textcolor{preprocessor}{        \#define s6\_addr         \_\_in6\_u.\_\_u6\_addr8}}
\DoxyCodeLine{43 \textcolor{preprocessor}{        \#define s6\_addr16       \_\_in6\_u.\_\_u6\_addr16}}
\DoxyCodeLine{44 \textcolor{preprocessor}{        \#define s6\_addr32       \_\_in6\_u.\_\_u6\_addr32}}
\DoxyCodeLine{45 \};}
\DoxyCodeLine{46 }
\DoxyCodeLine{47 \textcolor{preprocessor}{\#define INET\_ADDRSTRLEN 16}}
\DoxyCodeLine{48 \textcolor{preprocessor}{\#define INET6\_ADDRSTRLEN 46}}
\DoxyCodeLine{49 }
\DoxyCodeLine{50 \textcolor{keyword}{struct }sockaddr\_in \{}
\DoxyCodeLine{51         sa\_family\_t sin\_family;}
\DoxyCodeLine{52         in\_port\_t sin\_port;}
\DoxyCodeLine{53         \textcolor{keyword}{struct }in\_addr sin\_addr;}
\DoxyCodeLine{54         \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{char} sin\_zero[\textcolor{keyword}{sizeof} (\textcolor{keyword}{struct }sockaddr)}
\DoxyCodeLine{55                                 -\/ sizeof (sa\_family\_t)}
\DoxyCodeLine{56                                 -\/ sizeof (in\_port\_t)}
\DoxyCodeLine{57                                 -\/ sizeof (struct in\_addr)];}
\DoxyCodeLine{58 \};}
\DoxyCodeLine{59 }
\DoxyCodeLine{60 \textcolor{keyword}{struct }sockaddr\_in6 \{}
\DoxyCodeLine{61         sa\_family\_t sin6\_family;}
\DoxyCodeLine{62         in\_port\_t sin6\_port;}
\DoxyCodeLine{63         uint32\_t sin6\_flowinfo;}
\DoxyCodeLine{64         \textcolor{keyword}{struct }in6\_addr sin6\_addr;}
\DoxyCodeLine{65         uint32\_t sin6\_scope\_id;}
\DoxyCodeLine{66 \};}
\DoxyCodeLine{67 }
\DoxyCodeLine{68 \textcolor{preprocessor}{\#endif }\textcolor{comment}{/* if \_\_LIBOSMOCORE\_HAVE\_NETINET\_IN\_H */}\textcolor{preprocessor}{}}

\end{DoxyCode}
