<commit_before>/* bzflag
 * Copyright (c) 1993 - 2005 <NAME>
 *
 * This package is free software;  you can redistribute it and/or
 * modify it under the terms of the license found in the file
 * named COPYING that should have accompanied this file.
 *
 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 */

/*
 * includes platform specific network files and adds missing stuff
 *
 * unfortunately this can include far more than necessary
 */

#ifndef	BZF_NETWORK_H
#define	BZF_NETWORK_H

#include "common.h"

/* system headers */
#include <vector>
#include <string>

#if !defined(_WIN32)

#include <sys/time.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/socket.h>

#ifndef GUSI_20
#  include <sys/param.h>
#endif

#include <net/if.h>
#include <netinet/in.h>

#if defined(__linux__)
/* these are defined in both socket.h and tcp.h without ifdef guards. */
#  undef TCP_NODELAY
#  undef TCP_MAXSEG
#endif

#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <netdb.h>
#ifdef HAVE_BSTRING_H
#  include <bstring.h>
#endif

#if defined(__linux__) && !defined(_old_linux_)
#  define AddrLen		unsigned int
/* setsockopt incorrectly prototypes the 4th arg without const. */
#  define SSOType		void*
#endif

#if defined(BSD) || defined(sun)
#  define AddrLen		socklen_t
#endif

#if defined(sun)
/* setsockopt prototypes the 4th arg as const char*. */
#  define SSOType		const char*
/* connect prototypes the 2nd arg without const */
#  define CNCTType	struct sockaddr
#endif

extern "C" {

#define herror(_x)	bzfherror(_x)

  void			nerror(const char* msg);
  void			bzfherror(const char* msg);
  int			getErrno();

}

/* BeOS net_server has closesocket(), which _must_ be used in place of close() */
#if defined(__BEOS__) && (IPPROTO_TCP != 6)<commit_msg>apply the patches provided from Apple for gcc 4 (for OS X 10.4) .. probably not really needed since the patches were to an older release, but what they heck.<commit_after>/* bzflag
 * Copyright (c) 1993 - 2005 <NAME>
 *
 * This package is free software;  you can redistribute it and/or
 * modify it under the terms of the license found in the file
 * named COPYING that should have accompanied this file.
 *
 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 */

/*
 * includes platform specific network files and adds missing stuff
 *
 * unfortunately this can include far more than necessary
 */

#ifndef	BZF_NETWORK_H
#define	BZF_NETWORK_H

#include "common.h"

/* system headers */
#include <vector>
#include <string>

#if !defined(_WIN32)

#include <sys/time.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/socket.h>

#ifndef GUSI_20
#  include <sys/param.h>
#endif

#include <net/if.h>
#include <netinet/in.h>

#if defined(__linux__)
/* these are defined in both socket.h and tcp.h without ifdef guards. */
#  undef TCP_NODELAY
#  undef TCP_MAXSEG
#endif

#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <netdb.h>
#ifdef HAVE_BSTRING_H
#  include <bstring.h>
#endif

#if defined(__linux__) && !defined(_old_linux_)
#  define AddrLen		unsigned int
/* setsockopt incorrectly prototypes the 4th arg without const. */
#  define SSOType		void*
#elif defined(BSD) || defined(sun)
#  define AddrLen		socklen_t
#elif defined (__APPLE__)
#  include <AvailabilityMacros.h>
#  if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
#    define AddrLen		socklen_t
#  endif
#endif

#if defined(sun)
/* setsockopt prototypes the 4th arg as const char*. */
#  define SSOType		const char*
/* connect prototypes the 2nd arg without const */
#  define CNCTType	struct sockaddr
#endif

extern "C" {

#define herror(_x)	bzfherror(_x)

  void			nerror(const char* msg);
  void			bzfherror(const char* msg);
  int			getErrno();

}

/* BeOS net_server has closesocket(), which _must_ be used in place of close() */
#if defined(__BEOS__) && (IPPROTO_TCP != 6)
{'fraction_non_alphanumeric': 0.10546686018384131, 'fraction_numerical': 0.009433962264150943, 'mean_word_length': 4.20125786163522, 'pattern_counts': {'":': 0, '<': 32, '<?xml version=': 0, '>': 33, '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': '1021493', 'n_tokens_mistral': 1464, 'n_tokens_neox': 1388, 'n_words': 486}