Add additional defines.
Fix implementtion of f_socket_accept().
Add read and write socket functions.
Add additional status codes.
#endif // _di_f_socket_domains_
/**
+ * Socket Options.
+ *
+ * f_socket_option_*:
+ * - address_reuse: Re-use address.
+ * - advice_cnx: CNX Advice.
+ * - bpf_attach: Attach Berkeley Packet Filter.
+ * - bpf_detach: Detach Berkeley Packet Filter.
+ * - bpf_extensions: Berkeley Packet Filter extensions.
+ * - broadcast: broadcast
+ * - buffer_receive: Receive buffer.
+ * - buffer_receive_force: Receive buffer (forced).
+ * - buffer_send: Send buffer.
+ * - buffer_send_force: Send buffer (forced).
+ * - cbpf_port_reuse_attach: Re-use port in C-Berkeley Packet Filter.
+ * - check_not: Don't check.
+ * - compatibility_bsd: BSD compatibility.
+ * - connection_accept: Accept connection.
+ * - cookie: Cookie.
+ * - cpu_incoming: Incomming CPU.
+ * - credentials_pass: Pass credentials.
+ * - credentials_peer: Peer credentials.
+ * - debug: Debug setting.
+ * - device_bind: Bind device.
+ * - domain: Domain.
+ * - ebpf_port_reuse_attach: Re-use port in E-Berkeley Packet Filter.
+ * - error: Error.
+ * - filter_attach: Attach filter.
+ * - filter_detach: Detach Filter.
+ * - filter_get: Get filter.
+ * - filter_lock: Lock filter.
+ * - frame_check_sequence_not: No Frame Check Sequence.
+ * - groups_peer: Peer groups.
+ * - keep_alive: Keep alive.
+ * - linger: Linger.
+ * - low_at_receive: Low at receive.
+ * - low_at_send: Low at send.
+ * - mark: Mark.
+ * - memory_information: Memory information.
+ * - name_peer: Peer name.
+ * - napi_id_incoming: Incomming NAPI identifier.
+ * - out_of_band_inline: Inline Out of Band.
+ * - pacing_rate_max: Max pacing rate.
+ * - peek_off: Peek off.
+ * - poll_busy: Busy poll.
+ * - port_reuse: Re-use port.
+ * - priority: Priority.
+ * - protocol: Protocol.
+ * - receive_overflow: Receive Overflow.
+ * - route_not: Don't Route.
+ * - security_authentication: Authentication security.
+ * - security_network: Network security.
+ * - security_pass: Pass security.
+ * - security_peer: Peer security.
+ * - security_transport: Security transport.
+ * - select_error_queue: Select error queue.
+ * - time_out_receive: Receive time out.
+ * - time_out_send: Send time out.
+ * - time_stamp: Time stamp.
+ * - time_stamp_namespace: Time stamp namespace.
+ * - time_stamping: Time stamping.
+ * - time_stamping_packet: Time stamping packet.
+ * - time_stamping_stats: Time stamping statistics.
+ * - time_transmit: Transmission time.
+ * - type: Type.
+ * - wifi_status: Wifi status.
+ * - zero_copy_d Zero copy.
+ */
+#ifndef _di_f_socket_options_
+ #define f_socket_option_address_reuse_d SO_REUSEADDR
+ #define f_socket_option_advice_cnx_d SO_CNX_ADVICE
+ #define f_socket_option_bpf_attach_d SO_ATTACH_BPF
+ #define f_socket_option_bpf_detach_d SO_DETACH_BPF
+ #define f_socket_option_bpf_extensions_d SO_BPF_EXTENSIONS
+ #define f_socket_option_broadcast_d SO_BROADCAST
+ #define f_socket_option_buffer_receive_d SO_RCVBUF
+ #define f_socket_option_buffer_receive_force_d SO_RCVBUFFORCE
+ #define f_socket_option_buffer_send_d SO_SNDBUF
+ #define f_socket_option_buffer_send_force_d SO_SNDBUFFORCE
+ #define f_socket_option_cbpf_port_reuse_attach_d SO_ATTACH_REUSEPORT_CBPF
+ #define f_socket_option_check_not_d SO_NO_CHECK
+ #define f_socket_option_compatibility_bsd_d SO_BSDCOMPAT
+ #define f_socket_option_connection_accept_d SO_ACCEPTCONN
+ #define f_socket_option_cookie_d SO_COOKIE
+ #define f_socket_option_cpu_incoming_d SO_INCOMING_CPU
+ #define f_socket_option_credentials_pass_d SO_PASSCRED
+ #define f_socket_option_credentials_peer_d SO_PEERCRED
+ #define f_socket_option_debug_d SO_DEBUG
+ #define f_socket_option_device_bind_d SO_BINDTODEVICE
+ #define f_socket_option_domain_d SO_DOMAIN
+ #define f_socket_option_ebpf_port_reuse_attach_d SO_ATTACH_REUSEPORT_EBPF
+ #define f_socket_option_error_d SO_ERROR
+ #define f_socket_option_filter_attach_d SO_ATTACH_FILTER
+ #define f_socket_option_filter_detach_d SO_DETACH_FILTER
+ #define f_socket_option_filter_get_d SO_GET_FILTER
+ #define f_socket_option_filter_lock_d SO_LOCK_FILTER
+ #define f_socket_option_frame_check_sequence_not_d SO_NOFCS
+ #define f_socket_option_groups_peer_d SO_PEERGROUPS
+ #define f_socket_option_keep_alive_d SO_KEEPALIVE
+ #define f_socket_option_linger_d SO_LINGER
+ #define f_socket_option_low_at_receive_d SO_RCVLOWAT
+ #define f_socket_option_low_at_send_d SO_SNDLOWAT
+ #define f_socket_option_mark_d SO_MARK
+ #define f_socket_option_memory_information_d SO_MEMINFO
+ #define f_socket_option_name_peer_d SO_PEERNAME
+ #define f_socket_option_napi_id_incoming_d SO_INCOMING_NAPI_ID
+ #define f_socket_option_out_of_band_inline_d SO_OOBINLINE
+ #define f_socket_option_pacing_rate_max_d SO_MAX_PACING_RATE
+ #define f_socket_option_peek_off_d SO_PEEK_OFF
+ #define f_socket_option_poll_busy_d SO_BUSY_POLL
+ #define f_socket_option_port_reuse_d SO_REUSEPORT
+ #define f_socket_option_priority_d SO_PRIORITY
+ #define f_socket_option_protocol_d SO_PROTOCOL
+ #define f_socket_option_receive_overflow_d SO_RXQ_OVFL
+ #define f_socket_option_route_not_d SO_DONTROUTE
+ #define f_socket_option_security_authentication_d SO_SECURITY_AUTHENTICATION
+ #define f_socket_option_security_network_d SO_SECURITY_ENCRYPTION_NETWORK
+ #define f_socket_option_security_pass_d SO_PASSSEC
+ #define f_socket_option_security_peer_d SO_PEERSEC
+ #define f_socket_option_security_transport_d SO_SECURITY_ENCRYPTION_TRANSPORT
+ #define f_socket_option_select_error_queue_d SO_SELECT_ERR_QUEUE
+ #define f_socket_option_time_out_receive_d SO_RCVTIMEO
+ #define f_socket_option_time_out_send_d SO_SNDTIMEO
+ #define f_socket_option_time_stamp_d SO_TIMESTAMP
+ #define f_socket_option_time_stamp_namespace_d SO_TIMESTAMPNS
+ #define f_socket_option_time_stamping_d SO_TIMESTAMPING
+ #define f_socket_option_time_stamping_packet_d SCM_TIMESTAMPING_PKTINFO
+ #define f_socket_option_time_stamping_stats_d SCM_TIMESTAMPING_OPT_STATS
+ #define f_socket_option_time_transmit_d SO_TXTIME
+ #define f_socket_option_type_d SO_TYPE
+ #define f_socket_option_wifi_status_d SO_WIFI_STATUS
+ #define f_socket_option_zero_copy_d SO_ZEROCOPY
+#endif // _di_f_socket_options_
+
+/**
+ * Socket Flags.
+ *
+ * These are flags to pass to either socket receive or socket send functions.
+ *
+ * f_socket_flag_*:
+ * - close_on_exit: Set the close on exit flag for a UNIX socket.
+ * - confirm: Inform the network layer that "forward process" happened.
+ * - error_queue: Designate that queue errors should be received from the socket error queue.
+ * - more: Designate that there is more data to send.
+ * - out_of_band: Enable receiving out of band data.
+ * - peek: Process data from the queue without popping it off the stack.
+ * - record_end: Designate end of record, terminating a sequence.
+ * - route_not: Do not use a gateway to send this packet.
+ * - signal_not: Do not send SIGPIPE signal if remote end closed the connection in a stream oriented connection.
+ * - truncate: Return real length of the packet even if it is truncated to fit into the buffer.
+ * - wait_all: Block until the full request is satisfied.
+ * - wait_not: Use non-blocking.
+ */
+#ifndef _di_f_socket_flags_
+ #define f_socket_flag_close_on_exit_d MSG_CMSG_CLOEXEC
+ #define f_socket_flag_confirm_d MSG_CONFIRM
+ #define f_socket_flag_error_queue_d MSG_ERRQUEUE
+ #define f_socket_flag_more_d MSG_MORE
+ #define f_socket_flag_out_of_band_d MSG_OOB
+ #define f_socket_flag_peek_d MSG_PEEK
+ #define f_socket_flag_record_end_d MSG_EOR
+ #define f_socket_flag_route_not_d MSG_DONTROUTE
+ #define f_socket_flag_signal_not_d MSG_NOSIGNAL
+ #define f_socket_flag_truncate_d MSG_TRUNC
+ #define f_socket_flag_wait_all_d MSG_WAITALL
+ #define f_socket_flag_wait_not_d MSG_DONTWAIT
+#endif // _di_f_socket_flags_
+
+/**
+ * Socket Message Flags.
+ *
+ * These represent responses from socket messages (see recvmsg()).
+ *
+ * f_socket_message_flag_*:
+ * - error_queue: No data received but extended error from the socket error queue is received.
+ * - out_of_band: The message is expedited or out of band data is received.
+ * - record_end: End of record reached.
+ * - truncate: The data has been truncated due to lack of space in the buffer.
+ * - truncate_control: The control data has been truncated due to lack of space in the buffer.
+ */
+#ifndef _di_f_socket_message_flags_
+ #define f_socket_message_flag_error_queue_d MSG_ERRQUEUE
+ #define f_socket_message_flag_out_of_band_d MSG_OOB
+ #define f_socket_message_flag_record_end_d MSG_EOR
+ #define f_socket_message_flag_truncate_d MSG_TRUNC
+ #define f_socket_message_flag_truncate_control_d MSG_CTRUNC
+#endif // _di_f_socket_flags_
+
+/**
* Socket types.
*
* f_socket_type_*:
#endif
#ifndef _di_f_socket_accept_
- f_status_t f_socket_accept(f_socket_t * const socket) {
+ f_status_t f_socket_accept(f_socket_t * const socket, const int id) {
#ifndef _di_level_0_parameter_checking_
if (!socket) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (accept(socket->id, socket->address, &socket->length) < 0) {
+ const int result = accept(id, socket->address, &socket->length);
+
+ if (result == -1) {
if (errno == EACCES) return F_status_set_error(F_access_denied);
if (errno == EAGAIN || errno == EWOULDBLOCK) return F_status_set_error(F_block);
if (errno == EBADF) return F_status_set_error(F_file_descriptor);
if (errno == EFAULT) return F_status_set_error(F_buffer);
+ if (errno == EHOSTDOWN) return F_status_set_error(F_network_client_not);
+ if (errno == EHOSTUNREACH) return F_status_set_error(F_network_reach_client_not);
if (errno == EINTR) return F_status_set_error(F_interrupt);
if (errno == EINVAL) return F_status_set_error(F_parameter);
if (errno == EMFILE) return F_status_set_error(F_file_descriptor_max);
+ if (errno == ENETDOWN) return F_status_set_error(F_network_not);
if (errno == ENFILE) return F_status_set_error(F_file_open_max);
+ if (errno == ENETUNREACH) return F_status_set_error(F_network_reach_not);
if (errno == ENOBUFS) return F_status_set_error(F_buffer_not);
if (errno == ENOMEM) return F_status_set_error(F_memory_not);
+ if (errno == ENONET) return F_status_set_error(F_network_device_not);
+ if (errno == ENOPROTOOPT) return F_status_set_error(F_option_not);
if (errno == ENOTSOCK) return F_status_set_error(F_socket_not);
if (errno == EOPNOTSUPP) return F_status_set_error(F_stream_not);
if (errno == EPROTO) return F_status_set_error(F_protocol);
return F_status_set_error(F_failure);
}
+ socket->id = result;
+
return F_none;
}
#endif // _di_f_socket_accept_
#ifndef _di_f_socket_bind_
f_status_t f_socket_bind(const f_socket_t socket) {
- if (bind(socket.id, socket.address, socket.length) < 0) {
+ if (bind(socket.id, socket.address, socket.length) == -1) {
if (errno == EACCES) return F_status_set_error(F_access_denied);
if (errno == EADDRINUSE) return F_status_set_error(F_busy_address);
if (errno == EADDRNOTAVAIL) return F_status_set_error(F_available_not_address);
strncpy(((struct sockaddr_un *) socket.address)->sun_path, socket.name, sizeof(((struct sockaddr_un *) socket.address)->sun_path) - 1);
- if (bind(socket.id, socket.address, sizeof(struct sockaddr_un)) < 0) {
+ if (bind(socket.id, socket.address, sizeof(struct sockaddr_un)) == -1) {
if (errno == EACCES) return F_status_set_error(F_access_denied);
if (errno == EADDRINUSE) return F_status_set_error(F_busy_address);
if (errno == EADDRNOTAVAIL) return F_status_set_error(F_available_not_address);
if (connect(socket.id, socket.address, socket.length) == -1) {
if (errno == EACCES) return F_status_set_error(F_access_denied);
- if (errno == EPERM) return F_status_set_error(F_prohibited);
if (errno == EADDRINUSE) return F_status_set_error(F_busy_address);
if (errno == EADDRNOTAVAIL) return F_status_set_error(F_available_not_address);
if (errno == EAFNOSUPPORT) return F_status_set_error(F_domain_not);
if (errno == EISCONN) return F_status_set_error(F_connect);
if (errno == ENETUNREACH) return F_status_set_error(F_network_reach_not);
if (errno == ENOTSOCK) return F_status_set_error(F_socket_not);
+ if (errno == EPERM) return F_status_set_error(F_prohibited);
if (errno == EPROTONOSUPPORT) return F_status_set_error(F_protocol_not);
if (errno == ETIMEDOUT) return F_status_set_error(F_time_out);
return F_status_set_error(F_supported_not);
}
- if (result < 0) {
+ if (result == -1) {
// According to man pages, retrying close() after another close on error is invalid on Linux because Linux releases the descriptor before stages that cause failures.
if (errno != EBADF && errno != EINTR) {
if (!socket) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (listen(socket->id, max_backlog) < 0) {
+ if (listen(socket->id, max_backlog) == -1) {
if (errno == EADDRINUSE) return F_status_set_error(F_busy_address);
if (errno == EBADF) return F_status_set_error(F_file_descriptor);
if (errno == ENOTSOCK) return F_status_set_error(F_socket_not);
#endif // _di_f_socket_listen_
#ifndef _di_f_socket_option_get_
- f_status_t f_socket_option_get(f_socket_t * const socket, const int level, const int type, void *value, socklen_t *length) {
+ f_status_t f_socket_option_get(f_socket_t * const socket, const int level, const int option, void *value, socklen_t *length) {
#ifndef _di_level_0_parameter_checking_
if (!socket) return F_status_set_error(F_parameter);
if (!value) return F_status_set_error(F_parameter);
if (!length) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (getsockopt(socket->id, level, type, value, length) < 0) {
+ if (getsockopt(socket->id, level, option, value, length) == -1) {
if (errno == EBADF) return F_status_set_error(F_file_descriptor);
if (errno == EFAULT) return F_status_set_error(F_buffer);
if (errno == EINVAL) return F_status_set_error(F_value);
#endif // _di_f_socket_option_get_
#ifndef _di_f_socket_option_set_
- f_status_t f_socket_option_set(f_socket_t * const socket, const int level, const int type, const void *value, const socklen_t length) {
+ f_status_t f_socket_option_set(f_socket_t * const socket, const int level, const int option, const void *value, const socklen_t length) {
#ifndef _di_level_0_parameter_checking_
if (!socket) return F_status_set_error(F_parameter);
if (!value) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (setsockopt(socket->id, level, type, value, length) < 0) {
+ if (setsockopt(socket->id, level, option, value, length) == -1) {
if (errno == EBADF) return F_status_set_error(F_file_descriptor);
if (errno == EFAULT) return F_status_set_error(F_buffer);
if (errno == EINVAL) return F_status_set_error(F_value);
}
#endif // _di_f_socket_option_set_
+#ifndef _di_f_socket_read_
+ f_status_t f_socket_read(f_socket_t * const socket, const int flags, void *buffer, size_t *length) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!socket) return F_status_set_error(F_parameter);
+ if (!buffer) return F_status_set_error(F_parameter);
+ if (!length) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ const ssize_t result = recvfrom(socket->id, buffer, *length, flags, socket->address, &socket->length);
+
+ if (result < 0) {
+ if (errno == EACCES) return F_status_set_error(F_access_denied);
+ if (errno == EAGAIN || errno == EWOULDBLOCK) return F_status_set_error(F_block);
+ if (errno == EALREADY) return F_status_set_error(F_complete_not);
+ if (errno == EBADF) return F_status_set_error(F_file_descriptor);
+ if (errno == ECONNREFUSED) return F_status_set_error(F_connect_refuse);
+ if (errno == ECONNRESET) return F_status_set_error(F_connect_reset);
+ if (errno == EDESTADDRREQ) return F_status_set_error(F_address_not);
+ if (errno == EFAULT) return F_status_set_error(F_buffer);
+ if (errno == EINTR) return F_status_set_error(F_interrupt);
+ if (errno == EINVAL) return F_status_set_error(F_parameter);
+ if (errno == ENOMEM) return F_status_set_error(F_memory_not);
+ if (errno == ENOTCONN) return F_status_set_error(F_connect_not);
+ if (errno == ENOTSOCK) return F_status_set_error(F_socket_not);
+ if (errno == EOPNOTSUPP) return F_status_set_error(F_option_not);
+ if (errno == EPERM) return F_status_set_error(F_prohibited);
+ if (errno == EPIPE) return F_status_set_error(F_pipe);
+ if (errno == ETIMEDOUT) return F_status_set_error(F_time_out);
+
+ return F_status_set_error(F_failure);
+ }
+
+ *length = (size_t) result;
+
+ return F_none;
+ }
+#endif // _di_f_socket_read_
+
+#ifndef _di_f_socket_read_message_
+ f_status_t f_socket_read_message(f_socket_t * const socket, const int flags, struct msghdr *header, size_t *length) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!socket) return F_status_set_error(F_parameter);
+ if (!header) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ const ssize_t result = recvmsg(socket->id, header, flags);
+
+ if (result < 0) {
+ if (errno == EACCES) return F_status_set_error(F_access_denied);
+ if (errno == EAGAIN || errno == EWOULDBLOCK) return F_status_set_error(F_block);
+ if (errno == EALREADY) return F_status_set_error(F_complete_not);
+ if (errno == EBADF) return F_status_set_error(F_file_descriptor);
+ if (errno == ECONNREFUSED) return F_status_set_error(F_connect_refuse);
+ if (errno == ECONNRESET) return F_status_set_error(F_connect_reset);
+ if (errno == EDESTADDRREQ) return F_status_set_error(F_address_not);
+ if (errno == EFAULT) return F_status_set_error(F_buffer);
+ if (errno == EINTR) return F_status_set_error(F_interrupt);
+ if (errno == EINVAL) return F_status_set_error(F_parameter);
+ if (errno == ENOMEM) return F_status_set_error(F_memory_not);
+ if (errno == ENOTCONN) return F_status_set_error(F_connect_not);
+ if (errno == ENOTSOCK) return F_status_set_error(F_socket_not);
+ if (errno == EOPNOTSUPP) return F_status_set_error(F_option_not);
+ if (errno == EPERM) return F_status_set_error(F_prohibited);
+ if (errno == EPIPE) return F_status_set_error(F_pipe);
+ if (errno == ETIMEDOUT) return F_status_set_error(F_time_out);
+
+
+ return F_status_set_error(F_failure);
+ }
+
+ if (length) {
+ *length = (size_t) result;
+ }
+
+ return F_none;
+ }
+#endif // _di_f_socket_read_message_
+
+#ifndef _di_f_socket_write_
+ f_status_t f_socket_write(f_socket_t * const socket, const int flags, void *buffer, size_t *length) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!socket) return F_status_set_error(F_parameter);
+ if (!buffer) return F_status_set_error(F_parameter);
+ if (!length) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ const ssize_t result = sendto(socket->id, buffer, *length, flags, socket->address, socket->length);
+
+ if (result < 0) {
+ if (errno == EACCES) return F_status_set_error(F_access_denied);
+ if (errno == EAGAIN || errno == EWOULDBLOCK) return F_status_set_error(F_block);
+ if (errno == EALREADY) return F_status_set_error(F_complete_not);
+ if (errno == EBADF) return F_status_set_error(F_file_descriptor);
+ if (errno == ECONNREFUSED) return F_status_set_error(F_connect_refuse);
+ if (errno == ECONNRESET) return F_status_set_error(F_connect_reset);
+ if (errno == EDESTADDRREQ) return F_status_set_error(F_address_not);
+ if (errno == EFAULT) return F_status_set_error(F_buffer);
+ if (errno == EINTR) return F_status_set_error(F_interrupt);
+ if (errno == EINVAL) return F_status_set_error(F_parameter);
+ if (errno == EISCONN) return F_status_set_error(F_connect);
+ if (errno == EMSGSIZE) return F_status_set_error(F_size);
+ if (errno == ENOBUFS) return F_status_set_error(F_buffer_not);
+ if (errno == ENOMEM) return F_status_set_error(F_memory_not);
+ if (errno == ENOTCONN) return F_status_set_error(F_connect_not);
+ if (errno == ENOTSOCK) return F_status_set_error(F_socket_not);
+ if (errno == EOPNOTSUPP) return F_status_set_error(F_option_not);
+ if (errno == EPERM) return F_status_set_error(F_prohibited);
+ if (errno == EPIPE) return F_status_set_error(F_pipe);
+ if (errno == ETIMEDOUT) return F_status_set_error(F_time_out);
+
+ return F_status_set_error(F_failure);
+ }
+
+ *length = (size_t) result;
+
+ return F_none;
+ }
+#endif // _di_f_socket_write_
+
+#ifndef _di_f_socket_write_message_
+ f_status_t f_socket_write_message(f_socket_t * const socket, const int flags, struct msghdr *header, size_t *length) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!socket) return F_status_set_error(F_parameter);
+ if (!header) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ const ssize_t result = sendmsg(socket->id, header, flags);
+
+ if (result < 0) {
+ if (errno == EACCES) return F_status_set_error(F_access_denied);
+ if (errno == EAGAIN || errno == EWOULDBLOCK) return F_status_set_error(F_block);
+ if (errno == EALREADY) return F_status_set_error(F_complete_not);
+ if (errno == EBADF) return F_status_set_error(F_file_descriptor);
+ if (errno == ECONNREFUSED) return F_status_set_error(F_connect_refuse);
+ if (errno == ECONNRESET) return F_status_set_error(F_connect_reset);
+ if (errno == EDESTADDRREQ) return F_status_set_error(F_address_not);
+ if (errno == EFAULT) return F_status_set_error(F_buffer);
+ if (errno == EINTR) return F_status_set_error(F_interrupt);
+ if (errno == EINVAL) return F_status_set_error(F_parameter);
+ if (errno == EISCONN) return F_status_set_error(F_connect);
+ if (errno == EMSGSIZE) return F_status_set_error(F_size);
+ if (errno == ENOBUFS) return F_status_set_error(F_buffer_not);
+ if (errno == ENOMEM) return F_status_set_error(F_memory_not);
+ if (errno == ENOTCONN) return F_status_set_error(F_connect_not);
+ if (errno == ENOTSOCK) return F_status_set_error(F_socket_not);
+ if (errno == EOPNOTSUPP) return F_status_set_error(F_option_not);
+ if (errno == EPERM) return F_status_set_error(F_prohibited);
+ if (errno == EPIPE) return F_status_set_error(F_pipe);
+ if (errno == ETIMEDOUT) return F_status_set_error(F_time_out);
+
+ return F_status_set_error(F_failure);
+ }
+
+ if (length) {
+ *length = (size_t) result;
+ }
+
+ return F_none;
+ }
+#endif // _di_f_socket_write_message_
+
#ifdef __cplusplus
} // extern "C"
#endif
#endif
/**
- * Accept a connection on a socket.
+ * Retrieve a client connection from a listening socket.
*
* @param socket
- * The socket structure.
- * The socket.length must represent the full size of the address structure.
- * The socket.length is updated with the populated size of the address structure.
- * The socket.id must refer to a valid socket file descriptor.
+ * The client socket structure.
+ * The structure should be memset as appropriate before calling this.
+ * The properties of the structure, namely socket.id, socket.address, and socket.length, are updated upon a successful return.
+ * @param id
+ * The socket file descriptor representing an actively listening socket to retrieve from.
*
* @return
* F_none on success.
* F_file_open_max (with error bit) too many open files.
* F_interrupt (with error bit) if interrupt is received.
* F_memory_not (with error bit) if out of memory.
+ * F_network_client_not (with error bit) if the client is down.
+ * F_network_device_not (with error bit) if the network device no longer exists.
+ * F_network_not (with error bit) if network is down.
+ * F_network_reach_client_not (with error bit) if the client cannot be reached.
+ * F_network_reach_not (with error bit) if the network cannot be reached.
+ * F_option_not (with error bit) if the given option is unknown or is unsupported.
* F_parameter (with error bit) if a parameter is invalid.
* F_prohibited (with error bit) if the file system does not permit this operation.
* F_protocol (with error bit) if a protocol error occurred.
* @see accept()
*/
#ifndef _di_f_socket_accept_
- extern f_status_t f_socket_accept(f_socket_t * const socket);
+ extern f_status_t f_socket_accept(f_socket_t * const socket, const int id);
#endif // _di_f_socket_accept_
/**
* @param level
* The level in which the socket option is located.
* This may be synonymous with "layer".
- * @param type
- * The type code used to represent the option name.
+ * @param option
+ * The option code used to represent the option name.
* @param value
* The value to assign.
* @param length
* @see getsockopt()
*/
#ifndef _di_f_socket_option_get_
- extern f_status_t f_socket_option_get(f_socket_t * const socket, const int level, const int type, void *value, socklen_t *length);
+ extern f_status_t f_socket_option_get(f_socket_t * const socket, const int level, const int option, void *value, socklen_t *length);
#endif // _di_f_socket_option_get_
/**
* @param level
* The level in which the socket option is located.
* This may be synonymous with "layer".
- * @param type
- * The type code used to represent the option name.
+ * @param option
+ * The option code used to represent the option name.
* @param value
* The value to assign.
* @param length
* @see setsockopt()
*/
#ifndef _di_f_socket_option_set_
- extern f_status_t f_socket_option_set(f_socket_t * const socket, const int level, const int type, const void *value, const socklen_t length);
+ extern f_status_t f_socket_option_set(f_socket_t * const socket, const int level, const int option, const void *value, const socklen_t length);
#endif // _di_f_socket_option_set_
+/**
+ * Read from a socket.
+ *
+ * @param socket
+ * The socket structure.
+ * The socket.id must represent a valid socket file descriptor.
+ * @param flags
+ * Read flags.
+ * @param buffer
+ * The buffer to populate.
+ * @param length
+ * (optional) The length of the buffer.
+ * This gets replaced with the value of a positive ssize_t representing the length read.
+ * Data may be lost if the amount of data read is larger than given buffer length.
+ * Set to NULL to not use.
+ *
+ * @return
+ * F_none on success.
+ *
+ * F_access_denied (with error bit) on access denied.
+ * F_complete_not (with error bit) if an existing connection is not yet complete.
+ * F_connect_not (with error bit) if the socket is not connected.
+ * F_connect_refuse (with error bit) if connection is refused.
+ * F_connect_reset (with error bit) if connection is reset.
+ * F_block (with error bit) if socket is blocked.
+ * F_buffer (with error bit) if the buffer is invalid.
+ * F_file_descriptor (with error bit) if id is an invalid descriptor.
+ * F_interrupt (with error bit) if interrupt is received.
+ * F_memory_not (with error bit) if out of memory.
+ * F_option_not (with error bit) if a flag is not supported.
+ * F_parameter (with error bit) if a parameter is invalid.
+ * F_pipe (with error bit) if the local end of a connection oriented socket is closed or SIGPIPE is received.
+ * F_prohibited (with error bit) if the insufficient privileges to perform read.
+ * F_socket_not (with error bit) if the id is not a socket descriptor.
+ * F_time_out (with error bit) if a timeout occurred.
+ *
+ * F_failure (with error bit) for any other error.
+ *
+ * @see recvfrom()
+ */
+#ifndef _di_f_socket_read_
+ extern f_status_t f_socket_read(f_socket_t * const socket, const int flags, void *buffer, size_t *length);
+#endif // _di_f_socket_read_
+
+/**
+ * Read a message from a socket.
+ *
+ * @param socket
+ * The socket structure.
+ * The socket.id must represent a valid socket file descriptor.
+ * @param flags
+ * Read flags.
+ * @param header
+ * The message header.
+ * @param length
+ * This gets replaced with the value of a positive ssize_t representing the length read.
+ * Data may be lost if the amount of data read is larger than given buffer length.
+ *
+ * @return
+ * F_none on success.
+ *
+ * F_access_denied (with error bit) on access denied.
+ * F_complete_not (with error bit) if an existing connection is not yet complete.
+ * F_connect_not (with error bit) if the socket is not connected.
+ * F_connect_refuse (with error bit) if connection is refused.
+ * F_connect_reset (with error bit) if connection is reset.
+ * F_block (with error bit) if socket is blocked.
+ * F_buffer (with error bit) if the buffer is invalid.
+ * F_file_descriptor (with error bit) if id is an invalid descriptor.
+ * F_interrupt (with error bit) if interrupt is received.
+ * F_memory_not (with error bit) if out of memory.
+ * F_option_not (with error bit) if a flag is not supported.
+ * F_parameter (with error bit) if a parameter is invalid.
+ * F_pipe (with error bit) if the local end of a connection oriented socket is closed or SIGPIPE is received.
+ * F_prohibited (with error bit) if the insufficient privileges to perform read.
+ * F_socket_not (with error bit) if the id is not a socket descriptor.
+ * F_time_out (with error bit) if a timeout occurred.
+ *
+ * F_failure (with error bit) for any other error.
+ *
+ * @see recvmsg()
+ */
+#ifndef _di_f_socket_read_message_
+ extern f_status_t f_socket_read_message(f_socket_t * const socket, const int flags, struct msghdr *header, size_t *length);
+#endif // _di_f_socket_read_message_
+
+/**
+ * Send to a socket.
+ *
+ * @param socket
+ * The socket structure.
+ * The socket.id must represent a valid socket file descriptor.
+ * @param flags
+ * Read flags.
+ * @param buffer
+ * The buffer to populate.
+ * @param length
+ * (optional) The length of the buffer.
+ * This gets replaced with the value of a positive ssize_t representing the length send.
+ * Data may be lost if the amount of data send is larger than given buffer length.
+ * Set to NULL to not use.
+ *
+ * @return
+ * F_none on success.
+ *
+ * F_access_denied (with error bit) on access denied.
+ * F_address_not (with error bit) if no address is provided and the connection is not "connection-mode".
+ * F_buffer_not (with error bit) if unable to send message because output buffer is full.
+ * F_complete_not (with error bit) if an existing connection is not yet complete.
+ * F_connect (with error bit) if an address is provided and the connection is "connection-mode".
+ * F_connect_not (with error bit) if the socket is not connected.
+ * F_connect_refuse (with error bit) if connection is refused.
+ * F_connect_reset (with error bit) if connection is reset.
+ * F_block (with error bit) if socket is blocked.
+ * F_buffer (with error bit) if the buffer is invalid.
+ * F_file_descriptor (with error bit) if id is an invalid descriptor.
+ * F_interrupt (with error bit) if interrupt is received.
+ * F_memory_not (with error bit) if out of memory.
+ * F_option_not (with error bit) if a flag is not supported.
+ * F_parameter (with error bit) if a parameter is invalid.
+ * F_pipe (with error bit) if the local end of a connection oriented socket is closed or SIGPIPE is received.
+ * F_prohibited (with error bit) if the insufficient privileges to perform send.
+ * F_size (with error bit) if size of message makes atomically sending message impossible on a socket type that requires this to be atomic.
+ * F_socket_not (with error bit) if the id is not a socket descriptor.
+ * F_time_out (with error bit) if a timeout occurred.
+ *
+ * F_failure (with error bit) for any other error.
+ *
+ * @see sendto()
+ */
+#ifndef _di_f_socket_write_
+ extern f_status_t f_socket_write(f_socket_t * const socket, const int flags, void *buffer, size_t *length);
+#endif // _di_f_socket_write_
+
+/**
+ * Send a message to a socket.
+ *
+ * @param socket
+ * The socket structure.
+ * The socket.id must represent a valid socket file descriptor.
+ * @param flags
+ * Read flags.
+ * @param header
+ * The message header.
+ * @param length
+ * This gets replaced with the value of a positive ssize_t representing the length send.
+ * Data may be lost if the amount of data send is larger than given buffer length.
+ *
+ * @return
+ * F_none on success.
+ *
+ * F_access_denied (with error bit) on access denied.
+ * F_address_not (with error bit) if no address is provided and the connection is not "connection-mode".
+ * F_buffer_not (with error bit) if unable to send message because output buffer is full.
+ * F_complete_not (with error bit) if an existing connection is not yet complete.
+ * F_connect (with error bit) if an address is provided and the connection is "connection-mode".
+ * F_connect_not (with error bit) if the socket is not connected.
+ * F_connect_refuse (with error bit) if connection is refused.
+ * F_connect_reset (with error bit) if connection is reset.
+ * F_block (with error bit) if socket is blocked.
+ * F_buffer (with error bit) if the buffer is invalid.
+ * F_file_descriptor (with error bit) if id is an invalid descriptor.
+ * F_interrupt (with error bit) if interrupt is received.
+ * F_memory_not (with error bit) if out of memory.
+ * F_option_not (with error bit) if a flag is not supported.
+ * F_parameter (with error bit) if a parameter is invalid.
+ * F_pipe (with error bit) if the local end of a connection oriented socket is closed or SIGPIPE is received.
+ * F_prohibited (with error bit) if the insufficient privileges to perform send.
+ * F_size (with error bit) if size of message makes atomically sending message impossible on a socket type that requires this to be atomic.
+ * F_socket_not (with error bit) if the id is not a socket descriptor.
+ * F_time_out (with error bit) if a timeout occurred.
+ *
+ * F_failure (with error bit) for any other error.
+ *
+ * @see sendmsg()
+ */
+#ifndef _di_f_socket_write_message_
+ extern f_status_t f_socket_write_message(f_socket_t * const socket, const int flags, struct msghdr *header, size_t *length);
+#endif // _di_f_socket_write_message_
+
#ifdef __cplusplus
} // extern "C"
#endif
F_address_not,
F_ascii,
F_ascii_not,
+ F_atomic,
+ F_atomic_not,
F_begin,
F_begin_not,
F_block,
F_connect,
F_connect_not,
F_connect_refuse,
+ F_connect_reset,
F_container,
F_container_not,
F_continue,
F_maybe_not,
F_memory,
F_memory_not,
+ F_message,
+ F_message_not,
F_minor,
F_minor_not,
F_moderate,
F_schedule_not,
F_signal,
F_signal_not,
+ F_size,
+ F_size_not,
F_space,
F_space_not,
F_start,
F_network,
F_network_busy,
F_network_busy_not,
+ F_network_client,
+ F_network_client_not,
+ F_network_device,
+ F_network_device_not,
F_network_found,
F_network_found_not,
F_network_lost,
F_network_lost_not,
F_network_not,
F_network_reach,
+ F_network_reach_client,
+ F_network_reach_client_not,
F_network_reach_not,
+ F_network_reach_server,
+ F_network_reach_server_not,
+ F_network_server,
+ F_network_server_not,
F_network_time,
F_network_time_not,
#endif // _di_F_status_network_
const f_string_t f_status_address_not_s = F_status_address_not_s;
const f_string_t f_status_ascii_s = F_status_ascii_s;
const f_string_t f_status_ascii_not_s = F_status_ascii_not_s;
+ const f_string_t f_status_atomic_s = F_status_atomic_s;
+ const f_string_t f_status_atomic_not_s = F_status_atomic_not_s;
const f_string_t f_status_begin_s = F_status_begin_s;
const f_string_t f_status_begin_not_s = F_status_begin_not_s;
const f_string_t f_status_block_s = F_status_block_s;
const f_string_t f_status_connect_s = F_status_connect_s;
const f_string_t f_status_connect_not_s = F_status_connect_not_s;
const f_string_t f_status_connect_refuse_s = F_status_connect_refuse_s;
+ const f_string_t f_status_connect_reset_s = F_status_connect_reset_s;
const f_string_t f_status_container_s = F_status_container_s;
const f_string_t f_status_container_not_s = F_status_container_not_s;
const f_string_t f_status_continue_s = F_status_continue_s;
const f_string_t f_status_maybe_not_s = F_status_maybe_not_s;
const f_string_t f_status_memory_s = F_status_memory_s;
const f_string_t f_status_memory_not_s = F_status_memory_not_s;
+ const f_string_t f_status_message_s = F_status_message_s;
+ const f_string_t f_status_message_not_s = F_status_message_not_s;
const f_string_t f_status_minor_s = F_status_minor_s;
const f_string_t f_status_minor_not_s = F_status_minor_not_s;
const f_string_t f_status_moderate_s = F_status_moderate_s;
const f_string_t f_status_search_not_s = F_status_search_not_s;
const f_string_t f_status_schedule_s = F_status_schedule_s;
const f_string_t f_status_schedule_not_s = F_status_schedule_not_s;
+ const f_string_t f_status_size_s = F_status_size_s;
+ const f_string_t f_status_size_not_s = F_status_size_not_s;
const f_string_t f_status_signal_s = F_status_signal_s;
const f_string_t f_status_signal_not_s = F_status_signal_not_s;
const f_string_t f_status_space_s = F_status_space_s;
const f_string_t f_status_network_s = F_status_network_s;
const f_string_t f_status_network_busy_s = F_status_network_busy_s;
const f_string_t f_status_network_busy_not_s = F_status_network_busy_not_s;
+ const f_string_t f_status_network_client_s = F_status_network_client_s;
+ const f_string_t f_status_network_client_not_s = F_status_network_client_not_s;
+ const f_string_t f_status_network_device_s = F_status_network_device_s;
+ const f_string_t f_status_network_device_not_s = F_status_network_device_not_s;
const f_string_t f_status_network_found_s = F_status_network_found_s;
const f_string_t f_status_network_found_not_s = F_status_network_found_not_s;
const f_string_t f_status_network_lost_s = F_status_network_lost_s;
const f_string_t f_status_network_lost_not_s = F_status_network_lost_not_s;
const f_string_t f_status_network_not_s = F_status_network_not_s;
const f_string_t f_status_network_reach_s = F_status_network_reach_s;
+ const f_string_t f_status_network_reach_client_s = F_status_network_reach_client_s;
+ const f_string_t f_status_network_reach_client_not_s = F_status_network_reach_client_not_s;
const f_string_t f_status_network_reach_not_s = F_status_network_reach_not_s;
+ const f_string_t f_status_network_reach_server_s = F_status_network_reach_server_s;
+ const f_string_t f_status_network_reach_server_not_s = F_status_network_reach_server_not_s;
+ const f_string_t f_status_network_server_s = F_status_network_server_s;
+ const f_string_t f_status_network_server_not_s = F_status_network_server_not_s;
const f_string_t f_status_network_time_s = F_status_network_time_s;
const f_string_t f_status_network_time_not_s = F_status_network_time_not_s;
#endif // _di_F_status_network_
*string = f_status_ascii_not_s;
break;
+ case F_atomic:
+ *string = f_status_atomic_s;
+ break;
+
+ case F_atomic_not:
+ *string = f_status_atomic_not_s;
+ break;
+
case F_begin:
*string = f_status_begin_s;
break;
*string = f_status_connect_refuse_s;
break;
+ case F_connect_reset:
+ *string = f_status_connect_reset_s;
+ break;
+
case F_continue:
*string = f_status_continue_s;
break;
*string = f_status_memory_not_s;
break;
+ case F_message:
+ *string = f_status_message_s;
+ break;
+
+ case F_message_not:
+ *string = f_status_message_not_s;
+ break;
+
case F_minor:
*string = f_status_minor_s;
break;
*string = f_status_schedule_not_s;
break;
+ case F_size:
+ *string = f_status_size_s;
+ break;
+
+ case F_size_not:
+ *string = f_status_size_not_s;
+ break;
+
case F_signal:
*string = f_status_signal_s;
break;
*string = f_status_network_busy_not_s;
break;
+ case F_network_client:
+ *string = f_status_network_client_s;
+ break;
+
+ case F_network_client_not:
+ *string = f_status_network_client_not_s;
+ break;
+
+ case F_network_device:
+ *string = f_status_network_device_s;
+ break;
+
+ case F_network_device_not:
+ *string = f_status_network_device_not_s;
+ break;
+
case F_network_found:
*string = f_status_network_found_s;
break;
*string = f_status_network_reach_s;
break;
+ case F_network_reach_client:
+ *string = f_status_network_reach_client_s;
+ break;
+
+ case F_network_reach_client_not:
+ *string = f_status_network_reach_client_not_s;
+ break;
+
case F_network_reach_not:
*string = f_status_network_reach_not_s;
break;
+ case F_network_reach_server:
+ *string = f_status_network_reach_server_s;
+ break;
+
+ case F_network_reach_server_not:
+ *string = f_status_network_reach_server_not_s;
+ break;
+
+ case F_network_server:
+ *string = f_status_network_server_s;
+ break;
+
+ case F_network_server_not:
+ *string = f_status_network_server_not_s;
+ break;
+
case F_network_time:
*string = f_status_network_time_s;
break;
#define F_status_address_not_s "F_address_not"
#define F_status_ascii_s "F_ascii"
#define F_status_ascii_not_s "F_ascii_not"
+ #define F_status_atomic_s "F_atomic"
+ #define F_status_atomic_not_s "F_atomic_not"
#define F_status_begin_s "F_begin"
#define F_status_begin_not_s "F_begin_not"
#define F_status_block_s "F_block"
#define F_status_connect_s "F_connect"
#define F_status_connect_not_s "F_connect_not"
#define F_status_connect_refuse_s "F_connect_refuse"
+ #define F_status_connect_reset_s "F_connect_reset"
#define F_status_container_s "F_container"
#define F_status_container_not_s "F_container_not"
#define F_status_continue_s "F_continue"
#define F_status_maybe_not_s "F_maybe_not"
#define F_status_memory_s "F_memory"
#define F_status_memory_not_s "F_memory_not"
+ #define F_status_message_s "F_message"
+ #define F_status_message_not_s "F_message_not"
#define F_status_minor_s "F_minor"
#define F_status_minor_not_s "F_minor_not"
#define F_status_moderate_s "F_moderate"
#define F_status_search_not_s "F_search_not"
#define F_status_schedule_s "F_schedule"
#define F_status_schedule_not_s "F_schedule_not"
+ #define F_status_size_s "F_size"
+ #define F_status_size_not_s "F_size_not"
#define F_status_signal_s "F_signal"
#define F_status_signal_not_s "F_signal_not"
#define F_status_space_s "F_space"
#define F_status_address_not_s_length 13
#define F_status_ascii_s_length 7
#define F_status_ascii_not_s_length 11
+ #define F_status_atomic_s_length 8
+ #define F_status_atomic_not_s_length 12
#define F_status_begin_s_length 7
#define F_status_begin_not_s_length 11
#define F_status_block_s_length 7
#define F_status_connect_s_length 9
#define F_status_connect_not_s_length 13
#define F_status_connect_refuse_s_length 16
+ #define F_status_connect_reset_s_length 15
#define F_status_container_s_length 11
#define F_status_container_not_s_length 15
#define F_status_continue_s_length 10
#define F_status_maybe_not_s_length 11
#define F_status_memory_s_length 8
#define F_status_memory_not_s_length 12
+ #define F_status_message_s_length 9
+ #define F_status_message_not_s_length 13
#define F_status_minor_s_length 7
#define F_status_minor_not_s_length 11
#define F_status_moderate_s_length 10
#define F_status_search_not_s_length 12
#define F_status_schedule_s_length 10
#define F_status_schedule_not_s_length 14
+ #define F_status_size_s_length 6
+ #define F_status_size_not_s_length 10
#define F_status_signal_s_length 8
#define F_status_signal_not_s_length 12
#define F_status_space_s_length 7
extern const f_string_t f_status_address_not_s;
extern const f_string_t f_status_ascii_s;
extern const f_string_t f_status_ascii_not_s;
+ extern const f_string_t f_status_atomic_s;
+ extern const f_string_t f_status_atomic_not_s;
extern const f_string_t f_status_begin_s;
extern const f_string_t f_status_begin_not_s;
extern const f_string_t f_status_block_s;
extern const f_string_t f_status_connect_s;
extern const f_string_t f_status_connect_not_s;
extern const f_string_t f_status_connect_refuse_s;
+ extern const f_string_t f_status_connect_reset_s;
extern const f_string_t f_status_container_s;
extern const f_string_t f_status_container_not_s;
extern const f_string_t f_status_continue_s;
extern const f_string_t f_status_maybe_not_s;
extern const f_string_t f_status_memory_s;
extern const f_string_t f_status_memory_not_s;
+ extern const f_string_t f_status_message_s;
+ extern const f_string_t f_status_message_not_s;
extern const f_string_t f_status_minor_s;
extern const f_string_t f_status_minor_not_s;
extern const f_string_t f_status_moderate_s;
extern const f_string_t f_status_search_not_s;
extern const f_string_t f_status_schedule_s;
extern const f_string_t f_status_schedule_not_s;
+ extern const f_string_t f_status_size_s;
+ extern const f_string_t f_status_size_not_s;
extern const f_string_t f_status_signal_s;
extern const f_string_t f_status_signal_not_s;
extern const f_string_t f_status_space_s;
#endif // _di_F_status_busy_
#ifndef _di_F_status_network_
- #define F_status_network_s "F_network"
- #define F_status_network_busy_s "F_network_busy"
- #define F_status_network_busy_not_s "F_network_busy_not"
- #define F_status_network_found_s "F_network_found"
- #define F_status_network_found_not_s "F_network_found_not"
- #define F_status_network_lost_s "F_network_lost"
- #define F_status_network_lost_not_s "F_network_lost_not"
- #define F_status_network_not_s "F_network_not"
- #define F_status_network_reach_s "F_network_reach"
- #define F_status_network_reach_not_s "F_network_reach_not"
- #define F_status_network_time_s "F_network_time"
- #define F_status_network_time_not_s "F_network_time_not"
+ #define F_status_network_s "F_network"
+ #define F_status_network_busy_s "F_network_busy"
+ #define F_status_network_busy_not_s "F_network_busy_not"
+ #define F_status_network_client_s "F_network_client"
+ #define F_status_network_client_not_s "F_network_client_not"
+ #define F_status_network_device_s "F_network_device"
+ #define F_status_network_device_not_s "F_network_device_not"
+ #define F_status_network_found_s "F_network_found"
+ #define F_status_network_found_not_s "F_network_found_not"
+ #define F_status_network_lost_s "F_network_lost"
+ #define F_status_network_lost_not_s "F_network_lost_not"
+ #define F_status_network_not_s "F_network_not"
+ #define F_status_network_reach_s "F_network_reach"
+ #define F_status_network_reach_client_s "F_network_reach_client"
+ #define F_status_network_reach_client_not_s "F_network_reach_client_not"
+ #define F_status_network_reach_not_s "F_network_reach_not"
+ #define F_status_network_reach_server_s "F_network_reach_server"
+ #define F_status_network_reach_server_not_s "F_network_reach_server_not"
+ #define F_status_network_server_s "F_network_server"
+ #define F_status_network_server_not_s "F_network_server_not"
+ #define F_status_network_time_s "F_network_time"
+ #define F_status_network_time_not_s "F_network_time_not"
- #define F_status_network_s_length 9
- #define F_status_network_busy_s_length 14
- #define F_status_network_busy_not_s_length 18
- #define F_status_network_found_s_length 15
- #define F_status_network_found_not_s_length 19
- #define F_status_network_lost_s_length 14
- #define F_status_network_lost_not_s_length 18
- #define F_status_network_not_s_length 13
- #define F_status_network_reach_s_length 15
- #define F_status_network_reach_not_s_length 19
- #define F_status_network_time_s_length 14
- #define F_status_network_time_not_s_length 18
+ #define F_status_network_s_length 9
+ #define F_status_network_busy_s_length 14
+ #define F_status_network_busy_not_s_length 18
+ #define F_status_network_client_s_length 16
+ #define F_status_network_client_not_s_length 20
+ #define F_status_network_device_s_length 16
+ #define F_status_network_device_not_s_length 20
+ #define F_status_network_found_s_length 15
+ #define F_status_network_found_not_s_length 19
+ #define F_status_network_lost_s_length 14
+ #define F_status_network_lost_not_s_length 18
+ #define F_status_network_not_s_length 13
+ #define F_status_network_reach_s_length 15
+ #define F_status_network_reach_client_s_length 22
+ #define F_status_network_reach_client_not_s_length 26
+ #define F_status_network_reach_not_s_length 19
+ #define F_status_network_reach_server_s_length 22
+ #define F_status_network_reach_server_not_s_length 26
+ #define F_status_network_server_s_length 16
+ #define F_status_network_server_not_s_length 20
+ #define F_status_network_time_s_length 14
+ #define F_status_network_time_not_s_length 18
extern const f_string_t f_status_network_s;
extern const f_string_t f_status_network_busy_s;
extern const f_string_t f_status_network_busy_not_s;
+ extern const f_string_t f_status_network_client_s;
+ extern const f_string_t f_status_network_client_not_s;
+ extern const f_string_t f_status_network_device_s;
+ extern const f_string_t f_status_network_device_not_s;
extern const f_string_t f_status_network_found_s;
extern const f_string_t f_status_network_found_not_s;
extern const f_string_t f_status_network_lost_s;
extern const f_string_t f_status_network_lost_not_s;
extern const f_string_t f_status_network_not_s;
extern const f_string_t f_status_network_reach_s;
+ extern const f_string_t f_status_network_reach_client_s;
+ extern const f_string_t f_status_network_reach_client_not_s;
extern const f_string_t f_status_network_reach_not_s;
+ extern const f_string_t f_status_network_reach_server_s;
+ extern const f_string_t f_status_network_reach_server_not_s;
+ extern const f_string_t f_status_network_server_s;
+ extern const f_string_t f_status_network_server_not_s;
extern const f_string_t f_status_network_time_s;
extern const f_string_t f_status_network_time_not_s;
#endif // _di_F_status_network_
return F_none;
}
+ if (fl_string_compare(string, f_status_atomic_s, length, F_status_atomic_s_length) == F_equal_to) {
+ *code = F_atomic;
+
+ return F_none;
+ }
+
+ if (fl_string_compare(string, f_status_atomic_not_s, length, F_status_atomic_not_s_length) == F_equal_to) {
+ *code = F_atomic_not;
+
+ return F_none;
+ }
+
if (fl_string_compare(string, f_status_begin_s, length, F_status_begin_s_length) == F_equal_to) {
*code = F_begin;
return F_none;
}
+ if (fl_string_compare(string, f_status_connect_reset_s, length, F_status_connect_reset_s_length) == F_equal_to) {
+ *code = F_connect_reset;
+
+ return F_none;
+ }
+
if (fl_string_compare(string, f_status_container_s, length, F_status_container_s_length) == F_equal_to) {
*code = F_container;
return F_none;
}
+ if (fl_string_compare(string, f_status_message_s, length, F_status_message_s_length) == F_equal_to) {
+ *code = F_message;
+
+ return F_none;
+ }
+
+ if (fl_string_compare(string, f_status_message_not_s, length, F_status_message_not_s_length) == F_equal_to) {
+ *code = F_message_not;
+
+ return F_none;
+ }
+
if (fl_string_compare(string, f_status_minor_s, length, F_status_minor_s_length) == F_equal_to) {
*code = F_minor;
return F_none;
}
+ if (fl_string_compare(string, f_status_size_s, length, F_status_size_s_length) == F_equal_to) {
+ *code = F_size;
+
+ return F_none;
+ }
+
+ if (fl_string_compare(string, f_status_size_not_s, length, F_status_size_not_s_length) == F_equal_to) {
+ *code = F_size_not;
+
+ return F_none;
+ }
+
if (fl_string_compare(string, f_status_signal_s, length, F_status_signal_s_length) == F_equal_to) {
*code = F_signal;
return F_none;
}
+ if (fl_string_compare(string, f_status_network_client_s, length, F_status_network_client_s_length) == F_equal_to) {
+ *code = F_network_client;
+
+ return F_none;
+ }
+
+ if (fl_string_compare(string, f_status_network_client_not_s, length, F_status_network_client_not_s_length) == F_equal_to) {
+ *code = F_network_client_not;
+
+ return F_none;
+ }
+
+ if (fl_string_compare(string, f_status_network_device_s, length, F_status_network_device_s_length) == F_equal_to) {
+ *code = F_network_device;
+
+ return F_none;
+ }
+
+ if (fl_string_compare(string, f_status_network_device_not_s, length, F_status_network_device_not_s_length) == F_equal_to) {
+ *code = F_network_device_not;
+
+ return F_none;
+ }
+
if (fl_string_compare(string, f_status_network_found_s, length, F_status_network_found_s_length) == F_equal_to) {
*code = F_network_found;
return F_none;
}
+ if (fl_string_compare(string, f_status_network_reach_client_s, length, F_status_network_reach_client_s_length) == F_equal_to) {
+ *code = F_network_reach_client;
+
+ return F_none;
+ }
+
+ if (fl_string_compare(string, f_status_network_reach_client_not_s, length, F_status_network_reach_client_not_s_length) == F_equal_to) {
+ *code = F_network_reach_client_not;
+
+ return F_none;
+ }
+
if (fl_string_compare(string, f_status_network_reach_not_s, length, F_status_network_reach_not_s_length) == F_equal_to) {
*code = F_network_reach_not;
return F_none;
}
+ if (fl_string_compare(string, f_status_network_reach_server_s, length, F_status_network_reach_server_s_length) == F_equal_to) {
+ *code = F_network_reach_server;
+
+ return F_none;
+ }
+
+ if (fl_string_compare(string, f_status_network_reach_server_not_s, length, F_status_network_reach_server_not_s_length) == F_equal_to) {
+ *code = F_network_reach_server_not;
+
+ return F_none;
+ }
+
+ if (fl_string_compare(string, f_status_network_server_s, length, F_status_network_server_s_length) == F_equal_to) {
+ *code = F_network_server;
+
+ return F_none;
+ }
+
+ if (fl_string_compare(string, f_status_network_server_not_s, length, F_status_network_server_not_s_length) == F_equal_to) {
+ *code = F_network_server_not;
+
+ return F_none;
+ }
+
if (fl_string_compare(string, f_status_network_time_s, length, F_status_network_time_s_length) == F_equal_to) {
*code = F_network_time;