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