Skip to content
Snippets Groups Projects
Select Git revision
  • 4e31533e6bf28833bcccd8b9ce51521a0685ea1b
  • master default protected
  • 9.0
  • 8.0
  • 7.8
  • 7.6
  • 7.4
  • 7.2
  • 7.0
  • 0.6
  • rosuav/latex-markdown-renderer
  • rxnpatch/rxnpatch
  • marcus/gobject-introspection
  • rxnpatch/8.0
  • rosuav/pre-listening-ports
  • nt-tools
  • rosuav/async-annotations
  • rosuav/pgsql-ssl
  • rxnpatch/rxnpatch-broken/2023-10-06T094250
  • grubba/fdlib
  • grubba/wip/sakura/8.0
  • v8.0.2000
  • v8.0.1998
  • v8.0.1996
  • v8.0.1994
  • v8.0.1992
  • v8.0.1990
  • v8.0.1988
  • v8.0.1986
  • rxnpatch/clusters/8.0/2025-04-29T124414
  • rxnpatch/2025-04-29T124414
  • v8.0.1984
  • v8.0.1982
  • v8.0.1980
  • v8.0.1978
  • v8.0.1976
  • v8.0.1974
  • v8.0.1972
  • v8.0.1970
  • v8.0.1968
  • v8.0.1966
41 results

dynamic_buffer.h

Blame
  • prot-a-send-async.c 4.97 KiB
    /*
     * $Id: prot-a-send-async.c,v 0.17 1998/07/08 13:41:56 ceder Exp $
     * Copyright (C) 1991, 1993, 1994, 1995, 1996  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 const char *
    rcsid = "$Id: prot-a-send-async.c,v 0.17 1998/07/08 13:41:56 ceder Exp $";
    #include "rcs.h"
    USE(rcsid);
    
    #include <setjmp.h>
    #include <time.h>
    #include <sys/types.h>
    #include <sys/socket.h>
    #ifdef HAVE_STDARG_H
    #  include <stdarg.h>
    #endif
    
    #include "misc-types.h"
    #include "s-string.h"
    #include "kom-types.h"
    #include "com.h"
    #include "async.h"
    #include "connections.h"
    #include "prot-a-send-async.h"
    #include "async.h"
    #include "isc-interface.h"
    #include "mux.h"
    #include "prot-a-output.h"
    
    
    static void
    async_header(Connection *fp,
    	     int   no_of_tokens,
    	     Async fnc)
    {
        mux_printf(fp, ":%lu %lu", (unsigned long)no_of_tokens, 
    	       (unsigned long)fnc);
    }
    
    
    
        
    static void
    async_trailer(Connection *fp)
    {
        mux_putc('\n', fp);
        mux_flush(fp);
    }
    
    
    void
    prot_a_async_new_text_old(Connection *cptr,
                              Text_no	      text_no,
                              Text_stat      *text_s)
    {
        ASYNC_CHECK_ACCEPT(cptr, ay_new_text_old);
        async_header(cptr, 16, ay_new_text_old);
        mux_printf(cptr, " %lu", text_no);
        prot_a_output_text_stat_old(cptr, text_s);
        async_trailer(cptr);
    }
    
    void
    prot_a_async_new_text(Connection *cptr,
                          Text_no	      text_no,
                          Text_stat      *text_s)
    {
        ASYNC_CHECK_ACCEPT(cptr, ay_new_text);
        async_header(cptr, 16, ay_new_text);
        mux_printf(cptr, " %lu", text_no);
        prot_a_output_text_stat_old(cptr, text_s);
        async_trailer(cptr);
    }
    
    
    void
    prot_a_async_i_am_on(Connection *cptr,
    		     Who_info info)
    {
        ASYNC_CHECK_ACCEPT(cptr, ay_i_am_on);
        async_header(cptr, 5, ay_i_am_on);
        prot_a_output_who_info(cptr, &info);
        async_trailer(cptr);
    }
    
    void
    prot_a_async_logout(Connection *cptr,
    		    Pers_no pers_no,
    		    Session_no session_no)
    {
        ASYNC_CHECK_ACCEPT(cptr, ay_logout);
        async_header(cptr, 2, ay_logout);
        mux_printf(cptr, " %lu %lu", (unsigned long)pers_no, 
    	       (unsigned 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_CHECK_ACCEPT(cptr, ay_new_name);
        async_header(cptr, 3, ay_new_name);
        mux_printf(cptr, " %lu", (unsigned 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_CHECK_ACCEPT(cptr, ay_sync_db);
        async_header(cptr, 0, ay_sync_db);
        async_trailer(cptr);
    }
    
    void
    prot_a_async_forced_leave_conf(Connection *cptr,
    			       Conf_no         conf_no)
    {
        ASYNC_CHECK_ACCEPT(cptr, ay_leave_conf);
        async_header(cptr, 1, ay_leave_conf);
        mux_printf(cptr, " %lu", (unsigned long)conf_no);
        async_trailer(cptr);
    }
    
    void
    prot_a_async_login(Connection *cptr,
    		   Pers_no	   pers_no,
    		   int		   session_no)
    {
        ASYNC_CHECK_ACCEPT(cptr, ay_login);
        async_header(cptr, 2, ay_login);
        mux_printf(cptr, " %lu %lu", (unsigned long)pers_no, 
    	       (unsigned long)session_no);
        async_trailer(cptr);
    }
    
    void
    prot_a_async_rejected_connection(Connection *cptr)
    {
        ASYNC_CHECK_ACCEPT(cptr, ay_rejected_connection);
        async_header(cptr, 0, ay_rejected_connection);
        async_trailer(cptr);
    }
        
    void
    prot_a_async_send_message(Connection *cptr,
    			  Conf_no     recipient,
    			  Pers_no     sender,
    			  String      message)
    {
        ASYNC_CHECK_ACCEPT(cptr, ay_send_message);
        async_header(cptr, 3, ay_send_message);
        mux_printf(cptr, " %lu %lu", (unsigned long)recipient,
    	       (unsigned long)sender);
        prot_a_output_string(cptr, message);
        async_trailer(cptr);
    }
    
    void
    prot_a_async_deleted_text(Connection *cptr,
                             Text_no	      text_no,
                             Text_stat      *text_s)
    {
        ASYNC_CHECK_ACCEPT(cptr, ay_deleted_text);
        async_header(cptr, 16, ay_deleted_text);
        mux_printf(cptr, " %lu", text_no);
        prot_a_output_text_stat(cptr, text_s);
        async_trailer(cptr);
    }