1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-23 00:00:06 +01:00
libwebsockets/doc/latex/group__net.tex
Andy Green 014481e912 documentation convert to doxygen
Signed-off-by: Andy Green <andy@warmcat.com>
2016-07-14 08:57:27 +08:00

128 lines
No EOL
7.7 KiB
TeX

\hypertarget{group__net}{}\section{Network related helper A\+P\+Is}
\label{group__net}\index{Network related helper A\+P\+Is@{Network related helper A\+P\+Is}}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item
L\+W\+S\+\_\+\+V\+I\+S\+I\+B\+LE L\+W\+S\+\_\+\+E\+X\+T\+E\+RN const char $\ast$L\+W\+S\+\_\+\+W\+A\+R\+N\+\_\+\+U\+N\+U\+S\+E\+D\+\_\+\+R\+E\+S\+U\+LT \hyperlink{group__net_gad0df22db2be9fc65a667a1e83f9a92a4}{lws\+\_\+canonical\+\_\+hostname} (struct lws\+\_\+context $\ast$context)
\item
L\+W\+S\+\_\+\+V\+I\+S\+I\+B\+LE L\+W\+S\+\_\+\+E\+X\+T\+E\+RN void \hyperlink{group__net_ga092e5f473b3347f03ffeef8a950080f3}{lws\+\_\+get\+\_\+peer\+\_\+addresses} (struct lws $\ast$wsi, lws\+\_\+sockfd\+\_\+type fd, char $\ast$name, int name\+\_\+len, char $\ast$rip, int rip\+\_\+len)
\item
L\+W\+S\+\_\+\+V\+I\+S\+I\+B\+LE L\+W\+S\+\_\+\+E\+X\+T\+E\+RN const char $\ast$ \hyperlink{group__net_gad01014fed09759741b6d23afccfdaacc}{lws\+\_\+get\+\_\+peer\+\_\+simple} (struct lws $\ast$wsi, char $\ast$name, int namelen)
\item
L\+W\+S\+\_\+\+V\+I\+S\+I\+B\+LE L\+W\+S\+\_\+\+E\+X\+T\+E\+RN int \hyperlink{group__net_ga869d8bdffb0f2a7ce08e3ce10d6be3d8}{lws\+\_\+interface\+\_\+to\+\_\+sa} (int ipv6, const char $\ast$ifname, struct sockaddr\+\_\+in $\ast$addr, size\+\_\+t addrlen)
\end{DoxyCompactItemize}
\subsection{Detailed Description}
\subsubsection*{Network related helper A\+P\+Is}
These wrap miscellaneous useful network-\/related functions
\subsection{Function Documentation}
\index{Network related helper A\+P\+Is@{Network related helper A\+P\+Is}!lws\+\_\+canonical\+\_\+hostname@{lws\+\_\+canonical\+\_\+hostname}}
\index{lws\+\_\+canonical\+\_\+hostname@{lws\+\_\+canonical\+\_\+hostname}!Network related helper A\+P\+Is@{Network related helper A\+P\+Is}}
\subsubsection[{\texorpdfstring{lws\+\_\+canonical\+\_\+hostname(struct lws\+\_\+context $\ast$context)}{lws\_canonical\_hostname(struct lws\_context *context)}}]{\setlength{\rightskip}{0pt plus 5cm}L\+W\+S\+\_\+\+V\+I\+S\+I\+B\+LE L\+W\+S\+\_\+\+E\+X\+T\+E\+RN const char$\ast$ L\+W\+S\+\_\+\+W\+A\+R\+N\+\_\+\+U\+N\+U\+S\+E\+D\+\_\+\+R\+E\+S\+U\+LT lws\+\_\+canonical\+\_\+hostname (
\begin{DoxyParamCaption}
\item[{struct lws\+\_\+context $\ast$}]{context}
\end{DoxyParamCaption}
)}\hypertarget{group__net_gad0df22db2be9fc65a667a1e83f9a92a4}{}\label{group__net_gad0df22db2be9fc65a667a1e83f9a92a4}
{\ttfamily \#include $<$\hyperlink{libwebsockets_8h}{lib/libwebsockets.\+h}$>$}
\hyperlink{group__net_gad0df22db2be9fc65a667a1e83f9a92a4}{lws\+\_\+canonical\+\_\+hostname()} -\/ returns this host\textquotesingle{}s hostname
This is typically used by client code to fill in the host parameter when making a client connection. You can only call it after the context has been created.
\begin{DoxyParams}{Parameters}
{\em context} & Websocket context \\
\hline
\end{DoxyParams}
\index{Network related helper A\+P\+Is@{Network related helper A\+P\+Is}!lws\+\_\+get\+\_\+peer\+\_\+addresses@{lws\+\_\+get\+\_\+peer\+\_\+addresses}}
\index{lws\+\_\+get\+\_\+peer\+\_\+addresses@{lws\+\_\+get\+\_\+peer\+\_\+addresses}!Network related helper A\+P\+Is@{Network related helper A\+P\+Is}}
\subsubsection[{\texorpdfstring{lws\+\_\+get\+\_\+peer\+\_\+addresses(struct lws $\ast$wsi, lws\+\_\+sockfd\+\_\+type fd, char $\ast$name, int name\+\_\+len, char $\ast$rip, int rip\+\_\+len)}{lws\_get\_peer\_addresses(struct lws *wsi, lws\_sockfd\_type fd, char *name, int name\_len, char *rip, int rip\_len)}}]{\setlength{\rightskip}{0pt plus 5cm}L\+W\+S\+\_\+\+V\+I\+S\+I\+B\+LE L\+W\+S\+\_\+\+E\+X\+T\+E\+RN void lws\+\_\+get\+\_\+peer\+\_\+addresses (
\begin{DoxyParamCaption}
\item[{struct lws $\ast$}]{wsi, }
\item[{lws\+\_\+sockfd\+\_\+type}]{fd, }
\item[{char $\ast$}]{name, }
\item[{int}]{name\+\_\+len, }
\item[{char $\ast$}]{rip, }
\item[{int}]{rip\+\_\+len}
\end{DoxyParamCaption}
)}\hypertarget{group__net_ga092e5f473b3347f03ffeef8a950080f3}{}\label{group__net_ga092e5f473b3347f03ffeef8a950080f3}
{\ttfamily \#include $<$\hyperlink{libwebsockets_8h}{lib/libwebsockets.\+h}$>$}
\hyperlink{group__net_ga092e5f473b3347f03ffeef8a950080f3}{lws\+\_\+get\+\_\+peer\+\_\+addresses()} -\/ Get client address information
\begin{DoxyParams}{Parameters}
{\em wsi} & Local struct lws associated with \\
\hline
{\em fd} & Connection socket descriptor \\
\hline
{\em name} & Buffer to take client address name \\
\hline
{\em name\+\_\+len} & Length of client address name buffer \\
\hline
{\em rip} & Buffer to take client address IP dotted quad \\
\hline
{\em rip\+\_\+len} & Length of client address IP buffer \begin{DoxyVerb} This function fills in name and rip with the name and IP of
the client connected with socket descriptor fd. Names may be
truncated if there is not enough room. If either cannot be
determined, they will be returned as valid zero-length strings.\end{DoxyVerb}
\\
\hline
\end{DoxyParams}
\index{Network related helper A\+P\+Is@{Network related helper A\+P\+Is}!lws\+\_\+get\+\_\+peer\+\_\+simple@{lws\+\_\+get\+\_\+peer\+\_\+simple}}
\index{lws\+\_\+get\+\_\+peer\+\_\+simple@{lws\+\_\+get\+\_\+peer\+\_\+simple}!Network related helper A\+P\+Is@{Network related helper A\+P\+Is}}
\subsubsection[{\texorpdfstring{lws\+\_\+get\+\_\+peer\+\_\+simple(struct lws $\ast$wsi, char $\ast$name, int namelen)}{lws\_get\_peer\_simple(struct lws *wsi, char *name, int namelen)}}]{\setlength{\rightskip}{0pt plus 5cm}L\+W\+S\+\_\+\+V\+I\+S\+I\+B\+LE L\+W\+S\+\_\+\+E\+X\+T\+E\+RN const char$\ast$ lws\+\_\+get\+\_\+peer\+\_\+simple (
\begin{DoxyParamCaption}
\item[{struct lws $\ast$}]{wsi, }
\item[{char $\ast$}]{name, }
\item[{int}]{namelen}
\end{DoxyParamCaption}
)}\hypertarget{group__net_gad01014fed09759741b6d23afccfdaacc}{}\label{group__net_gad01014fed09759741b6d23afccfdaacc}
{\ttfamily \#include $<$\hyperlink{libwebsockets_8h}{lib/libwebsockets.\+h}$>$}
\hyperlink{group__net_gad01014fed09759741b6d23afccfdaacc}{lws\+\_\+get\+\_\+peer\+\_\+simple()} -\/ Get client address information without R\+D\+NS
\begin{DoxyParams}{Parameters}
{\em wsi} & Local struct lws associated with \\
\hline
{\em name} & Buffer to take client address name \\
\hline
{\em namelen} & Length of client address name buffer\\
\hline
\end{DoxyParams}
This provides a 123.\+123.\+123.\+123 type IP address in name from the peer that has connected to wsi \index{Network related helper A\+P\+Is@{Network related helper A\+P\+Is}!lws\+\_\+interface\+\_\+to\+\_\+sa@{lws\+\_\+interface\+\_\+to\+\_\+sa}}
\index{lws\+\_\+interface\+\_\+to\+\_\+sa@{lws\+\_\+interface\+\_\+to\+\_\+sa}!Network related helper A\+P\+Is@{Network related helper A\+P\+Is}}
\subsubsection[{\texorpdfstring{lws\+\_\+interface\+\_\+to\+\_\+sa(int ipv6, const char $\ast$ifname, struct sockaddr\+\_\+in $\ast$addr, size\+\_\+t addrlen)}{lws\_interface\_to\_sa(int ipv6, const char *ifname, struct sockaddr\_in *addr, size\_t addrlen)}}]{\setlength{\rightskip}{0pt plus 5cm}L\+W\+S\+\_\+\+V\+I\+S\+I\+B\+LE L\+W\+S\+\_\+\+E\+X\+T\+E\+RN int lws\+\_\+interface\+\_\+to\+\_\+sa (
\begin{DoxyParamCaption}
\item[{int}]{ipv6, }
\item[{const char $\ast$}]{ifname, }
\item[{struct sockaddr\+\_\+in $\ast$}]{addr, }
\item[{size\+\_\+t}]{addrlen}
\end{DoxyParamCaption}
)}\hypertarget{group__net_ga869d8bdffb0f2a7ce08e3ce10d6be3d8}{}\label{group__net_ga869d8bdffb0f2a7ce08e3ce10d6be3d8}
{\ttfamily \#include $<$\hyperlink{libwebsockets_8h}{lib/libwebsockets.\+h}$>$}
\hyperlink{group__net_ga869d8bdffb0f2a7ce08e3ce10d6be3d8}{lws\+\_\+interface\+\_\+to\+\_\+sa()} -\/ Convert interface name or IP to sockaddr struct
\begin{DoxyParams}{Parameters}
{\em ipv6} & Allow I\+P\+V6 addresses \\
\hline
{\em ifname} & Interface name or IP \\
\hline
{\em addr} & struct sockaddr\+\_\+in $\ast$ to be written \\
\hline
{\em addrlen} & Length of addr\\
\hline
\end{DoxyParams}
This converts a textual network interface name to a sockaddr usable by other network functions