<commit_before>/**
 * @file  ARNETWORKAL_WifiNetwork.h
 * @brief private headers of Wifi network manager allow to send over wifi network.
 * @date 04/29/2013
 * @author <EMAIL>
 */

#ifndef _ARNETWORKAL_WIFINETWORK_PRIVATE_H_
#define _ARNETWORKAL_WIFINETWORK_PRIVATE_H_

#if defined(__APPLE__) && defined(__MACH__)
#include <TargetConditionals.h>
/* Stupid iOS */
#if TARGET_OS_IPHONE == 1
#include <netinet/ip.h>
#else
#include <netinet/ip.h>
#include <netinet/udp.h>
#endif
#else
#include <netinet/ip.h>
#include <netinet/udp.h>
#endif

#include <libARNetworkAL/ARNETWORKAL_Manager.h>

/** Maximum network buffer size.
 * It corresponds to the maximum amount of data you can put in a single UDP datagram.
 */
#if defined(__APPLE__) && defined(__MACH__)
#include <TargetConditionals.h>
#if TARGET_OS_IPHONE == 1
/* Use hardcoded UDP header size because iOS SDK sucks and does not contains the netinet/udp.h header. */
#define ARNETWORKAL_WIFINETWORK_MAX_BUFFER_SIZE         (IP_MAXPACKET - 8)
#else
#define ARNETWORKAL_WIFINETWORK_MAX_BUFFER_SIZE         (IP_MAXPACKET - sizeof(struct udphdr))
#endif
#else
#define ARNETWORKAL_WIFINETWORK_MAX_BUFFER_SIZE         (IP_MAXPACKET - sizeof(struct udphdr))
#endif

/**
 * @brief Create a new WifiNetwork object.
 * @warning This function allocate memory
 * @post ARNETWORKAL_WifiNetwork_Delete() must be called to delete the wifi network and free the memory allocated.
 * @param[in] manager pointer on the Manager
 * @return eARNETWORKAL_ERROR
 * @see ARNETWORKAL_WifiNetwork_Delete()
 */
eARNETWORKAL_ERROR ARNETWORKAL_WifiNetwork_New (ARNETWORKAL_Manager_t *manager);

/**
 * @brief Signal the Manager to stop all sockets blocking operations
 * @param[in] manager pointer on the Manager
 * @return eARNETWORKAL_ERROR
 */
eARNETWORKAL_ERROR ARNETWORKAL_WifiNetwork_Signal(ARNETWORKAL_Manager_t *manager);

/**
 * @brief Gets the bandwith of the network
 * @param[in] manager pointer on the Manager
 * @param[out] pointer which will hold the upload bandwidth, in bytes per second (optionnal, can be NULL)
 * @param[out] pointer which will hold the download bandwidth, in bytes per second (optionnal, can be NULL)
 * @return error see ::eARNETWORKAL_ERROR
 */
eARNETWORKAL_ERROR ARNETWORKAL_WifiNetwork_GetBandwidth (ARNETWORKAL_Manager_t *manager, uint32_t *uploadBw, uint32_t *downloadBw);

/**
 * @brief Thread entry point for the bandwidth measurement.
 * @param manager pointer on the Manager, casted as void *
 * @return always returns (void *)0<commit_msg>Remove iOS-specific checks for UDP header size.<commit_after>/**
 * @file  ARNETWORKAL_WifiNetwork.h
 * @brief private headers of Wifi network manager allow to send over wifi network.
 * @date 04/29/2013
 * @author <EMAIL>
 */

#ifndef _ARNETWORKAL_WIFINETWORK_PRIVATE_H_
#define _ARNETWORKAL_WIFINETWORK_PRIVATE_H_

#include <netinet/ip.h>

#include <libARNetworkAL/ARNETWORKAL_Manager.h>

#define UDP_HEADER_SIZE 8

/** Maximum network buffer size.
 * It corresponds to the maximum amount of data you can put in a single UDP datagram.
 */
#define ARNETWORKAL_WIFINETWORK_MAX_BUFFER_SIZE         (IP_MAXPACKET - UDP_HEADER_SIZE)

/**
 * @brief Create a new WifiNetwork object.
 * @warning This function allocate memory
 * @post ARNETWORKAL_WifiNetwork_Delete() must be called to delete the wifi network and free the memory allocated.
 * @param[in] manager pointer on the Manager
 * @return eARNETWORKAL_ERROR
 * @see ARNETWORKAL_WifiNetwork_Delete()
 */
eARNETWORKAL_ERROR ARNETWORKAL_WifiNetwork_New (ARNETWORKAL_Manager_t *manager);

/**
 * @brief Signal the Manager to stop all sockets blocking operations
 * @param[in] manager pointer on the Manager
 * @return eARNETWORKAL_ERROR
 */
eARNETWORKAL_ERROR ARNETWORKAL_WifiNetwork_Signal(ARNETWORKAL_Manager_t *manager);

/**
 * @brief Gets the bandwith of the network
 * @param[in] manager pointer on the Manager
 * @param[out] pointer which will hold the upload bandwidth, in bytes per second (optionnal, can be NULL)
 * @param[out] pointer which will hold the download bandwidth, in bytes per second (optionnal, can be NULL)
 * @return error see ::eARNETWORKAL_ERROR
 */
eARNETWORKAL_ERROR ARNETWORKAL_WifiNetwork_GetBandwidth (ARNETWORKAL_Manager_t *manager, uint32_t *uploadBw, uint32_t *downloadBw);

/**
 * @brief Thread entry point for the bandwidth measurement.
 * @param manager pointer on the Manager, casted as void *
 * @return always returns (void *)0
{'fraction_non_alphanumeric': 0.08453887884267632, 'fraction_numerical': 0.006781193490054249, 'mean_word_length': 5.267705382436261, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5092692', 'n_tokens_mistral': 1454, 'n_tokens_neox': 1409, 'n_words': 452}