Skip to content
Snippets Groups Projects
Select Git revision
  • ecedd41439800c254bc9e202364d2105a5bbfc5b
  • master default
  • dbck-q-n-d-link
  • foutput-text_stat-override
  • generations
  • text-stat-sha256
  • use-nettle
  • import-nettle
  • refactor-cached_get_text
  • refactor-cached_get_text-part-2
  • add-text_store
  • introduce-generation_position
  • remove-reclamation
  • dbfile-temp-filenames
  • sstrdup
  • dbfile_open_read-check-magic
  • adns_dist
  • liboop_dist
  • search
  • isc
  • dbdbckmultiplechoice
  • last.cvs.revision
  • 2.1.2
  • 2.1.1
  • 2.1.0
  • adns_1_0
  • liboop_0_9
  • 2.0.7
  • search_bp
  • 2.0.6
  • 2.0.5
  • isc_1_01
  • Protocol-A-10.4
  • 2.0.4
  • 2.0.3
  • 2.0.2
  • 2.0.1
  • 2.0.0
  • isc_1_00
  • isc_merge_1999_05_01
  • isc_merge_1999_04_21
41 results

prot-a-send-async.c

Blame
  • prot-a-send-async.c 4.12 KiB
    /*
     * $Id: prot-a-send-async.c,v 0.5 1991/09/21 13:06:55 ceder Exp $
     * Copyright (C) 1991  Lysator Academic Computer Association.
     *
     * This file is part of the LysKOM server.
     * 
     * LysKOM is free software; you can redistribute it and/or modify it
     * under the terms of the GNU General Public License as published by 
     * the Free Software Foundation; either version 1, or (at your option) 
     * any later version.
     * 
     * LysKOM is distributed in the hope that it will be useful, but WITHOUT
     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     * for more details.
     * 
     * You should have received a copy of the GNU General Public License
     * along with LysKOM; see the file COPYING.  If not, write to
     * Lysator, c/o ISY, Linkoping University, S-581 83 Linkoping, SWEDEN,
     * or the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, 
     * MA 02139, USA.
     *
     * Please mail bug reports to bug-lyskom@lysator.liu.se. 
     */
    /*
     * Asynchronous messages in protocol A.
     */
    
    static char *rcsid = "$Id: prot-a-send-async.c,v 0.5 1991/09/21 13:06:55 ceder Exp $";
    
    
    #include <stdio.h>
    #include "lyskomd.h"
    #include <kom-types.h>
    #include <services.h>
    #include "async.h"
    #include "com.h"
    #include "connections.h"
    #include "prot-a-send-async.h"
    #include "prot-a-output.h"
    #include "manipulate.h"
    #include "log.h"
    #include "isc-interface.h"
    #include "mux.h"
    
    static void
    async_header(Connection *fp,
    	     int   no_of_tokens,
    	     Async fnc)
    {
        mux_printf(fp, ":%lu %lu", (u_long)no_of_tokens, (u_long)fnc);
    }
    
    
    
        
    static void
    async_trailer(Connection *fp)
    {
        mux_putc('\n', fp);
        mux_flush(fp);
    }
    
    
    void
    prot_a_async_new_text(Connection *cptr,
    		      Text_no	      text_no,
    		      Text_stat      *text_s)
    {
        async_header(cptr, 16, ay_new_text);
        mux_printf(cptr, " %lu", text_no);
        prot_a_output_text_stat(cptr, text_s);
        async_trailer(cptr);
    }
    
    
    void
    prot_a_async_i_am_on(Connection *cptr,
    		     Who_info info)
    {
        async_header(cptr, 5, ay_i_am_on);
        prot_a_output_who_info(cptr, &info);
        async_trailer(cptr);
    }
    
    void
    prot_a_async_i_am_off(Connection *cptr,
    		      Pers_no pers_no)
    {
        async_header(cptr, 1, ay_i_am_off);
        mux_printf(cptr, " %lu", pers_no);
        async_trailer(cptr);
    }
    
    
    void
    prot_a_async_logout(Connection *cptr,
    		    Pers_no pers_no,
    		    Session_no session_no)
    {
        async_header(cptr, 2, ay_logout);
        mux_printf(cptr, " %lu %lu", (u_long)pers_no, (u_long)session_no);
        async_trailer(cptr);
    }
    
    void
    prot_a_async_new_name(Connection *cptr,
    		      Conf_no conf_no,
    		      String old_name,
    		      String new_name)
    {
        async_header(cptr, 3, ay_new_name);
        mux_printf(cptr, " %lu", (u_long)conf_no);
        prot_a_output_string(cptr, old_name);
        prot_a_output_string(cptr, new_name);
        async_trailer(cptr);
    }
    
    void
    prot_a_async_sync_db(Connection *cptr)
    {
        async_header(cptr, 0, ay_sync_db);
        async_trailer(cptr);
    }
    
    void
    prot_a_async_forced_leave_conf(Connection *cptr,
    			       Conf_no         conf_no)
    {
        async_header(cptr, 1, ay_leave_conf);
        mux_printf(cptr, " %lu", (u_long)conf_no);
        async_trailer(cptr);
    }
    
    void
    prot_a_async_login(Connection *cptr,
    		   Pers_no	   pers_no,
    		   int		   session_no)
    {
        async_header(cptr, 2, ay_login);
        mux_printf(cptr, " %lu %lu", (u_long)pers_no, (u_long)session_no);
        async_trailer(cptr);
    }
        
    
    void
    prot_a_async_broadcast(Connection *cptr,
    		       Pers_no	       pers_no,
    		       String	       message)
    {
        prot_a_async_send_message(cptr, 0, pers_no, message);
    #if 0    
        async_header(cptr, 2, ay_broadcast);
        mux_printf(cptr, " %lu", (u_long)pers_no);
        prot_a_output_string(cptr, message);
        async_trailer(cptr);
    #endif
    }
    
    void
    prot_a_async_rejected_connection(Connection *cptr)
    {
        async_header(cptr, 0, ay_rejected_connection);
        async_trailer(cptr);
    }
        
    void
    prot_a_async_send_message(Connection *cptr,
    			  Pers_no     recipient,
    			  Pers_no     sender,
    			  String      message)
    {
        async_header(cptr, 3, ay_send_message);
        mux_printf(cptr, " %lu %lu", (u_long)recipient, (u_long)sender);
        prot_a_output_string(cptr, message);
        async_trailer(cptr);
    }