loudmouth/inc/lm-message-queue.h
changeset 0 d0f3a028347a
equal deleted inserted replaced
-1:000000000000 0:d0f3a028347a
       
     1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
       
     2 /*
       
     3  * Copyright (C) 2006 Imendio AB
       
     4  *
       
     5  * This program is free software; you can redistribute it and/or
       
     6  * modify it under the terms of the GNU Lesser General Public License as
       
     7  * published by the Free Software Foundation; either version 2 of the
       
     8  * License, or (at your option) any later version.
       
     9  *
       
    10  * This program is distributed in the hope that it will be useful,
       
    11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    13  * Lesser General Public License for more details.
       
    14  *
       
    15  * You should have received a copy of the GNU Lesser General Public
       
    16  * License along with this program; if not, write to the
       
    17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
       
    18  * Boston, MA 02111-1307, USA.
       
    19  */
       
    20 
       
    21 #ifndef __LM_MESSAGE_QUEUE_H__
       
    22 #define __LM_MESSAGE_QUEUE_H__
       
    23 
       
    24 #include <glib.h>
       
    25 #include "loudmouth/lm-message.h"
       
    26 
       
    27 typedef struct _LmMessageQueue LmMessageQueue;
       
    28 
       
    29 typedef void (* LmMessageQueueCallback) (LmMessageQueue *queue,
       
    30 					 gpointer        user_data);
       
    31 
       
    32 LmMessageQueue *  lm_message_queue_new         (LmMessageQueueCallback func,
       
    33 						gpointer               data);
       
    34 void              lm_message_queue_attach      (LmMessageQueue        *queue,
       
    35 						GMainContext *context);
       
    36 
       
    37 void              lm_message_queue_detach      (LmMessageQueue *queue);
       
    38 void              lm_message_queue_push_tail   (LmMessageQueue *queue,
       
    39 						LmMessage      *m);
       
    40 LmMessage *       lm_message_queue_peek_nth    (LmMessageQueue *queue,
       
    41 						guint           n);
       
    42 LmMessage *       lm_message_queue_pop_nth     (LmMessageQueue *queue,
       
    43 						guint           n);
       
    44 guint             lm_message_queue_get_length  (LmMessageQueue *queue);
       
    45 gboolean          lm_message_queue_is_empty    (LmMessageQueue *queue);
       
    46 
       
    47 LmMessageQueue *  lm_message_queue_ref         (LmMessageQueue *queue);
       
    48 void              lm_message_queue_unref       (LmMessageQueue *queue);
       
    49 
       
    50 #endif /* __LM_MESSAGE_QUEUE_H__ */