* 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., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
+ * MA 02110-1301 USA
*
*
* fuzxy is designed to go on the client path
#include <netinet/in.h>
#endif
+#if defined(__sun)
+#include <strings.h> /* bzero */
+#endif
+
#define MAX_FUZZ_BUF (1024 * 1024)
enum types {
{ "port", required_argument, NULL, 'p' },
{ "ssl", no_argument, NULL, 's' },
{ "allow-non-ssl", no_argument, NULL, 'a' },
- { "interface", required_argument, NULL, 'i' },
- { "closetest", no_argument, NULL, 'c' },
+ { "interface", required_argument, NULL, 'i' },
+ { "closetest", no_argument, NULL, 'c' },
{ "libev", no_argument, NULL, 'e' },
#ifndef LWS_NO_DAEMONIZE
- { "daemonize", no_argument, NULL, 'D' },
+ { "daemonize", no_argument, NULL, 'D' },
#endif
{ "resource_path", required_argument, NULL, 'r' },
{ NULL, 0, 0, 0 }
if (interface_name[0] &&
lws_interface_to_sa(0, interface_name, (struct sockaddr_in *)
- (struct sockaddr *)&serv_addr4,
+ (struct sockaddr *)&serv_addr4,
sizeof(serv_addr4)) < 0) {
lwsl_err("Unable to find interface %s\n", interface_name);
goto bail2;
int n = 0, m;
#ifndef _WIN32
+/* LOG_PERROR is not POSIX standard, and may not be portable */
+#ifdef __sun
+ int syslog_options = LOG_PID;
+#else
int syslog_options = LOG_PID | LOG_PERROR;
#endif
+#endif
#ifndef LWS_NO_DAEMONIZE
- int daemonize = 0;
+ int daemonize = 0;
#endif
signal(SIGPIPE, sigpipe_handler);
#ifndef LWS_NO_DAEMONIZE
case 'D':
daemonize = 1;
- #ifndef _WIN32
+ #if !defined(_WIN32) && !defined(__sun)
syslog_options &= ~LOG_PERROR;
#endif
break;
/*
* draw down enough of the partner's
* in ring to either exhaust it
- * or fill an output buffer
- */
+ * or fill an output buffer
+ */
m = fuzz(n, out, sizeof(out));
if (m < 0) {
lwsl_err("Error on fuzz\n");
* all without asking permission.
*
* The test apps are intended to be adapted for use in your code, which
- * may be proprietary. So unlike the library itself, they are licensed
+ * may be proprietary. So unlike the library itself, they are licensed
* Public Domain.
*/
{ "help", no_argument, NULL, 'h' },
{ "debug", required_argument, NULL, 'd' },
{ "port", required_argument, NULL, 'p' },
- { "ssl-cert", required_argument, NULL, 'C' },
+ { "ssl-cert", required_argument, NULL, 'C' },
{ "ssl-key", required_argument, NULL, 'k' },
#ifndef LWS_NO_CLIENT
{ "client", required_argument, NULL, 'c' },
{ "versa", no_argument, NULL, 'v' },
{ "uri", required_argument, NULL, 'u' },
{ "passphrase", required_argument, NULL, 'P' },
- { "interface", required_argument, NULL, 'i' },
+ { "interface", required_argument, NULL, 'i' },
{ "times", required_argument, NULL, 'n' },
{ "echogen", no_argument, NULL, 'e' },
#ifndef LWS_NO_DAEMONIZE
- { "daemonize", no_argument, NULL, 'D' },
+ { "daemonize", no_argument, NULL, 'D' },
#endif
{ NULL, 0, 0, 0 }
};
char ssl_cert[256] = LOCAL_RESOURCE_PATH"/libwebsockets-test-server.pem";
char ssl_key[256] = LOCAL_RESOURCE_PATH"/libwebsockets-test-server.key.pem";
#ifndef _WIN32
+/* LOG_PERROR is not POSIX standard, and may not be portable */
+#ifdef __sun
+ int syslog_options = LOG_PID;
+#else
int syslog_options = LOG_PID | LOG_PERROR;
#endif
+#endif
int client = 0;
int listen_port = 80;
struct lws_context_creation_info info;
#ifndef LWS_NO_DAEMONIZE
case 'D':
daemonize = 1;
-#ifndef _WIN32
+#if !defined(_WIN32) && !defined(__sun)
syslog_options &= ~LOG_PERROR;
#endif
break;
case '?':
case 'h':
fprintf(stderr, "Usage: libwebsockets-test-echo\n"
- " --debug / -d <debug bitfield>\n"
- " --port / -p <port>\n"
- " --ssl-cert / -C <cert path>\n"
- " --ssl-key / -k <key path>\n"
+ " --debug / -d <debug bitfield>\n"
+ " --port / -p <port>\n"
+ " --ssl-cert / -C <cert path>\n"
+ " --ssl-key / -k <key path>\n"
#ifndef LWS_NO_CLIENT
- " --client / -c <server IP>\n"
- " --ratems / -r <rate in ms>\n"
+ " --client / -c <server IP>\n"
+ " --ratems / -r <rate in ms>\n"
#endif
- " --ssl / -s\n"
+ " --ssl / -s\n"
" --passphrase / -P <passphrase>\n"
- " --interface / -i <interface>\n"
- " --uri / -u <uri path>\n"
- " --times / -n <-1 unlimited or times to echo>\n"
+ " --interface / -i <interface>\n"
+ " --uri / -u <uri path>\n"
+ " --times / -n <-1 unlimited or times to echo>\n"
#ifndef LWS_NO_DAEMONIZE
- " --daemonize / -D\n"
+ " --daemonize / -D\n"
#endif
);
exit(1);
* all without asking permission.
*
* The test apps are intended to be adapted for use in your code, which
- * may be proprietary. So unlike the library itself, they are licensed
+ * may be proprietary. So unlike the library itself, they are licensed
* Public Domain.
*/
#include <termiosh>
#endif
+#ifdef __sun
+#include <sys/termios.h>
+#endif
+
/*
* this is specified in the 04 standard, control frames can only have small
* payload length styles
* all without asking permission.
*
* The test apps are intended to be adapted for use in your code, which
- * may be proprietary. So unlike the library itself, they are licensed
+ * may be proprietary. So unlike the library itself, they are licensed
* Public Domain.
*/
/*
* This mutex lock protects code that changes or relies on wsi list outside of
- * the service thread. The service thread will acquire it when changing the
+ * the service thread. The service thread will acquire it when changing the
* wsi list and other threads should acquire it while dereferencing wsis or
* calling apis like lws_callback_on_writable_all_protocol() which
* use the wsi list and wsis from a different thread context.
{ "port", required_argument, NULL, 'p' },
{ "ssl", no_argument, NULL, 's' },
{ "allow-non-ssl", no_argument, NULL, 'a' },
- { "interface", required_argument, NULL, 'i' },
- { "closetest", no_argument, NULL, 'c' },
+ { "interface", required_argument, NULL, 'i' },
+ { "closetest", no_argument, NULL, 'c' },
{ "libev", no_argument, NULL, 'e' },
{ "threads", required_argument, NULL, 'j' },
#ifndef LWS_NO_DAEMONIZE
- { "daemonize", no_argument, NULL, 'D' },
+ { "daemonize", no_argument, NULL, 'D' },
#endif
{ "resource_path", required_argument, NULL, 'r' },
{ NULL, 0, 0, 0 }
pthread_t pthread_dumb, pthread_service[32];
char cert_path[1024];
char key_path[1024];
- int threads = 1;
+ int threads = 1;
int use_ssl = 0;
void *retval;
int opts = 0;
int n = 0;
#ifndef _WIN32
+/* LOG_PERROR is not POSIX standard, and may not be portable */
+#ifdef __sun
+ int syslog_options = LOG_PID;
+#else
int syslog_options = LOG_PID | LOG_PERROR;
#endif
+#endif
#ifndef LWS_NO_DAEMONIZE
- int daemonize = 0;
+ int daemonize = 0;
#endif
/*
#ifndef LWS_NO_DAEMONIZE
case 'D':
daemonize = 1;
- #ifndef _WIN32
+ #if !defined(_WIN32) && !defined(__sun)
syslog_options &= ~LOG_PERROR;
#endif
break;
* all without asking permission.
*
* The test apps are intended to be adapted for use in your code, which
- * may be proprietary. So unlike the library itself, they are licensed
+ * may be proprietary. So unlike the library itself, they are licensed
* Public Domain.
*/
};
-/* this shows how to override the lws file operations. You don't need
+/* this shows how to override the lws file operations. You don't need
* to do any of this unless you have a reason (eg, want to serve
* compressed files without decompressing the whole archive)
*/
{ "port", required_argument, NULL, 'p' },
{ "ssl", no_argument, NULL, 's' },
{ "allow-non-ssl", no_argument, NULL, 'a' },
- { "interface", required_argument, NULL, 'i' },
- { "closetest", no_argument, NULL, 'c' },
+ { "interface", required_argument, NULL, 'i' },
+ { "closetest", no_argument, NULL, 'c' },
{ "ssl-cert", required_argument, NULL, 'C' },
{ "ssl-key", required_argument, NULL, 'K' },
{ "ssl-ca", required_argument, NULL, 'A' },
#if defined(LWS_OPENSSL_SUPPORT)
- { "ssl-verify-client", no_argument, NULL, 'v' },
+ { "ssl-verify-client", no_argument, NULL, 'v' },
#if defined(LWS_HAVE_SSL_CTX_set1_param)
{ "ssl-crl", required_argument, NULL, 'R' },
#endif
#endif
{ "libev", no_argument, NULL, 'e' },
#ifndef LWS_NO_DAEMONIZE
- { "daemonize", no_argument, NULL, 'D' },
+ { "daemonize", no_argument, NULL, 'D' },
#endif
{ "resource_path", required_argument, NULL, 'r' },
{ NULL, 0, 0, 0 }
int opts = 0;
int n = 0;
#ifndef _WIN32
+/* LOG_PERROR is not POSIX standard, and may not be portable */
+#ifdef __sun
+ int syslog_options = LOG_PID;
+#else
int syslog_options = LOG_PID | LOG_PERROR;
#endif
+#endif
#ifndef LWS_NO_DAEMONIZE
- int daemonize = 0;
+ int daemonize = 0;
#endif
/*
#ifndef LWS_NO_DAEMONIZE
case 'D':
daemonize = 1;
- #ifndef _WIN32
+ #if !defined(_WIN32) && !defined(__sun)
syslog_options &= ~LOG_PERROR;
#endif
break;
return -1;
}
- /* this shows how to override the lws file operations. You don't need
+ /* this shows how to override the lws file operations. You don't need
* to do any of this unless you have a reason (eg, want to serve
* compressed files without decompressing the whole archive)
*/