450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * CDDL HEADER START
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * The contents of this file are subject to the terms of the
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Common Development and Distribution License (the "License").
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * You may not use this file except in compliance with the License.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * See the License for the specific language governing permissions
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * and limitations under the License.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * If applicable, add the following below this CDDL HEADER, with the
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * CDDL HEADER END
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Use is subject to license terms.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * This is demo code to be used with the existing demo proxy daemon
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * svc-stmfproxy in /usr/demo/comstar.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortept_socket_recv(void *handle, void *buf, size_t len)
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (recv(sh->sockfd, buf, len, MSG_WAITALL));
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortept_socket_send(void *handle, void *buf, size_t len)
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestatic void *
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if ((sfd = socket(AF_INET, SOCK_STREAM, 0)) <= 0) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, &on,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte sizeof (on)) < 0) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte /* XXX get from smf? */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte sizeof (serv_addr)) < 0) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte syslog(LOG_DAEMON|LOG_WARNING, "bind() call failed: %d",
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte new_sfd = accept(sfd, (struct sockaddr *)&cli_addr, &cliLen);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte syslog(LOG_DAEMON|LOG_WARNING, "accept failed: %d",
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Assume IP dot notation or if that fails, gethostbyname()
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * If that fails, return
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte "Sorry, cannot use ip address format\n");
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte /* XXX pass in from smf */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte sizeof (sin)) < 0) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte /* get a fresh socket and retry */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestmf_proxy_transport_init(char *transport, pt_ops_t **pt_ops)
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (-1);