Sleds/K2Daemon/ClientCache.h

43 lines
1.5 KiB
C
Raw Normal View History

2025-03-13 21:28:38 +00:00
/*
Copyright (c) 2013 IOnU Security Inc. All rights reserved
Created August 2013 by Kendrick Webster
K2Daemon/ClientCache.h - header for client cache module
This module encapsulates containers for efficiently storing
and accessing client connection and retry state data. Its
public functions operate on that data.
It has grown organically to a size that probably requires
refactoring. Potential sub-modules include: UDP protocol,
client cache, retry cache, high-level message handlers.
*/
#pragma once
#include "ClientMap.h"
namespace ClientCache
{
// handle a received UDP datagram of <len> octects in global <buf>
// with data format and semantics described by K2Client/K2IPC.h
void HandlePacket(unsigned int len);
// sends message <info> to the client identified by <client_urn> if it is connected and idle
typedef enum
{
SENT_PENDING_ACK, // message sent, awaiting ACK
CLIENT_OFFLINE, // client is not logged in
CLIENT_BUSY // awaiting ACK for an earlier message
}
send_message_result_t;
send_message_result_t SendMessage(const char* nqueue_id, const char* client_urn, const char* info);
// send a device status notification (<info>) to the device identified by <client_id>
void SendDeviceStatus(ClientMap::id_t client_id, const char* info);
// Timer event for retries and timeouts
void Timer();
// Dump a list of connected clients to the logger
void DumpClients();
}