OPENSRF="1";
OPENSRFC="1";
-JSERVERSOCK="$PREFIX/var/sock/jserver.sock"; # jabber server socket file
-JSERVERLOG="$LOGDIR/jserver.log" # jabber server log
+#JSERVERSOCK="$PREFIX/var/sock/jserver.sock"; # jabber server socket file
+#JSERVERLOG="$LOGDIR/jserver.log" # jabber server log
JSERVERPORT=5222; # jabber server port
-JSERVERLEVEL=3; # can be 1-4, 4 is the highest
-JSERVERIP="*"; # can be "*" or a specific local IP address
+#JSERVERLEVEL=3; # can be 1-4, 4 is the highest
+#JSERVERIP="*"; # can be "*" or a specific local IP address
# --------------------------------------------------------------------------
# --------------------------------------------------------------------------
-JSERVERBIN="jserver-c"
+JSERVERBIN="chopchop"
export LD_LIBRARY_PATH="$PREFIX/lib:$LD_LIBRARY_PATH";
export PERL5LIB="$PREFIX/lib/perl5:$PERL5LIB";
export PATH="$PREFIX/bin:$PATH";
[ ! -z "$ACTIVE" ] && fail "Port $JSERVERPORT is busy...exiting";
fi;
- rm -f "$JSERVERSOCK";
- "$BINDIR/$JSERVERBIN" $JSERVERPORT "$JSERVERIP" "$JSERVERSOCK" "$JSERVERLEVEL" "$JSERVERLOG"
+ "$BINDIR/$JSERVERBIN" "$ETCDIR/opensrf_core.xml" "chopchop";
}
sleep 1;
echo "Stopping Chop Chop...";
- killall -9 jserver-c;
+ killall -9 chopchop;
return 0;
}
@echo stack
make -C libstack
@echo $@
- $(CC) -shared -W1 $(LDFLAGS) -lJudy -lmemcache -lobjson $(OPENSRF_TARGETS) -o $(TMPDIR)/$(LIBOPENSRF)
+ $(CC) -shared -W1 $(LDFLAGS) -lJudy -lxml2 -lmemcache -lobjson $(OPENSRF_TARGETS) -o $(TMPDIR)/$(LIBOPENSRF)
@echo apps
make -C c-apps
clean:
/bin/rm -f *.o libopensrf_stack.so xml_utils.h xml_utils.c opensrf
+
if( timeout == -1 ) { /* wait potentially forever for data to arrive */
while( client->m_list->next == NULL ) {
- if( ! session_wait( client->session, -1 ) ) {
+ // if( ! session_wait( client->session, -1 ) ) {
+ int x;
+ if( (x = session_wait( client->session, -1 )) ) {
+ warning_handler("session_wait returned failure code %d\n", x);
return NULL;
}
}
msg = node->message;
free( node );
return msg;
+
} else {
return NULL;
}
}
int handle_math( char* words[] ) {
- if( words[1] && words[2] )
- return do_math( atoi(words[1]), atoi(words[2]) );
+ if( words[1] )
+ return do_math( atoi(words[1]), 0 );
return 0;
}
// Create the socket
// ------------------------------------------------------------------
if( (sock_fd = socket( AF_INET, SOCK_STREAM, 0 )) < 0 ) {
- fatal_handler( "tcp_connect(): Cannot create socket" );
+ warning_handler( "tcp_connect(): Cannot create socket" );
return -1;
}
// Get the hostname
// ------------------------------------------------------------------
if( (hptr = gethostbyname( dest_addr ) ) == NULL ) {
- fatal_handler( "tcp_connect(): Unknown Host => %s", dest_addr );
+ warning_handler( "tcp_connect(): Unknown Host => %s", dest_addr );
return -1;
}
// Bind to a local port
// ------------------------------------------------------------------
if( bind( sock_fd, (struct sockaddr *) &localAddr, sizeof( localAddr ) ) < 0 ) {
- fatal_handler( "tcp_connect(): Cannot bind to local port" );
+ warning_handler( "tcp_connect(): Cannot bind to local port" );
return -1;
}
// Connect to server
// ------------------------------------------------------------------
if( connect( sock_fd, (struct sockaddr*) &remoteAddr, sizeof( struct sockaddr_in ) ) < 0 ) {
- fatal_handler( "tcp_connect(): Cannot connect to server %s", dest_addr );
+ warning_handler( "tcp_connect(): Cannot connect to server %s", dest_addr );
return -1;
}
}
+
+
+char* xmlSaxAttr( const xmlChar** atts, char* name ) {
+ if( atts && name ) {
+ int i;
+ for(i = 0; (atts[i] != NULL); i++) {
+ if(!strcmp(atts[i], name)) {
+ if(atts[++i]) return (char*) atts[i];
+ }
+ }
+ }
+ return NULL;
+}
+
+
+int xmlAddAttrs( xmlNodePtr node, const xmlChar** atts ) {
+ if( node && atts ) {
+ int i;
+ for(i = 0; (atts[i] != NULL); i++) {
+ if(atts[i+1]) {
+ xmlSetProp(node, atts[i], atts[i+1]);
+ i++;
+ }
+ }
+ }
+ return 0;
+}
+
*/
char* xmlDocToString(xmlDocPtr doc, int full);
+
+/* Takes an xmlChar** from a SAX callback and returns the value
+ for the attribute with name 'name'
+ */
+char* xmlSaxAttr( const xmlChar** atts, char* name );
+
+/**
+ Sets the xml attributes from atts to the given dom node
+ */
+int xmlAddAttrs( xmlNodePtr node, const xmlChar** atts );
+
+
#endif