+#include <sys/socket.h>
+#include <sys/types.h>
+#include <sys/un.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+class eDVBCAService;
+
+typedef std::map<eServiceReferenceDVB, eDVBCAService*> CAServiceMap;
+
+class eDVBCAService: public Object
+{
+ eServiceReferenceDVB m_service;
+ uint8_t m_used_demux[32];
+ unsigned int m_prev_build_hash;
+
+ int m_sock, m_clilen;
+ struct sockaddr_un m_servaddr;
+ unsigned int m_sendstate;
+ unsigned char m_capmt[2048];
+ eTimer m_retryTimer;
+ void sendCAPMT();
+ void Connect();
+
+ static CAServiceMap exist;
+ eDVBCAService();
+ ~eDVBCAService();
+public:
+ static RESULT register_service( const eServiceReferenceDVB &ref, int demux_nums[2], eDVBCAService *&caservice );
+ static RESULT unregister_service( const eServiceReferenceDVB &ref, int demux_nums[2], eTable<ProgramMapSection> *ptr );
+ void buildCAPMT(eTable<ProgramMapSection> *ptr);
+};
+