2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
2N/A * Use is subject to license terms.
2N/A */
2N/A
2N/A/*
2N/A * ldom_xmpp_client.h Extensible Messaging and Presence Protocol
2N/A */
2N/A
2N/A#ifndef _LDOM_XMPP_CLIENT_H
2N/A#define _LDOM_XMPP_CLIENT_H
2N/A
2N/A#include <sys/fm/ldom.h>
2N/A
2N/A#include <pthread.h>
2N/A#include <libxml/xmlstring.h>
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A#define XMPP_DEFAULT_PORT 6482
2N/A#define XMPP_BUF_SIZE 1024
2N/A#define RAND_BUF_SIZE 1024
2N/A#define XMPP_SLEEP 3
2N/A
2N/A#define STREAM_NODE (xmlChar *)"stream:stream"
2N/A#define FEATURE_NODE (xmlChar *)"stream:features"
2N/A#define STARTTLS_NODE (xmlChar *)"starttls"
2N/A#define PROCEED_NODE (xmlChar *)"proceed"
2N/A#define XML_LDM_INTERFACE ((xmlChar *)"LDM_interface")
2N/A#define XML_LDM_EVENT ((xmlChar *)"LDM_event")
2N/A
2N/A#define XML_SUCCESS ((xmlChar *)"success")
2N/A#define XML_FAILURE ((xmlChar *)"failure")
2N/A
2N/A#define XML_CMD ((xmlChar *)"cmd")
2N/A#define XML_ACTION ((xmlChar *)"action")
2N/A#define XML_RESPONSE ((xmlChar *)"response")
2N/A#define XML_STATUS ((xmlChar *)"status")
2N/A#define XML_DATA ((xmlChar *)"data")
2N/A#define XML_ENVELOPE ((xmlChar *)"Envelope")
2N/A#define XML_CONTENT ((xmlChar *)"Content")
2N/A
2N/A#define XML_ATTR_ID ((xmlChar *)"id")
2N/A
2N/A#define XML_REGISTER_ACTION "reg-domain-events"
2N/A
2N/A#define STREAM_START "<?xml version='1.0'?><stream:stream " \
2N/A "xml:lang=\"en\" version=\"1.0\" id=\"xmpp\"" \
2N/A ">"
2N/A#define START_TLS "<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>"
2N/A
2N/A#define LDM_REG_DOMAIN_EVENTS \
2N/A "<LDM_interface version=\"1.1\">" \
2N/A " <cmd>" \
2N/A " <action>reg-domain-events</action>" \
2N/A " <data version=\"3.0\"> </data>" \
2N/A " </cmd>" \
2N/A "</LDM_interface>"
2N/A
2N/A
2N/Atypedef struct ldom_event_info {
2N/A ldom_event_t id;
2N/A char *name;
2N/A} ldom_event_info_t;
2N/A
2N/A
2N/Atypedef struct client_info {
2N/A ldom_hdl_t *lhp;
2N/A ldom_reg_cb_t cb;
2N/A ldom_cb_arg_t data;
2N/A struct client_info *next;
2N/A struct client_info *prev;
2N/A} client_info_t;
2N/A
2N/Atypedef struct client_list {
2N/A client_info_t *head;
2N/A client_info_t *tail;
2N/A pthread_mutex_t lock;
2N/A} client_list_t;
2N/A
2N/A
2N/Aextern int xmpp_add_client(ldom_hdl_t *lhp, ldom_reg_cb_t cb,
2N/A ldom_cb_arg_t data);
2N/Aextern int xmpp_remove_client(ldom_hdl_t *lhp);
2N/Aextern void xmpp_start(void);
2N/Aextern void xmpp_stop(void);
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _LDOM_XMPP_CLIENT_H */