UPnPsdk 0.1
Universal Plug and Play +, Software Development Kit
 
Loading...
Searching...
No Matches
client_table.cpp
Go to the documentation of this file.
1// Copyright (C) 2022+ GPL 3 and higher by Ingo Höft, <Ingo@Hoeft-online.de>
2// Redistribution only with this Copyright remark. Last modified: 2024-03-02
3// Also Copyright by other contributor which haven't made a note.
4// Last compare with pupnp original source file on 2023-06-22, ver 1.14.16
14#include <client_table.hpp>
15
17#include <cstdlib> /* for calloc(), free() */
19
21 ThreadPoolJob tempJob;
22 if (sub) {
23 int renewEventId = GenlibClientSubscription_get_RenewEventId(sub);
26 if (renewEventId != -1) {
27 /* do not remove timer event of copy */
28 /* invalid timer event id */
29 if (TimerThreadRemove(&gTimerThread, renewEventId, &tempJob) == 0) {
30 tempJob.free_func(tempJob.arg);
31 }
32 }
34 }
35}
36
39 while (list) {
43 list = next;
44 }
45}
46
48 const UpnpString* sid) {
49 GenlibClientSubscription* finger = *head;
50 GenlibClientSubscription* previous = NULL;
51 int found = 0;
52 while (finger) {
53 found = !strcmp(UpnpString_get_String(sid),
55 if (found) {
56 if (previous) {
58 previous, GenlibClientSubscription_get_Next(finger));
59 } else {
61 }
63 freeClientSubList(finger);
64 finger = NULL;
65 } else {
66 previous = finger;
67 finger = GenlibClientSubscription_get_Next(finger);
68 }
69 }
70}
71
73 const UpnpString* sid) {
74 GenlibClientSubscription* next = head;
75 int found = 0;
76 while (next) {
77 found = !strcmp(GenlibClientSubscription_get_SID_cstr(next),
79 if (found) {
80 break;
81 } else {
83 }
84 }
85
86 return next;
87}
88
90 token* sid) {
91 GenlibClientSubscription* next = head;
92 while (next) {
94 sid->buff, sid->size)) {
95 break;
96 } else {
98 }
99 }
100
101 return next;
102}
size_t size
Size of the buffer.
Definition uri.hpp:78
const char * buff
Buffer.
Definition uri.hpp:77
Buffer used in parsinghttp messages, urls, etc. Generally this simply holds a pointer into a larger a...
Definition uri.hpp:76
int GenlibClientSubscription_set_RenewEventId(GenlibClientSubscription *p, int n)
const char * GenlibClientSubscription_get_ActualSID_cstr(const GenlibClientSubscription *p)
GenlibClientSubscription * GenlibClientSubscription_get_Next(const GenlibClientSubscription *p)
int GenlibClientSubscription_set_Next(GenlibClientSubscription *p, GenlibClientSubscription *n)
const char * GenlibClientSubscription_get_SID_cstr(const GenlibClientSubscription *p)
int GenlibClientSubscription_strcpy_ActualSID(GenlibClientSubscription *p, const char *s)
int GenlibClientSubscription_strcpy_EventURL(GenlibClientSubscription *p, const char *s)
int GenlibClientSubscription_get_RenewEventId(const GenlibClientSubscription *p)
void GenlibClientSubscription_delete(GenlibClientSubscription *q)
Genlib Client subscription.
Internal ThreadPool Job.
int TimerThreadRemove(TimerThread *timer, int id, ThreadPoolJob *out)
Removes an event from the timer Q.
void free_client_subscription(GenlibClientSubscription *sub)
Free memory allocated for client subscription data.
GenlibClientSubscription * GetClientSubClientSID(GenlibClientSubscription *head, const UpnpString *sid)
Return the client subscription from the client table that matches const Upnp_SID sid subscrition id v...
void RemoveClientSubClientSID(GenlibClientSubscription **head, const UpnpString *sid)
Remove the client subscription matching the subscritpion id represented by the const Upnp_SID sid par...
void freeClientSubList(GenlibClientSubscription *list)
Free the client subscription table.
GenlibClientSubscription * GetClientSubActualSID(GenlibClientSubscription *head, token *sid)
Returns the client subscription from the client subscription table that has the matching token *sid b...
Internal implementation of the class UpnpString.
PUPNP_Api const char * UpnpString_get_String(const UpnpString *p)
Returns the pointer to char.
TimerThread gTimerThread
Global timer thread.
Definition upnpapi.cpp:256