chenqiyang
2022-09-02 6a99d9bf65aa5878cb409945ed2bdbdcb916d047
Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/Library/bctoolbox.framework/Headers/port.h
@@ -1,21 +1,21 @@
/*
  The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
  Copyright (C) 2001  Simon MORLAT simon.morlat@linphone.org
  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.
  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.
  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
 * Copyright (c) 2016-2020 Belledonne Communications SARL.
 *
 * This file is part of bctoolbox.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
/* this file is responsible of the portability of the stack */
#ifndef BCTBX_PORT_H
@@ -38,7 +38,7 @@
#include <string.h>
#include <wchar.h>
#ifdef __linux
#ifdef __linux__
#include <stdint.h>
#endif
@@ -118,6 +118,7 @@
#define getSocketError() strerror(errno)
#define getSocketErrorCode() (errno)
#define getSocketErrorWithCode(code) strerror(code)
#define bctbx_gettimeofday(tv,tz) gettimeofday(tv,tz)
#define bctbx_log10f(x)   log10f(x)
@@ -276,13 +277,24 @@
#endif
#ifdef __cplusplus
extern "C" {
#endif
BCTBX_PUBLIC const char *__bctbx_getWinSocketError(int error);
#ifdef __cplusplus
}
#endif
#ifndef getSocketErrorCode
#define getSocketErrorCode()   WSAGetLastError()
#define getSocketErrorCode()           WSAGetLastError()
#endif
#ifndef getSocketError
#define getSocketError()       __bctbx_getWinSocketError(WSAGetLastError())
#define getSocketError()               __bctbx_getWinSocketError(WSAGetLastError())
#endif
#ifndef getSocketErrorWithCode
#define getSocketErrorWithCode(code)   __bctbx_getWinSocketError(code)
#endif
#ifndef snprintf
@@ -364,10 +376,16 @@
BCTBX_PUBLIC int bctbx_socket_set_non_blocking(bctbx_socket_t sock);
#ifdef __GNUC__
#   define BCTBX_PRINTF_LIKE(format_pos, args_pos) __attribute__ ((format (printf, format_pos, args_pos)))
#else
#   define BCTBX_PRINTF_LIKE(format_pos, args_pos)
#endif
BCTBX_PUBLIC char *bctbx_strndup(const char *str,int n);
BCTBX_PUBLIC char *bctbx_strdup_printf(const char *fmt,...);
BCTBX_PUBLIC char *bctbx_strdup_printf(const char *fmt,...) BCTBX_PRINTF_LIKE(1, 2);
BCTBX_PUBLIC char *bctbx_strdup_vprintf(const char *fmt, va_list ap);
BCTBX_PUBLIC char *bctbx_strcat_printf(char *dst, const char *fmt,...);
BCTBX_PUBLIC char *bctbx_strcat_printf(char *dst, const char *fmt,...) BCTBX_PRINTF_LIKE(2, 3);
BCTBX_PUBLIC char *bctbx_strcat_vprintf(char *dst, const char *fmt, va_list ap);
BCTBX_PUBLIC char *bctbx_concat(const char *str, ...);
BCTBX_PUBLIC char *bctbx_replace(char *str, char c, char n);
@@ -462,6 +480,12 @@
 */
BCTBX_PUBLIC uint32_t bctbx_time_string_to_sec(const char *timeString);
/**
 * Generate a non cryptographically usable alea
 *
 * @return a 32 bits unsigned random. DO NOT USE THIS RANDOM SOURCE FOR ANY CRYPTOGRAPHIC OPERATION
 */
BCTBX_PUBLIC unsigned int bctbx_random(void);