4 * Copyright (C) 2005 Novell, Inc.
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
16 * The above copyright notice and this permission notice shall be included in
17 * all copies or substantial portions of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 * DEALINGS IN THE SOFTWARE.
29 #include <sys/types.h>
30 #include <sys/socket.h>
33 #include "beagle-response.h"
34 #include "beagle-marshal.h"
35 #include "beagle-util.h"
36 #include "beagle-private.h"
40 } BeagleResponsePrivate
;
42 #define BEAGLE_RESPONSE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), BEAGLE_TYPE_RESPONSE, BeagleResponsePrivate))
44 static GObjectClass
*parent_class
= NULL
;
46 G_DEFINE_TYPE (BeagleResponse
, beagle_response
, G_TYPE_OBJECT
)
49 beagle_response_finalize (GObject
*obj
)
51 if (G_OBJECT_CLASS (parent_class
)->finalize
)
52 G_OBJECT_CLASS (parent_class
)->finalize (obj
);
56 beagle_response_class_init (BeagleResponseClass
*klass
)
58 GObjectClass
*obj_class
= G_OBJECT_CLASS (klass
);
60 parent_class
= g_type_class_peek_parent (klass
);
62 obj_class
->finalize
= beagle_response_finalize
;
64 g_type_class_add_private (klass
, sizeof (BeagleResponsePrivate
));
68 beagle_response_init (BeagleResponse
*response
)
73 _beagle_response_class_set_parser_handlers (BeagleResponseClass
*klass
,
74 BeagleParserHandler
*handlers
)
78 for (i
= 0; handlers
[i
].name
!= NULL
; i
++) {
79 if (handlers
[i
].src_state
!= -1)
80 handlers
[i
].src_state
+= _beagle_parser_state_index
;
82 handlers
[i
].dest_state
+= _beagle_parser_state_index
;
85 _beagle_parser_state_index
+= i
;
87 klass
->parser_handlers
= handlers
;