mgmt.c revision 36c5fee33fa8b822175d410202aebcf592c8d342
/*
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <unistd.h>
#include <strings.h>
#include <stdlib.h>
#include <poll.h>
#include <utility.h>
#include <synch.h>
#include <libxml/xmlreader.h>
#include "queue.h"
#include "port.h"
#include "utility.h"
#include "xml.h"
static void
{
msg_t *m;
char *data,
*output;
do {
m = queue_message_get(in);
switch (m->msg_type) {
case msg_conn_lost:
break;
case msg_log:
break;
case msg_mgmt_rply:
break;
default:
break;
}
if (m->msg_data)
}
static void *
mgmt_process(void *v)
{
port_args_t *p = (port_args_t *)v;
int nbytes,
pval,
ret;
char *buf;
m.m_q = p->port_dataq;
m.m_request = mgmt_parse_xml;
m.m_targ_name = NULL;
break;
break;
break;
break;
}
if (r != NULL) {
ret = xmlTextReaderRead(r);
while (ret == 1) {
break;
ret = xmlTextReaderRead(r);
}
queue_message_set(p->port_mgmtq, 0,
msg_mgmt_rqst, &m);
}
}
}
if (pval == -1)
(void) close(p->port_socket);
p->port_socket = -1;
return (NULL);
}
void *
port_management(void *v)
{
int s,
fd,
on = 1;
struct sockaddr_in sin_ip;
struct sockaddr_in6 sin6_ip;
struct sockaddr_storage from;
port_args_t *p = (port_args_t *)v;
target_queue_t *q = p->port_mgmtq;
int l;
char debug[80];
"Can't open socket");
return (NULL);
} else {
sizeof (sin_ip))) < 0) {
"bind on port %d failed\n", p->port_num);
return (NULL);
}
}
} else {
sizeof (on));
< 0) {
"bind on port %d failed\n",
p->port_num);
return (NULL);
}
}
if (listen(s, 5) < 0) {
return (NULL);
}
/*CONSTANTCONDITION*/
while (1) {
&fromlen)) < 0) {
return (NULL);
}
l = 128 * 1024;
sizeof (l)) < 0)
"setsockopt failed");
sizeof (l)) < 0)
"setsockopt failed");
p->port_socket = fd;
}
return (NULL);
}