next up previous contents index
Next: Operating specific access functions Up: Operating-system specific functions Previous: Disk based functions   Contents   Index

Network based routines

These routines send and receive network data the specifics of addresses and families on a given operating system.


\begin{funcdecl}{krb5_os_localaddr}{krb5_error_code}{\funcin}
\funcarg{krb5_context}{context}
\funcout
\funcarg{krb5_address ***}{addr}
\end{funcdecl}

Return all the protocol addresses of this host.

Compile-time configuration flags will indicate which protocol family addresses might be returned. *addr is filled in to point to an array of address pointers, terminated by a null pointer. All the storage pointed to is allocated and should be freed by the caller with krb5_free_address when no longer needed.


\begin{funcdecl}{krb5_gen_portaddr}{krb5_error_code}{\funcin}
\funcarg{krb5_cont...
...5_const_pointer}{ptr}
\funcout
\funcarg{krb5_address **}{outaddr}
\end{funcdecl}

Given an address adr and an additional address-type specific portion pointed to by port this routine combines them into a freshly-allocated krb5_address with type ADDRTYPE_ADDRPORT and fills in *outaddr to point to this address. For IP addresses, ptr should point to a network-byte-order TCP or UDP port number. Upon success, *outaddr will point to an allocated address which should be freed with krb5_free_address.


\begin{funcdecl}{krb5_sendto_kdc}{krb5_error_code}{\funcin}
\funcarg{krb5_contex...
...const krb5_data *}{realm}
\funcout
\funcarg{krb5_data *}{receive}
\end{funcdecl}

Send the message send to a KDC for realm realm and return the response (if any) in receive.

If the message is sent and a response is received, 0 is returned, otherwise an error code is returned.

The storage for receive is allocated and should be freed by the caller when finished.


\begin{funcdecl}{krb5_net_read}{int}{\funcin}
\funcarg{krb5_context}{context}
\f...
...nt}{fd}
\funcout
\funcarg{char *}{buf}
\funcin
\funcarg{int}{len}
\end{funcdecl}

Like read(2), but guarantees that it reads as much as was requested or returns -1 and sets errno.

(make sure your sender will send all the stuff you are looking for!) Only useful on stream sockets and pipes.


\begin{funcdecl}{krb5_net_write}{int}{\funcin}
\funcarg{krb5_context}{context}
\funcarg{int}{fd}
\funcarg{const char *}{buf}
\funcarg{int}{len}
\end{funcdecl}

Like write(2), but guarantees that it writes as much as was requested or returns -1 and sets errno.

Only useful on stream sockets and pipes.


\begin{funcdecl}{krb5_write_message}{krb5_error_code}{\funcin}
\funcarg{krb5_con...
...}{context}
\funcarg{krb5_pointer}{fd}
\funcarg{krb5_data *}{data}
\end{funcdecl}

krb5_write_message writes data to the network as a message, using the network connection pointed to by fd.


\begin{funcdecl}{krb5_read_message}{krb5_error_code}{\funcin}
\funcarg{krb5_cont...
...}
\funcarg{krb5_pointer}{fd}
\funcout
\funcarg{krb5_data *}{data}
\end{funcdecl}

Reads data from the network as a message, using the network connection pointed to by fd.


next up previous contents index
Next: Operating specific access functions Up: Operating-system specific functions Previous: Disk based functions   Contents   Index
Autobuild 2009-09-05