<commit_before>/**
 * @file
 * @brief Socket options handling.
 *
 * @date 16.04.12
 * @author <NAME>
 */


#include <errno.h>
#include <string.h>
#include <net/socket.h>
#include <net/net.h>

/**
 * default stream type socket options set
 */
static const struct socket_opt_state DEFAULT_STREAM_OPTS = {
	.so_acceptconn = 0,  /* posix doesn't specify default value, we'll turn it off */
	.so_broadcast = 0,   /* and it shouldn't be able to broadcast. dgram should */
	.so_debug = 0,       /* no debug */
	.so_dontroute = 0,	 /* no dontroute flag */
	.so_error = 0,       /* no error happened yet =) */
	.so_keepalive = 0,   /* no keepalive's */
	.so_linger = {.l_onoff = 0, .l_linger = 0}, /* linger is off */
	.so_oobinline = 0,   /*  */
	.so_rcvbuf = DEFAULT_RCVBUF,
	.so_rcvlowat = DEFAULT_RCVLOWAT,
	.so_rcvtimeo = DEFAULT_TIMEO,  /* default timeo zeros */
	.so_reuseaddr = 0,  /* TCP servers should set */
	.so_sndbuf = DEFAULT_SNDBUF,
	.so_sndlowat = DEFAULT_SNDLOWAT,
	.so_rcvtimeo = DEFAULT_TIMEO,  /* default timeo zeros */
	.so_type = SOCK_STREAM,  /* stream socket =) */
};

/**
 * default dgram type socket options set
 */
static const struct socket_opt_state DEFAULT_DGRAM_OPTS = {
	.so_acceptconn = 0,
	.so_broadcast = 1,   /* and it should be able to broadcast.*/
	.so_debug = 0,       /* no debug */
	.so_dontroute = 0,	 /* no dontroute flag */
	.so_error = 0,       /* no error happened yet =) */
	.so_keepalive = 0,   /* no keepalive's */
	.so_linger = {.l_onoff = 0, .l_linger = 0}, /* linger is off */
	.so_oobinline = 0,   /*  */
	.so_rcvbuf = DEFAULT_RCVBUF,
	.so_rcvlowat = DEFAULT_RCVLOWAT,
	.so_rcvtimeo = DEFAULT_TIMEO,  /* default timeo zeros */
	.so_reuseaddr = 0,  /* TCP servers should set */
	.so_sndbuf = DEFAULT_SNDBUF,
	.so_sndlowat = DEFAULT_SNDLOWAT,
	.so_rcvtimeo = DEFAULT_TIMEO,  /* default timeo zeros */
	.so_type = SOCK_DGRAM,  /* stream socket =) */<commit_msg>net: socket options. small corrections for defaults<commit_after>/**
 * @file
 * @brief Socket options handling.
 *
 * @date 16.04.12
 * @author <NAME>
 */


#include <errno.h>
#include <string.h>
#include <net/socket.h>
#include <net/net.h>

/**
 * default stream type socket options set
 */
static const struct socket_opt_state DEFAULT_STREAM_OPTS = {
	.so_acceptconn = 0,  /* posix doesn't specify default value, we'll turn it off */
	.so_broadcast = 0,   /* posix default */
	.so_debug = 0,       /* no debug. posix default */
	.so_dontroute = 0,	 /* no dontroute flag */
	.so_error = 0,       /* no error happened yet =) */
	.so_keepalive = 0,   /* no keepalive's. posix default */
	.so_linger = {.l_onoff = 0, .l_linger = 0}, /* linger is off. posix default */
	.so_oobinline = 0,   /* out of band data placement off. posix default */
	.so_rcvbuf = DEFAULT_RCVBUF,
	.so_rcvlowat = DEFAULT_RCVLOWAT,
	.so_rcvtimeo = DEFAULT_TIMEO,  /* no timeout. posix default*/
	.so_reuseaddr = 0,  /* TCP servers should set.  posix default */
	.so_sndbuf = DEFAULT_SNDBUF,
	.so_sndlowat = DEFAULT_SNDLOWAT,
	.so_rcvtimeo = DEFAULT_TIMEO,  /* no timeout.  posix default */
	.so_type = SOCK_STREAM,  /* stream socket =) */
};

/**
 * default dgram type socket options set
 */
static const struct socket_opt_state DEFAULT_DGRAM_OPTS = {
	.so_acceptconn = 0,
	.so_broadcast = 0,   /* posix specifies default value as 0*/
	.so_debug = 0,       /* no debug. posix default */
	.so_dontroute = 0,	 /* no dontroute flag */
	.so_error = 0,       /* no error happened yet =) */
	.so_keepalive = 0,   /* no keepalive's. posix default */
	.so_linger = {.l_onoff = 0, .l_linger = 0}, /* linger is off. posix default */
	.so_oobinline = 0,   /* out of band data placement off. posix default */
	.so_rcvbuf = DEFAULT_RCVBUF,
	.so_rcvlowat = DEFAULT_RCVLOWAT,
	.so_rcvtimeo = DEFAULT_TIMEO,  /* no timeout.  posix default */
	.so_reuseaddr = 0,  /* TCP servers should set.  posix default */
	.so_sndbuf = DEFAULT_SNDBUF,
	.so_sndlowat = DEFAULT_SNDLOWAT,
	.so_rcvtimeo = DEFAULT_TIMEO,  /* no timeout.  posix default */
	.so_type = SOCK_DGRAM,  /* stream socket =) */
{'fraction_non_alphanumeric': 0.13967861557478367, 'fraction_numerical': 0.013102595797280594, 'mean_word_length': 2.990138067061144, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6489078', 'n_tokens_mistral': 1619, 'n_tokens_neox': 1537, 'n_words': 408}