This repository has been archived by the owner on Dec 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
52 changed files
with
648 additions
and
372 deletions.
There are no files selected for viewing
Git LFS file not shown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/* $Id: assert.h 3553 2011-05-05 06:14:19Z nanang $ */ | ||
/* $Id: assert.h 5692 2017-11-13 06:06:25Z ming $ */ | ||
/* | ||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | ||
* Copyright (C) 2003-2008 Benny Prijono <[email protected]> | ||
|
@@ -28,13 +28,6 @@ | |
#if defined(PJ_HAS_ASSERT_H) && PJ_HAS_ASSERT_H != 0 | ||
# include <assert.h> | ||
|
||
#elif defined(PJ_LINUX_KERNEL) && PJ_LINUX_KERNEL != 0 | ||
# define assert(expr) do { \ | ||
if (!(expr)) \ | ||
printk("!!ASSERTION FAILED: [%s:%d] \"" #expr "\"\n",\ | ||
__FILE__, __LINE__); \ | ||
} while (0) | ||
|
||
#else | ||
# warning "assert() is not implemented" | ||
# define assert(expr) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/* $Id: high_precision.h 3553 2011-05-05 06:14:19Z nanang $ */ | ||
/* $Id: high_precision.h 5692 2017-11-13 06:06:25Z ming $ */ | ||
/* | ||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | ||
* Copyright (C) 2003-2008 Benny Prijono <[email protected]> | ||
|
@@ -31,21 +31,6 @@ | |
# define PJ_HIGHPREC_VALUE_IS_ZERO(a) (a==0) | ||
# define pj_highprec_mod(a,b) (a=fmod(a,b)) | ||
|
||
#elif defined(PJ_LINUX_KERNEL) && PJ_LINUX_KERNEL != 0 | ||
|
||
# include <asm/div64.h> | ||
|
||
typedef pj_int64_t pj_highprec_t; | ||
|
||
# define pj_highprec_div(a1,a2) do_div(a1,a2) | ||
# define pj_highprec_mod(a1,a2) (a1=do_mod(a1, a2)) | ||
|
||
PJ_INLINE(pj_int64_t) do_mod( pj_int64_t a1, pj_int64_t a2) | ||
{ | ||
return do_div(a1,a2); | ||
} | ||
|
||
|
||
#elif defined(PJ_HAS_INT64) && PJ_HAS_INT64 != 0 | ||
/* | ||
* Next choice is to use 64-bit arithmatics. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* pjlib/include/pj/compat/os_auto.h. Generated from os_auto.h.in by configure. */ | ||
/* $Id: os_auto.h.in 5543 2017-01-24 05:36:50Z nanang $ */ | ||
/* $Id: os_auto.h.in 5725 2018-01-15 08:52:29Z ming $ */ | ||
/* | ||
* Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com) | ||
* Copyright (C) 2003-2008 Benny Prijono <[email protected]> | ||
|
@@ -220,6 +220,9 @@ | |
#ifndef PJ_HAS_SSL_SOCK | ||
#define PJ_HAS_SSL_SOCK 1 | ||
#endif | ||
#ifndef PJ_SSL_SOCK_IMP | ||
# define PJ_SSL_SOCK_IMP PJ_SSL_SOCK_IMP_OPENSSL | ||
#endif | ||
|
||
|
||
#endif /* __PJ_COMPAT_OS_AUTO_H__ */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/* $Id: os_auto.h.in 5543 2017-01-24 05:36:50Z nanang $ */ | ||
/* $Id: os_auto.h.in 5725 2018-01-15 08:52:29Z ming $ */ | ||
/* | ||
* Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com) | ||
* Copyright (C) 2003-2008 Benny Prijono <[email protected]> | ||
|
@@ -219,6 +219,9 @@ | |
#ifndef PJ_HAS_SSL_SOCK | ||
#undef PJ_HAS_SSL_SOCK | ||
#endif | ||
#ifndef PJ_SSL_SOCK_IMP | ||
# define PJ_SSL_SOCK_IMP PJ_SSL_SOCK_IMP_NONE | ||
#endif | ||
|
||
|
||
#endif /* __PJ_COMPAT_OS_AUTO_H__ */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/* $Id: rand.h 3553 2011-05-05 06:14:19Z nanang $ */ | ||
/* $Id: rand.h 5692 2017-11-13 06:06:25Z ming $ */ | ||
/* | ||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | ||
* Copyright (C) 2003-2008 Benny Prijono <[email protected]> | ||
|
@@ -44,20 +44,6 @@ | |
# define platform_rand rand | ||
# endif | ||
|
||
#elif defined(PJ_LINUX_KERNEL) && PJ_LINUX_KERNEL != 0 | ||
/* | ||
* Linux kernel mode random number generator. | ||
*/ | ||
# include <linux/random.h> | ||
# define platform_srand(seed) | ||
|
||
PJ_INLINE(int) platform_rand(void) | ||
{ | ||
int value; | ||
get_random_bytes((void*)&value, sizeof(value)); | ||
return value; | ||
} | ||
|
||
#else | ||
# warning "platform_rand() is not implemented" | ||
# define platform_rand() 1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/* $Id: setjmp.h 3553 2011-05-05 06:14:19Z nanang $ */ | ||
/* $Id: setjmp.h 5692 2017-11-13 06:06:25Z ming $ */ | ||
/* | ||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | ||
* Copyright (C) 2003-2008 Benny Prijono <[email protected]> | ||
|
@@ -35,54 +35,6 @@ | |
# define pj_longjmp(buf,d) longjmp(buf,d) | ||
# endif | ||
|
||
#elif defined(PJ_LINUX_KERNEL) && PJ_LINUX_KERNEL != 0 && \ | ||
defined(PJ_M_I386) && PJ_M_I386 != 0 | ||
|
||
/* | ||
* These are taken from uClibc. | ||
* Copyright (C) 2000-2003 Erik Andersen <[email protected]> | ||
*/ | ||
# if defined __USE_MISC || defined _ASM | ||
# define JB_BX 0 | ||
# define JB_SI 1 | ||
# define JB_DI 2 | ||
# define JB_BP 3 | ||
# define JB_SP 4 | ||
# define JB_PC 5 | ||
# define JB_SIZE 24 | ||
# endif | ||
|
||
# ifndef _ASM | ||
typedef int __jmp_buf[6]; | ||
|
||
/* A `sigset_t' has a bit for each signal. */ | ||
# define _SIGSET_NWORDS (1024 / (8 * sizeof (unsigned long int))) | ||
typedef struct __sigset_t_tag | ||
{ | ||
unsigned long int __val[_SIGSET_NWORDS]; | ||
} __sigset_t; | ||
|
||
/* Calling environment, plus possibly a saved signal mask. */ | ||
typedef struct __jmp_buf_tag /* C++ doesn't like tagless structs. */ | ||
{ | ||
/* NOTE: The machine-dependent definitions of `__sigsetjmp' | ||
assume that a `jmp_buf' begins with a `__jmp_buf' and that | ||
`__mask_was_saved' follows it. Do not move these members | ||
or add others before it. */ | ||
__jmp_buf __jmpbuf; /* Calling environment. */ | ||
int __mask_was_saved; /* Saved the signal mask? */ | ||
// we never saved the mask. | ||
__sigset_t __saved_mask; /* Saved signal mask. */ | ||
} jmp_buf[1]; | ||
|
||
typedef jmp_buf sigjmp_buf; | ||
typedef jmp_buf pj_jmp_buf; | ||
|
||
PJ_DECL(int) pj_setjmp(pj_jmp_buf env); | ||
PJ_DECL(void) pj_longjmp(pj_jmp_buf env, int val) __attribute__((noreturn)); | ||
|
||
# endif /* _ASM */ | ||
|
||
#elif defined(PJ_SYMBIAN) && PJ_SYMBIAN!=0 | ||
/* Symbian framework don't use setjmp/longjmp */ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/* $Id: socket.h 5445 2016-10-05 09:52:39Z riza $ */ | ||
/* $Id: socket.h 5692 2017-11-13 06:06:25Z ming $ */ | ||
/* | ||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | ||
* Copyright (C) 2003-2008 Benny Prijono <[email protected]> | ||
|
@@ -184,34 +184,6 @@ | |
#undef s6_addr | ||
#undef sin_zero | ||
|
||
/* | ||
* Linux kernel specifics | ||
*/ | ||
#if defined(PJ_LINUX_KERNEL) | ||
# include <linux/net.h> | ||
# include <asm/ioctls.h> /* FIONBIO */ | ||
# include <linux/syscalls.h> /* sys_select() */ | ||
# include <asm/uaccess.h> /* set/get_fs() */ | ||
|
||
typedef int socklen_t; | ||
# define getsockopt sys_getsockopt | ||
|
||
/* | ||
* Wrapper for select() in Linux kernel. | ||
*/ | ||
PJ_INLINE(int) select(int n, fd_set *inp, fd_set *outp, fd_set *exp, | ||
struct timeval *tvp) | ||
{ | ||
int count; | ||
mm_segment_t oldfs = get_fs(); | ||
set_fs(KERNEL_DS); | ||
count = sys_select(n, inp, outp, exp, tvp); | ||
set_fs(oldfs); | ||
return count; | ||
} | ||
#endif /* PJ_LINUX_KERNEL */ | ||
|
||
|
||
/* | ||
* This will finally be obsoleted, since it should be declared in | ||
* os_auto.h | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/* $Id: config.h 5683 2017-11-08 03:03:22Z ming $ */ | ||
/* $Id: config.h 5725 2018-01-15 08:52:29Z ming $ */ | ||
/* | ||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | ||
* Copyright (C) 2003-2008 Benny Prijono <[email protected]> | ||
|
@@ -115,12 +115,6 @@ | |
# define PJ_WIN32 1 | ||
# include <pj/compat/os_win32.h> | ||
|
||
#elif defined(PJ_LINUX_KERNEL) && PJ_LINUX_KERNEL!=0 | ||
/* | ||
* Linux kernel | ||
*/ | ||
# include <pj/compat/os_linux_kernel.h> | ||
|
||
#elif defined(PJ_LINUX) || defined(linux) || defined(__linux) | ||
/* | ||
* Linux | ||
|
@@ -918,8 +912,9 @@ | |
|
||
/** | ||
* Enable secure socket. For most platforms, this is implemented using | ||
* OpenSSL, so this will require OpenSSL to be installed. For Symbian | ||
* platform, this is implemented natively using CSecureSocket. | ||
* OpenSSL or GnuTLS, so this will require one of those libraries to | ||
* be installed. For Symbian platform, this is implemented natively | ||
* using CSecureSocket. | ||
* | ||
* Default: 0 (for now) | ||
*/ | ||
|
@@ -928,6 +923,28 @@ | |
#endif | ||
|
||
|
||
/* | ||
* Secure socket implementation. | ||
* Select one of these implementations in PJ_SSL_SOCK_IMP. | ||
*/ | ||
#define PJ_SSL_SOCK_IMP_NONE 0 /**< Disable SSL socket. */ | ||
#define PJ_SSL_SOCK_IMP_OPENSSL 1 /**< Using OpenSSL. */ | ||
#define PJ_SSL_SOCK_IMP_GNUTLS 2 /**< Using GnuTLS. */ | ||
|
||
|
||
/** | ||
* Select which SSL socket implementation to use. Currently pjlib supports | ||
* PJ_SSL_SOCK_IMP_OPENSSL, which uses OpenSSL, and PJ_SSL_SOCK_IMP_GNUTLS, | ||
* which uses GnuTLS. Setting this to PJ_SSL_SOCK_IMP_NONE will disable | ||
* secure socket. | ||
* | ||
* Default is PJ_SSL_SOCK_IMP_NONE | ||
*/ | ||
#ifndef PJ_SSL_SOCK_IMP | ||
# define PJ_SSL_SOCK_IMP PJ_SSL_SOCK_IMP_NONE | ||
#endif | ||
|
||
|
||
/** | ||
* Define the maximum number of ciphers supported by the secure socket. | ||
* | ||
|
@@ -971,6 +988,17 @@ | |
#endif | ||
|
||
|
||
/** | ||
* Maximum number of socket options in pj_sockopt_params. | ||
* | ||
* Default: 4 | ||
*/ | ||
#ifndef PJ_MAX_SOCKOPT_PARAMS | ||
# define PJ_MAX_SOCKOPT_PARAMS 4 | ||
#endif | ||
|
||
|
||
|
||
/** @} */ | ||
|
||
/******************************************************************** | ||
|
@@ -1299,7 +1327,7 @@ PJ_BEGIN_DECL | |
* Extra suffix for the version (e.g. "-trunk"), or empty for | ||
* web release version. | ||
*/ | ||
#define PJ_VERSION_NUM_EXTRA "" | ||
#define PJ_VERSION_NUM_EXTRA "-svn" | ||
|
||
/** | ||
* PJLIB version number consists of three bytes with the following format: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/* $Id: sock.h 5636 2017-08-02 02:51:59Z ming $ */ | ||
/* $Id: sock.h 5719 2018-01-05 09:48:31Z nanang $ */ | ||
/* | ||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | ||
* Copyright (C) 2003-2008 Benny Prijono <[email protected]> | ||
|
@@ -629,8 +629,6 @@ typedef struct pj_ip_mreq { | |
pj_in_addr imr_interface; /**< local IP address of interface. */ | ||
} pj_ip_mreq; | ||
|
||
/* Maximum number of socket options. */ | ||
#define PJ_MAX_SOCKOPT_PARAMS 4 | ||
|
||
/** | ||
* Options to be set for the socket. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/* $Id: scanner.h 4537 2013-06-19 06:47:43Z riza $ */ | ||
/* $Id: scanner.h 5693 2017-11-14 08:20:15Z ming $ */ | ||
/* | ||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | ||
* Copyright (C) 2003-2008 Benny Prijono <[email protected]> | ||
|
@@ -216,16 +216,14 @@ typedef struct pj_scan_state | |
|
||
|
||
/** | ||
* Initialize the scanner. Note that the input string buffer must have | ||
* length at least buflen+1 because the scanner will NULL terminate the | ||
* string during initialization. | ||
* Initialize the scanner. | ||
* Note that the input string buffer MUST be NULL terminated and have | ||
* length at least buflen+1 (buflen MUST NOT include the NULL terminator). | ||
* | ||
* @param scanner The scanner to be initialized. | ||
* @param bufstart The input buffer to scan. Note that buffer[buflen] will be | ||
* filled with NULL char until scanner is destroyed, so | ||
* the actual buffer length must be at least buflen+1. | ||
* @param bufstart The input buffer to scan, which must be NULL terminated. | ||
* @param buflen The length of the input buffer, which normally is | ||
* strlen(bufstart). | ||
* strlen(bufstart), hence not counting the NULL terminator. | ||
* @param options Zero, or combination of PJ_SCAN_AUTOSKIP_WS or | ||
* PJ_SCAN_AUTOSKIP_WS_HEADER | ||
* @param callback Callback to be called when the scanner encounters syntax | ||
|
Oops, something went wrong.