예제 #1
0
	void Notify(uint32 eventCode, struct image* image)
	{
		char eventBuffer[128];
		KMessage event;
		event.SetTo(eventBuffer, sizeof(eventBuffer), IMAGE_MONITOR);
		event.AddInt32("event", eventCode);
		event.AddInt32("image", image->info.id);
		event.AddPointer("imageStruct", image);

		DefaultNotificationService::Notify(event, eventCode);
	}
예제 #2
0
파일: port.cpp 프로젝트: mariuz/haiku
void
PortNotificationService::Notify(uint32 opcode, port_id port)
{
	char eventBuffer[64];
	KMessage event;
	event.SetTo(eventBuffer, sizeof(eventBuffer), PORT_MONITOR);
	event.AddInt32("event", opcode);
	event.AddInt32("port", port);

	DefaultNotificationService::Notify(event, opcode);
}
예제 #3
0
	void _SendMessage(messaging_target* targets, int32 targetCount,
		int32 object, uint32 opcode)
	{
		// prepare the message
		char buffer[128];
		KMessage message;
		message.SetTo(buffer, sizeof(buffer), B_SYSTEM_OBJECT_UPDATE);
		message.AddInt32("opcode", opcode);
		if (opcode < B_THREAD_CREATED)
			message.AddInt32("team", object);
		else
			message.AddInt32("thread", object);

		// send it
		send_message(message.Buffer(), message.ContentSize(), targets,
			targetCount);
	}
예제 #4
0
status_t
notify_link_changed(net_device* device)
{
	if (sNotificationModule == NULL)
		return B_NOT_SUPPORTED;

	char messageBuffer[512];
	KMessage message;
	message.SetTo(messageBuffer, sizeof(messageBuffer), B_NETWORK_MONITOR);
	message.AddInt32("opcode", B_NETWORK_DEVICE_LINK_CHANGED);
	message.AddString("device", device->name);
	message.AddInt32("media", device->media);
	message.AddInt64("link speed", device->link_speed);
	message.AddInt32("link quality", device->link_quality);

	return sNotificationModule->send_notification(&message);
}
예제 #5
0
status_t
notify_interface_changed(net_interface* interface, uint32 oldFlags,
	uint32 newFlags)
{
	if (sNotificationModule == NULL)
		return B_NOT_SUPPORTED;

	char messageBuffer[512];
	KMessage message;
	message.SetTo(messageBuffer, sizeof(messageBuffer), B_NETWORK_MONITOR);
	message.AddInt32("opcode", B_NETWORK_INTERFACE_CHANGED);
	message.AddString("interface", interface->name);
	if (oldFlags != newFlags) {
		message.AddInt32("old flags", oldFlags);
		message.AddInt32("new flags", newFlags);
	}

	return sNotificationModule->send_notification(&message);
}
status_t
NotificationManager::UpdateListener(const char* serviceName,
	uint32 eventMask, NotificationListener& listener)
{
	char buffer[96];
	KMessage specifier;
	specifier.SetTo(buffer, sizeof(buffer), 0);
	specifier.AddInt32(kEventMaskString, eventMask);

	return UpdateListener(serviceName, &specifier, listener);
}
예제 #7
0
status_t
notify_interface_removed(net_interface* interface)
{
	if (sNotificationModule == NULL)
		return B_NOT_SUPPORTED;

	char messageBuffer[512];
	KMessage message;
	message.SetTo(messageBuffer, sizeof(messageBuffer), B_NETWORK_MONITOR);
	message.AddInt32("opcode", B_NETWORK_INTERFACE_REMOVED);
	message.AddString("interface", interface->name);

	return sNotificationModule->send_notification(&message);
}
// _SendRequestReply
status_t
AuthenticationServer::_SendRequestReply(port_id port, int32 token,
	status_t error, bool cancelled, const char* user, const char* password)
{
	// prepare the reply
	KMessage reply;
	reply.AddInt32("error", error);
	if (error == B_OK) {
		reply.AddBool("cancelled", cancelled);
		if (!cancelled) {
			reply.AddString("user", user);
			reply.AddString("password", password);
		}
	}
	// send the reply
	return reply.SendTo(port, token);
}
예제 #9
0
void
ieee80211_notify_scan_done(struct ieee80211vap* vap)
{
	release_sem_etc(vap->iv_ifp->scan_done_sem, 1,
		B_DO_NOT_RESCHEDULE | B_RELEASE_ALL);

	TRACE("%s\n", __FUNCTION__);

	if (sNotificationModule != NULL) {
		char messageBuffer[512];
		KMessage message;
		message.SetTo(messageBuffer, sizeof(messageBuffer), B_NETWORK_MONITOR);
		message.AddInt32("opcode", B_NETWORK_WLAN_SCANNED);
		message.AddString("interface", vap->iv_ifp->device_name);

		sNotificationModule->send_notification(&message);
	}
}
예제 #10
0
void
ieee80211_notify_node_leave(struct ieee80211_node* ni)
{
	struct ieee80211vap* vap = ni->ni_vap;
	struct ifnet* ifp = vap->iv_ifp;

	if (ni == vap->iv_bss)
		if_link_state_change(ifp, LINK_STATE_DOWN);

	TRACE("%s\n", __FUNCTION__);

	if (sNotificationModule != NULL) {
		char messageBuffer[512];
		KMessage message;
		message.SetTo(messageBuffer, sizeof(messageBuffer), B_NETWORK_MONITOR);
		message.AddInt32("opcode", B_NETWORK_WLAN_LEFT);
		message.AddString("interface", ifp->device_name);
		// TODO: add data about the node

		sNotificationModule->send_notification(&message);
	}
}