Commit d9d7e9e7 authored by Ghislain MARY's avatar Ghislain MARY

Update ortp-deps.

parent e99ba772
......@@ -56,11 +56,11 @@
* Includes
*/
#include "ortp/port.h"
#include "ortp/b64.h"
#include <assert.h>
#include <string.h>
#include "ortp/port.h"
/* /////////////////////////////////////////////////////////////////////////////
* Constants and definitions
*/
......
......@@ -227,7 +227,7 @@ extern "C" {
*
* \see b64::encode()
*/
size_t b64_encode(void const *src, size_t srcSize, char *dest, size_t destLen);
ORTP_PUBLIC size_t b64_encode(void const *src, size_t srcSize, char *dest, size_t destLen);
/** \brief Encodes a block of binary data into Base-64
*
......@@ -298,7 +298,7 @@ size_t b64_encode2( void const *src
*
* \see b64::decode()
*/
size_t b64_decode(char const *src, size_t srcLen, void *dest, size_t destSize);
ORTP_PUBLIC size_t b64_decode(char const *src, size_t srcLen, void *dest, size_t destSize);
/** \brief Decodes a sequence of Base-64 into a block of binary data
*
......
......@@ -46,12 +46,12 @@ typedef enum {
typedef void (*OrtpLogFunc)(OrtpLogLevel lev, const char *fmt, va_list args);
void ortp_set_log_file(FILE *file);
void ortp_set_log_handler(OrtpLogFunc func);
ORTP_PUBLIC void ortp_set_log_file(FILE *file);
ORTP_PUBLIC void ortp_set_log_handler(OrtpLogFunc func);
VAR_DECLSPEC OrtpLogFunc ortp_logv_out;
extern unsigned int __ortp_log_mask;
ORTP_PUBLIC extern unsigned int __ortp_log_mask;
#define ortp_log_level_enabled(level) (__ortp_log_mask & (level))
......@@ -63,10 +63,10 @@ extern unsigned int __ortp_log_mask;
if ((level)==ORTP_FATAL) abort();\
}while(0)
#else
void ortp_logv(int level, const char *fmt, va_list args);
ORTP_PUBLIC void ortp_logv(int level, const char *fmt, va_list args);
#endif
void ortp_set_log_level_mask(int levelmask);
ORTP_PUBLIC void ortp_set_log_level_mask(int levelmask);
#ifdef __GNUC__
#define CHECK_FORMAT_ARGS(m,n) __attribute__((format(printf,m,n)))
......
......@@ -77,20 +77,20 @@ typedef struct _PayloadType PayloadType;
#define payload_type_get_flags(pt) (pt)->flags
PayloadType *payload_type_new(void);
PayloadType *payload_type_clone(PayloadType *payload);
char *payload_type_get_rtpmap(PayloadType *pt);
void payload_type_destroy(PayloadType *pt);
void payload_type_set_recv_fmtp(PayloadType *pt, const char *fmtp);
void payload_type_set_send_fmtp(PayloadType *pt, const char *fmtp);
void payload_type_append_recv_fmtp(PayloadType *pt, const char *fmtp);
void payload_type_append_send_fmtp(PayloadType *pt, const char *fmtp);
ORTP_PUBLIC PayloadType *payload_type_new(void);
ORTP_PUBLIC PayloadType *payload_type_clone(PayloadType *payload);
ORTP_PUBLIC char *payload_type_get_rtpmap(PayloadType *pt);
ORTP_PUBLIC void payload_type_destroy(PayloadType *pt);
ORTP_PUBLIC void payload_type_set_recv_fmtp(PayloadType *pt, const char *fmtp);
ORTP_PUBLIC void payload_type_set_send_fmtp(PayloadType *pt, const char *fmtp);
ORTP_PUBLIC void payload_type_append_recv_fmtp(PayloadType *pt, const char *fmtp);
ORTP_PUBLIC void payload_type_append_send_fmtp(PayloadType *pt, const char *fmtp);
#define payload_type_get_bitrate(pt) ((pt)->normal_bitrate)
#define payload_type_get_rate(pt) ((pt)->clock_rate)
#define payload_type_get_mime(pt) ((pt)->mime_type)
bool_t fmtp_get_value(const char *fmtp, const char *param_name, char *result, size_t result_len);
ORTP_PUBLIC bool_t fmtp_get_value(const char *fmtp, const char *param_name, char *result, size_t result_len);
#define payload_type_set_user_data(pt,p) (pt)->user_data=(p)
#define payload_type_get_user_data(pt) ((pt)->user_data)
......
......@@ -75,6 +75,8 @@ typedef pthread_cond_t ortp_cond_t;
#pragma warning(disable : 1469) // "cc" clobber ignored
#endif
#define ORTP_PUBLIC
#ifdef __cplusplus
extern "C"
{
......@@ -119,9 +121,9 @@ int __ortp_thread_create(pthread_t *thread, pthread_attr_t *attr, void * (*routi
#include <stdarg.h>
#include <winsock2.h>
#include <ws2tcpip.h>
#include <io.h>
#ifdef _MSC_VER
#define ORTP_PUBLIC __declspec(dllexport)
#pragma push_macro("_WINSOCKAPI_")
#ifndef _WINSOCKAPI_
#define _WINSOCKAPI_
......@@ -136,6 +138,8 @@ typedef unsigned char uint8_t;
typedef __int16 int16_t;
#else
#include <stdint.h> /*provided by mingw32*/
#include <io.h>
#define ORTP_PUBLIC
#endif
#define vsnprintf _vsnprintf
......@@ -167,17 +171,17 @@ extern "C"
{
#endif
int WIN_mutex_init(ortp_mutex_t *m, void *attr_unused);
int WIN_mutex_lock(ortp_mutex_t *mutex);
int WIN_mutex_unlock(ortp_mutex_t *mutex);
int WIN_mutex_destroy(ortp_mutex_t *mutex);
int WIN_thread_create(ortp_thread_t *t, void *attr_unused, void *(*func)(void*), void *arg);
int WIN_thread_join(ortp_thread_t thread, void **unused);
int WIN_cond_init(ortp_cond_t *cond, void *attr_unused);
int WIN_cond_wait(ortp_cond_t * cond, ortp_mutex_t * mutex);
int WIN_cond_signal(ortp_cond_t * cond);
int WIN_cond_broadcast(ortp_cond_t * cond);
int WIN_cond_destroy(ortp_cond_t * cond);
ORTP_PUBLIC int WIN_mutex_init(ortp_mutex_t *m, void *attr_unused);
ORTP_PUBLIC int WIN_mutex_lock(ortp_mutex_t *mutex);
ORTP_PUBLIC int WIN_mutex_unlock(ortp_mutex_t *mutex);
ORTP_PUBLIC int WIN_mutex_destroy(ortp_mutex_t *mutex);
ORTP_PUBLIC int WIN_thread_create(ortp_thread_t *t, void *attr_unused, void *(*func)(void*), void *arg);
ORTP_PUBLIC int WIN_thread_join(ortp_thread_t thread, void **unused);
ORTP_PUBLIC int WIN_cond_init(ortp_cond_t *cond, void *attr_unused);
ORTP_PUBLIC int WIN_cond_wait(ortp_cond_t * cond, ortp_mutex_t * mutex);
ORTP_PUBLIC int WIN_cond_signal(ortp_cond_t * cond);
ORTP_PUBLIC int WIN_cond_broadcast(ortp_cond_t * cond);
ORTP_PUBLIC int WIN_cond_destroy(ortp_cond_t * cond);
#ifdef __cplusplus
}
......@@ -212,7 +216,7 @@ const char * ortp_strerror(DWORD value);
#endif
const char *getWinSocketError(int error);
ORTP_PUBLIC const char *getWinSocketError(int error);
#define getSocketErrorCode() WSAGetLastError()
#define getSocketError() getWinSocketError(WSAGetLastError())
......@@ -248,11 +252,11 @@ typedef struct ortpTimeSpec{
extern "C"{
#endif
void* ortp_malloc(size_t sz);
void ortp_free(void *ptr);
void* ortp_realloc(void *ptr, size_t sz);
void* ortp_malloc0(size_t sz);
char * ortp_strdup(const char *tmp);
ORTP_PUBLIC void* ortp_malloc(size_t sz);
ORTP_PUBLIC void ortp_free(void *ptr);
ORTP_PUBLIC void* ortp_realloc(void *ptr, size_t sz);
ORTP_PUBLIC void* ortp_malloc0(size_t sz);
ORTP_PUBLIC char * ortp_strdup(const char *tmp);
/*override the allocator with this method, to be called BEFORE ortp_init()*/
typedef struct _OrtpMemoryFunctions{
......@@ -266,16 +270,16 @@ void ortp_set_memory_functions(OrtpMemoryFunctions *functions);
#define ortp_new(type,count) (type*)ortp_malloc(sizeof(type)*(count))
#define ortp_new0(type,count) (type*)ortp_malloc0(sizeof(type)*(count))
int close_socket(ortp_socket_t sock);
int set_non_blocking_socket(ortp_socket_t sock);
ORTP_PUBLIC int close_socket(ortp_socket_t sock);
ORTP_PUBLIC int set_non_blocking_socket(ortp_socket_t sock);
char *ortp_strndup(const char *str,int n);
char *ortp_strdup_printf(const char *fmt,...);
char *ortp_strdup_vprintf(const char *fmt, va_list ap);
ORTP_PUBLIC char *ortp_strndup(const char *str,int n);
ORTP_PUBLIC char *ortp_strdup_printf(const char *fmt,...);
ORTP_PUBLIC char *ortp_strdup_vprintf(const char *fmt, va_list ap);
int ortp_file_exist(const char *pathname);
ORTP_PUBLIC int ortp_file_exist(const char *pathname);
void ortp_get_cur_time(ortpTimeSpec *ret);
ORTP_PUBLIC void ortp_get_cur_time(ortpTimeSpec *ret);
/* portable named pipes and shared memory*/
#if !defined(_WIN32_WCE)
......@@ -287,24 +291,24 @@ typedef int ortp_pipe_t;
#define ORTP_PIPE_INVALID (-1)
#endif
ortp_pipe_t ortp_server_pipe_create(const char *name);
ORTP_PUBLIC ortp_pipe_t ortp_server_pipe_create(const char *name);
/*
* warning: on win32 ortp_server_pipe_accept_client() might return INVALID_HANDLE_VALUE without
* any specific error, this happens when ortp_server_pipe_close() is called on another pipe.
* This pipe api is not thread-safe.
*/
ortp_pipe_t ortp_server_pipe_accept_client(ortp_pipe_t server);
int ortp_server_pipe_close(ortp_pipe_t spipe);
int ortp_server_pipe_close_client(ortp_pipe_t client);
ORTP_PUBLIC ortp_pipe_t ortp_server_pipe_accept_client(ortp_pipe_t server);
ORTP_PUBLIC int ortp_server_pipe_close(ortp_pipe_t spipe);
ORTP_PUBLIC int ortp_server_pipe_close_client(ortp_pipe_t client);
ortp_pipe_t ortp_client_pipe_connect(const char *name);
int ortp_client_pipe_close(ortp_pipe_t sock);
ORTP_PUBLIC ortp_pipe_t ortp_client_pipe_connect(const char *name);
ORTP_PUBLIC int ortp_client_pipe_close(ortp_pipe_t sock);
int ortp_pipe_read(ortp_pipe_t p, uint8_t *buf, int len);
int ortp_pipe_write(ortp_pipe_t p, const uint8_t *buf, int len);
ORTP_PUBLIC int ortp_pipe_read(ortp_pipe_t p, uint8_t *buf, int len);
ORTP_PUBLIC int ortp_pipe_write(ortp_pipe_t p, const uint8_t *buf, int len);
void *ortp_shm_open(unsigned int keyid, int size, int create);
void ortp_shm_close(void *memory);
ORTP_PUBLIC void *ortp_shm_open(unsigned int keyid, int size, int create);
ORTP_PUBLIC void ortp_shm_close(void *memory);
#endif
......
......@@ -82,62 +82,62 @@ typedef struct _queue
extern "C" {
#endif
void qinit(queue_t *q);
ORTP_PUBLIC void qinit(queue_t *q);
void putq(queue_t *q, mblk_t *m);
ORTP_PUBLIC void putq(queue_t *q, mblk_t *m);
mblk_t * getq(queue_t *q);
ORTP_PUBLIC mblk_t * getq(queue_t *q);
void insq(queue_t *q,mblk_t *emp, mblk_t *mp);
ORTP_PUBLIC void insq(queue_t *q,mblk_t *emp, mblk_t *mp);
void remq(queue_t *q, mblk_t *mp);
ORTP_PUBLIC void remq(queue_t *q, mblk_t *mp);
mblk_t * peekq(queue_t *q);
ORTP_PUBLIC mblk_t * peekq(queue_t *q);
/* remove and free all messages in the q */
#define FLUSHALL 0
void flushq(queue_t *q, int how);
ORTP_PUBLIC void flushq(queue_t *q, int how);
void mblk_init(mblk_t *mp);
ORTP_PUBLIC void mblk_init(mblk_t *mp);
void mblk_meta_copy(const mblk_t *source, mblk_t *dest);
ORTP_PUBLIC void mblk_meta_copy(const mblk_t *source, mblk_t *dest);
/* allocates a mblk_t, that points to a datab_t, that points to a buffer of size size. */
mblk_t *allocb(int size, int unused);
ORTP_PUBLIC mblk_t *allocb(int size, int unused);
#define BPRI_MED 0
/* allocates a mblk_t, that points to a datab_t, that points to buf; buf will be freed using freefn */
mblk_t *esballoc(uint8_t *buf, int size, int pri, void (*freefn)(void*) );
ORTP_PUBLIC mblk_t *esballoc(uint8_t *buf, int size, int pri, void (*freefn)(void*) );
/* frees a mblk_t, and if the datab ref_count is 0, frees it and the buffer too */
void freeb(mblk_t *m);
ORTP_PUBLIC void freeb(mblk_t *m);
/* frees recursively (follow b_cont) a mblk_t, and if the datab
ref_count is 0, frees it and the buffer too */
void freemsg(mblk_t *mp);
ORTP_PUBLIC void freemsg(mblk_t *mp);
/* duplicates a mblk_t , buffer is not duplicated*/
mblk_t *dupb(mblk_t *m);
ORTP_PUBLIC mblk_t *dupb(mblk_t *m);
/* duplicates a complex mblk_t, buffer is not duplicated */
mblk_t *dupmsg(mblk_t* m);
ORTP_PUBLIC mblk_t *dupmsg(mblk_t* m);
/* returns the size of data of a message */
int msgdsize(const mblk_t *mp);
ORTP_PUBLIC int msgdsize(const mblk_t *mp);
/* concatenates all fragment of a complex message*/
void msgpullup(mblk_t *mp,int len);
ORTP_PUBLIC void msgpullup(mblk_t *mp,int len);
/* duplicates a single message, but with buffer included */
mblk_t *copyb(mblk_t *mp);
ORTP_PUBLIC mblk_t *copyb(mblk_t *mp);
/* duplicates a complex message with buffer included */
mblk_t *copymsg(mblk_t *mp);
ORTP_PUBLIC mblk_t *copymsg(mblk_t *mp);
mblk_t * appendb(mblk_t *mp, const char *data, int size, bool_t pad);
void msgappend(mblk_t *mp, const char *data, int size, bool_t pad);
ORTP_PUBLIC mblk_t * appendb(mblk_t *mp, const char *data, int size, bool_t pad);
ORTP_PUBLIC void msgappend(mblk_t *mp, const char *data, int size, bool_t pad);
mblk_t *concatb(mblk_t *mp, mblk_t *newm);
ORTP_PUBLIC mblk_t *concatb(mblk_t *mp, mblk_t *newm);
#define qempty(q) (&(q)->_q_stopper==(q)->_q_stopper.b_next)
#define qfirst(q) ((q)->_q_stopper.b_next!=&(q)->_q_stopper ? (q)->_q_stopper.b_next : NULL)
......@@ -150,9 +150,9 @@ typedef struct _msgb_allocator{
queue_t q;
}msgb_allocator_t;
void msgb_allocator_init(msgb_allocator_t *pa);
mblk_t *msgb_allocator_alloc(msgb_allocator_t *pa, int size);
void msgb_allocator_uninit(msgb_allocator_t *pa);
ORTP_PUBLIC void msgb_allocator_init(msgb_allocator_t *pa);
ORTP_PUBLIC mblk_t *msgb_allocator_alloc(msgb_allocator_t *pa, int size);
ORTP_PUBLIC void msgb_allocator_uninit(msgb_allocator_t *pa);
#ifdef __cplusplus
}
......
......@@ -27,6 +27,7 @@
#include "ortp/logging.h"
#include "ortp/port.h"
#include "ortp/str_utils.h"
#include "utils.h"
#if defined(_WIN32) && !defined(_WIN32_WCE)
#include <process.h>
......
......@@ -15,6 +15,7 @@ cp -f $TEMPGITDIR/include/ortp/payloadtype.h ortp/
cp -f $TEMPGITDIR/include/ortp/port.h ortp/
cp -f $TEMPGITDIR/include/ortp/str_utils.h ortp/
cp -f $TEMPGITDIR/src/ortp-config-win32.h .
cp -f $TEMPGITDIR/src/utils.h .
cp -f $TEMPGITDIR/src/b64.c .
cp -f $TEMPGITDIR/src/logging.c .
cp -f $TEMPGITDIR/src/payloadtype.c .
......
/***************************************************************************
* utils.h
*
* Wed Feb 23 14:15:36 2005
* Copyright 2005 Simon Morlat
* Email simon.morlat@linphone.org
****************************************************************************/
/*
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
*/
#ifndef UTILS_H
#define UTILS_H
#include "ortp/event.h"
struct _OList {
struct _OList *next;
struct _OList *prev;
void *data;
};
typedef struct _OList OList;
#define o_list_next(elem) ((elem)->next)
OList * o_list_append(OList *elem, void * data);
OList * o_list_remove(OList *list, void *data);
OList * o_list_free(OList *elem);
OList *o_list_remove_link(OList *list, OList *elem);
#define INT_TO_POINTER(truc) ((long)(long)(truc))
#define POINTER_TO_INT(truc) ((int)(long)(truc))
typedef struct _dwsplit_t{
#ifdef ORTP_BIGENDIAN
uint16_t hi;
uint16_t lo;
#else
uint16_t lo;
uint16_t hi;
#endif
} dwsplit_t;
typedef union{
dwsplit_t split;
uint32_t one;
} poly32_t;
#ifdef ORTP_BIGENDIAN
#define hton24(x) (x)
#else
#define hton24(x) ((( (x) & 0x00ff0000) >>16) | (( (x) & 0x000000ff) <<16) | ( (x) & 0x0000ff00) )
#endif
#define ntoh24(x) hton24(x)
#if defined(WIN32) || defined(_WIN32_WCE)
#define is_would_block_error(errnum) (errnum==WSAEWOULDBLOCK)
#else
#define is_would_block_error(errnum) (errnum==EWOULDBLOCK || errnum==EAGAIN)
#endif
void ortp_ev_queue_put(OrtpEvQueue *q, OrtpEvent *ev);
uint64_t ortp_timeval_to_ntp(const struct timeval *tv);
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment