// file: $isip/util/demo/isip_comm_server_dialog_database/web_interface.h
// version: $Id: web_interface.h 10017 2005-04-22 15:05:35Z elliott $
//

/*************************************************************************
 *                                                                       * 
 *                Center for Speech and Language Research		 *
 *                   University of Colorado, Boulder                     *
 *                       Copyright (c) 1999,2000                         *
 *                        All Rights Reserved.                           *
 *                                                                       *
 *  The University of Colorado ("CU") hereby grants to you an            *
 *  irrevocable, nonexclusive, nontransferable, perpetual, royalty-free  *
 *  and worldwide license to use this source code solely for educational,*
 *  research, personal use, or evaluation.  Limitations of Use are       *
 *  described below.  A commercial license can be obtained only through  *
 *  expressed written permission of The Center for Speech and Language   *
 *  Research, University of Colorado at Boulder.			 *
 *									 *
 *  	Non-Commercial License Limitations and Use Requirements		 *
 *									 *
 *  Limitations on Use: The License is limited to noncommercial use.     *
 *  Noncommercial use relates only to educational, research, personal    *
 *  use, or evaluation purposes.  Any other use is commercial use.  You  *
 *  may not use the Software in connection with any business activities. *
 *  You may distribute and/or allow others to use a) the Software or b)  *
 *  the applications you create with the Software only if each new user  *
 *  is bound by the provisions of this Agreement.			 *
 *									 *
 *  Conditions of Use: This work is furnished to you under the following *
 *  conditions:								 *
 *									 *
 *   1. The code must retain the above copyright notice, this list of    *
 *      conditions and the following disclaimer.                         *
 *   2. Any modifications must be clearly marked as such.                *
 *   3. Original authors' names are not deleted.                         *
 *   4. The authors' names are not used to endorse or promote products   *
 *      derived from this software without specific prior written        *
 *      permission.                                                      *
 *   5. You agree to acknowledge CU-Boulder's Center for Speech and      *
 *      Language Reseach with appropriate citations in any publication or*
 *      presentation containing research results obtained in whole or in *
 *      part through the use of the Software.				 *
 *									 *
 *  Term of License: The License is effective upon receipt by you of the *
 *  Software and shall continue until terminated.  The License will      *
 *  terminate immediately without notice by CU if you fail to comply     *
 *  with the terms and conditions of this Agreement.  Upon termination   *
 *  of this License, you shall immediately discontinue all use of the    *
 *  Software provided hereunder, and return to CU or destroy the         *
 *  original and all copies of all such Software.  All of your           *
 *  obligations under this Agreement shall survive the termination of    *
 *  the License.							 *
 *									 *
 *  DISCLAIMER:                                                          *
 *                                                                       *
 *  THE UNIVERSITY OF COLORADO AND THE CONTRIBUTORS TO THIS WORK         *
 *  DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING      *
 *  ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT   *
 *  SHALL THE UNIVERSITY OF COLORADO NOR THE CONTRIBUTORS BE LIABLE      *
 *  FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES    *
 *  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN   *
 *  AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,          *
 *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF       *
 *  THIS SOFTWARE.                                                       *
 *                                                                       *
 *************************************************************************/
/*-----------------------------------------------------------------------*
 *                                                                       *
 *              CU Communicator Sybase DB Server Interface               * 
 *                                                                       *
 *   This server is an interface to the Sybase Adaptive Server Anywhere  *
 *   for Unix software.  It has been tested for Solaris x86 v2.6.  The   *
 *   server is designed using the MITRE DB server as a guide and	 *
 *   provides the same functionalities.  				 *
 *									 *
 *   Usage:								 *
 *     db_server -uid <username> -pwd <password> -name <database> 	 *
 *	         -travelocity <filename>				 *
 *									 *
 *   The "travelocity" command-line argument points to a file containing *
 *   sequences of logins and passwords for www.travelocity.comw.         *
 *   Each row of this file should contain a unique login along with a    *
 *   corresponding password (separated by white space).  During	 	 *
 *   operation, each login is used for 50 queries before going onto the  *
 *   next login.  Once the last login is reached, the code switches to   *
 *   the first login in the list (in a round-robin format).		 *
 *									 *
 *   The code expects an input frame containing an SQL query:		 *
 *									 *
 *   {c foobar								 *
 *     :db_query "select airline, flight_id, depart_time, arrive_time,   *
 *	       stop_nonstop, meal, equip_type from airline_flight 	 *
 *	       where depart_airport = 'BOS' and arrive_airport = 'LAX'"  * 
 *	       :maxrows 10 }						 *
 *									 *
 *   It returns a frame like,						 *
 *									 *
 *   {c foobar								 *
 *	:query_result {c result						 *
 *	     :column_names ( "airline" "flight_id" ... )		 *
 *	     :nfound 2							 *
 *	     :values ( ( "AA" "11" "815" "1148" "0" "B" "757" ) ( .. )   *
 *									 *
 *   Bryan L. Pellom (bp@cslu.colorado.edu)                              *
 *   Center for Spoken Language Understanding                            *
 *   University of Colorado at Boulder                                   *
 *                                                                       *
 *-----------------------------------------------------------------------*/

// make sure definitions are only made once
//
#ifndef WEB_INTERFACE_H
#define WEB_INTERFACE_H

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <ctype.h>
#include <signal.h>
#include <math.h>
#include <sys/stat.h>
#include <galaxy/galaxy_all.h>
#include <mysql.h>

/*-----------------------------------------------------------------------*
 *  These variables are used to store information when amibiguities are  *
 *  detected prior to accessing the WWW.				 *
 *-----------------------------------------------------------------------*/

#define NO_RESPONSE_FROM_INTERNET     -2

/*-----------------------------------------------------------------------*
 *  Function prototypes							 * 
 *-----------------------------------------------------------------------*/

int update_tables_from_web(Gal_Frame frame, void *server_data,
			   MYSQL *myData_in);

#endif


