/** Event delivery notification, see event.h */
BT_NOTIFICATION_TYPE_EVENT = 1,
- /** Start of stream packet notification, see packet.h */
- BT_NOTIFICATION_TYPE_PACKET_START = 2,
+ /** Beginning of stream packet notification, see packet.h */
+ BT_NOTIFICATION_TYPE_PACKET_BEGIN = 2,
/** End of stream packet notification, see packet.h */
BT_NOTIFICATION_TYPE_PACKET_END = 3,
#include <babeltrace/ctf-ir/packet.h>
#include <babeltrace/plugin/notification/notification-internal.h>
-struct bt_notification_packet_start {
+struct bt_notification_packet_begin {
struct bt_notification parent;
struct bt_ctf_packet *packet;
};
struct bt_ctf_packet;
-/*** BT_NOTIFICATION_TYPE_PACKET_START ***/
-struct bt_notification *bt_notification_packet_start_create(
+/*** BT_NOTIFICATION_TYPE_PACKET_BEGIN ***/
+struct bt_notification *bt_notification_packet_begin_create(
struct bt_ctf_packet *packet);
-struct bt_ctf_packet *bt_notification_packet_start_get_packet(
+struct bt_ctf_packet *bt_notification_packet_begin_get_packet(
struct bt_notification *notification);
/*** BT_NOTIFICATION_TYPE_PACKET_END ***/
#include <babeltrace/plugin/notification/packet-internal.h>
static
-void bt_notification_packet_start_destroy(struct bt_object *obj)
+void bt_notification_packet_begin_destroy(struct bt_object *obj)
{
- struct bt_notification_packet_start *notification =
- (struct bt_notification_packet_start *) obj;
+ struct bt_notification_packet_begin *notification =
+ (struct bt_notification_packet_begin *) obj;
BT_PUT(notification->packet);
g_free(notification);
g_free(notification);
}
-struct bt_notification *bt_notification_packet_start_create(
+struct bt_notification *bt_notification_packet_begin_create(
struct bt_ctf_packet *packet)
{
- struct bt_notification_packet_start *notification;
+ struct bt_notification_packet_begin *notification;
if (!packet) {
goto error;
}
- notification = g_new0(struct bt_notification_packet_start, 1);
+ notification = g_new0(struct bt_notification_packet_begin, 1);
bt_notification_init(¬ification->parent,
- BT_NOTIFICATION_TYPE_PACKET_START,
- bt_notification_packet_start_destroy);
+ BT_NOTIFICATION_TYPE_PACKET_BEGIN,
+ bt_notification_packet_begin_destroy);
notification->packet = bt_get(packet);
return ¬ification->parent;
error:
return NULL;
}
-struct bt_ctf_packet *bt_notification_packet_start_get_packet(
+struct bt_ctf_packet *bt_notification_packet_begin_get_packet(
struct bt_notification *notification)
{
- struct bt_notification_packet_start *packet_start;
+ struct bt_ctf_packet *ret = NULL;
+ struct bt_notification_packet_begin *packet_begin;
- packet_start = container_of(notification,
- struct bt_notification_packet_start, parent);
- return bt_get(packet_start->packet);
+ if (notification->type != BT_NOTIFICATION_TYPE_PACKET_BEGIN) {
+ goto end;
+ }
+
+ packet_begin = container_of(notification,
+ struct bt_notification_packet_begin, parent);
+ ret = bt_get(packet_begin->packet);
+end:
+ return ret;
}
struct bt_notification *bt_notification_packet_end_create(
struct bt_ctf_packet *bt_notification_packet_end_get_packet(
struct bt_notification *notification)
{
+ struct bt_ctf_packet *ret = NULL;
struct bt_notification_packet_end *packet_end;
+ if (notification->type != BT_NOTIFICATION_TYPE_PACKET_END) {
+ goto end;
+ }
+
packet_end = container_of(notification,
struct bt_notification_packet_end, parent);
- return bt_get(packet_end->packet);
+ ret = bt_get(packet_end->packet);
+end:
+ return ret;
}
return;
}
- ret = bt_notification_packet_start_create(notit->packet);
+ ret = bt_notification_packet_begin_create(notit->packet);
if (!ret) {
return;
}
bt_put(event);
break;
}
- case BT_NOTIFICATION_TYPE_PACKET_START:
+ case BT_NOTIFICATION_TYPE_PACKET_BEGIN:
{
struct bt_ctf_packet *packet;
- packet = bt_notification_packet_start_get_packet(notification);
+ packet = bt_notification_packet_begin_get_packet(notification);
stream = bt_ctf_packet_get_stream(packet);
bt_put(packet);
break;
[BT_NOTIFICATION_TYPE_NEW_TRACE] = 0,
[BT_NOTIFICATION_TYPE_NEW_STREAM_CLASS] = 1,
[BT_NOTIFICATION_TYPE_NEW_EVENT_CLASS] = 2,
- [BT_NOTIFICATION_TYPE_PACKET_START] = 3,
+ [BT_NOTIFICATION_TYPE_PACKET_BEGIN] = 3,
[BT_NOTIFICATION_TYPE_PACKET_END] = 4,
[BT_NOTIFICATION_TYPE_EVENT] = 5,
[BT_NOTIFICATION_TYPE_END_OF_TRACE] = 6,
/* Notification types are equal, but not of type "event". */
switch (a_type) {
- case BT_NOTIFICATION_TYPE_PACKET_START:
+ case BT_NOTIFICATION_TYPE_PACKET_BEGIN:
case BT_NOTIFICATION_TYPE_PACKET_END:
case BT_NOTIFICATION_TYPE_STREAM_END:
{
}
switch (bt_notification_get_type(notification)) {
- case BT_NOTIFICATION_TYPE_PACKET_START:
+ case BT_NOTIFICATION_TYPE_PACKET_BEGIN:
puts("<packet>");
break;
case BT_NOTIFICATION_TYPE_PACKET_END:
}
switch (bt_notification_get_type(notification)) {
- case BT_NOTIFICATION_TYPE_PACKET_START:
+ case BT_NOTIFICATION_TYPE_PACKET_BEGIN:
{
struct bt_ctf_packet *packet =
- bt_notification_packet_start_get_packet(notification);
+ bt_notification_packet_begin_get_packet(notification);
if (!packet) {
ret = BT_COMPONENT_STATUS_ERROR;
case BT_NOTIFICATION_TYPE_PACKET_END:
{
struct bt_ctf_packet *packet =
- bt_notification_packet_start_get_packet(notification);
+ bt_notification_packet_end_get_packet(notification);
if (!packet) {
ret = BT_COMPONENT_STATUS_ERROR;