Mercurial > pidgin
annotate src/mediastreamer/msbuffer.h @ 13253:87a7c3077c19
[gaim-migrate @ 15619]
More cleaning up of oscar. Renamed some functions to be more clear.
Got rid of some stuff that wasn't used. Inlined some small things
in conn.c that were only used once.
The goals of all this are
1. Non-blocking I/O for all connections
2. p2p stuff won't use the same struct as oscar connections, because
that's stupid
3. The oscar PRPL should be less scary
committer: Tailor Script <tailor@pidgin.im>
| author | Mark Doliner <mark@kingant.net> |
|---|---|
| date | Sun, 12 Feb 2006 21:27:04 +0000 |
| parents | fc464a0abccc |
| children |
| rev | line source |
|---|---|
| 12024 | 1 /* |
| 2 The mediastreamer library aims at providing modular media processing and I/O | |
| 3 for linphone, but also for any telephony application. | |
| 4 Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org | |
| 5 | |
| 6 This library is free software; you can redistribute it and/or | |
| 7 modify it under the terms of the GNU Lesser General Public | |
| 8 License as published by the Free Software Foundation; either | |
| 9 version 2.1 of the License, or (at your option) any later version. | |
| 10 | |
| 11 This library is distributed in the hope that it will be useful, | |
| 12 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 14 Lesser General Public License for more details. | |
| 15 | |
| 16 You should have received a copy of the GNU Lesser General Public | |
| 17 License along with this library; if not, write to the Free Software | |
| 18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 19 */ | |
| 20 | |
| 21 | |
| 22 #ifndef MSBUFFER_H | |
| 23 #define MSBUFFER_H | |
| 24 #include <config.h> | |
| 25 | |
| 26 #ifdef HAVE_GLIB | |
| 27 #include <glib.h> | |
| 28 #else | |
| 29 #include <uglib.h> | |
| 30 #endif | |
| 31 | |
| 32 | |
| 33 #define MS_BUFFER_LARGE 4092 | |
| 34 | |
| 35 | |
| 36 typedef struct _MSBuffer | |
| 37 { | |
| 38 gchar *buffer; | |
| 39 guint32 size; | |
| 40 guint16 ref_count; | |
| 41 guint16 flags; | |
| 42 #define MS_BUFFER_CONTIGUOUS (1) | |
| 43 }MSBuffer; | |
| 44 | |
| 45 MSBuffer * ms_buffer_new(guint32 size); | |
| 46 void ms_buffer_destroy(MSBuffer *buf); | |
| 47 | |
| 48 struct _MSMessage | |
| 49 { | |
| 50 MSBuffer *buffer; /* points to a MSBuffer */ | |
| 51 void *data; /*points to buffer->buffer */ | |
| 52 guint32 size; /* the size of the buffer to read in data. It may not be the | |
| 53 physical size (I mean buffer->buffer->size */ | |
| 54 struct _MSMessage *next; | |
| 55 struct _MSMessage *prev; /* MSMessage are queued into MSQueues */ | |
| 56 }; | |
| 57 | |
| 58 typedef struct _MSMessage MSMessage; | |
| 59 | |
| 60 | |
| 61 MSBuffer *ms_buffer_alloc(gint flags); | |
| 62 MSMessage *ms_message_new(gint size); | |
| 63 | |
| 64 #define ms_message_set_buf(m,b) do { (b)->ref_count++; (m)->buffer=(b); (m)->data=(b)->buffer; (m)->size=(b)->size; }while(0) | |
| 65 #define ms_message_unset_buf(m) do { (m)->buffer->ref_count--; (m)->buffer=NULL; (m)->size=0; (m)->data=NULL; } while(0) | |
| 66 | |
| 67 #define ms_message_size(m) (m)->size | |
| 68 void ms_message_destroy(MSMessage *m); | |
| 69 | |
| 70 MSMessage * ms_message_dup(MSMessage *m); | |
| 71 | |
| 72 /* allocate a single message without buffer */ | |
|
12323
fc464a0abccc
[gaim-migrate @ 14627]
Richard Laager <rlaager@wiktel.com>
parents:
12024
diff
changeset
|
73 MSMessage *ms_message_alloc(void); |
| 12024 | 74 |
| 75 #endif |
