mms_sock.c revision cee0fb94c0d4227de0a00efc162fb2739844b641
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <pthread.h>
#include <netdb.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <libgen.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
#include "mms_network.h"
#include "mms_sym.h"
#include "mms_sock.h"
#include <mms_trace.h>
int
{
int sockfd;
int n;
char host_str[MAXHOSTNAMELEN];
/* getaddrinfo can't handle localhost so look up hostname */
return (1);
}
}
return (1);
}
return (1);
}
do {
res->ai_protocol);
if (sockfd < 0) {
continue; /* ignore this one */
}
break; /* success */
}
return (1);
}
#ifdef MMS_OPENSSL
return (1);
}
#endif /* MMS_OPENSSL */
return (0);
}
/* Server accepts client connection. */
int
{
int sockfd = -1;
continue;
}
return (1);
}
#ifdef MMS_OPENSSL
return (1);
}
#endif /* MMS_OPENSSL */
return (0);
}
int
{
int listenfd;
int n;
const int on = 1;
char host_str[MAXHOSTNAMELEN];
*serv_fd = -1;
return (1);
}
}
return (1);
}
return (1);
}
do {
res->ai_protocol);
if (listenfd < 0)
continue; /* error, try next one */
sizeof (on)) < 0) {
continue;
}
break; /* success */
}
return (1);
}
return (0);
}
/* Read from socket. */
int
{
int rc;
#ifdef MMS_OPENSSL
#endif /* MMS_OPENSSL */
} else {
}
return (rc);
}
/* Should the read continue or be stopped? */
int
{
#ifdef MMS_OPENSSL
return (mms_ssl_read_has_error(conn));
#endif /* MMS_OPENSSL */
} else {
return (0); /* continue */
}
}
return (1); /* stop reading */
}
/* Write to the socket */
int
{
int rc;
#ifdef MMS_OPENSSL
#endif /* MMS_OPENSSL */
} else {
}
return (rc);
}
/* Should the write continue or be stopped. */
int
{
#ifdef MMS_OPENSSL
return (mms_ssl_write_has_error(conn));
#endif /* MMS_OPENSSL */
} else {
return (0); /* continue */
}
}
return (1); /* stop writing */
}
/* Close the socket. */
void
{
return;
}
#ifdef MMS_OPENSSL
#endif /* MMS_OPENSSL */
}
}
void
{
}
static void
{
}
void
{
}
/* Get error string */
void
{
int id;
return;
}
id = MMS_ERR_NONE;
/* turn error number into a string */
case MMS_ERR_SYS:
} else {
}
break;
case MMS_ERR_GAI:
} else {
}
break;
#ifdef MMS_OPENSSL
case MMS_ERR_SSL:
break;
#endif /* MMS_OPENSSL */
default:
} else {
}
break;
}
}