/*
SSSD
KCM Server - the KCM operations wait queue
Copyright (C) Red Hat, 2017
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "util/util_creds.h"
#include "responder/kcm/kcmsrv_pvt.h"
struct kcm_ops_queue_entry {
};
struct kcm_ops_queue {
};
struct kcm_ops_queue_ctx {
/* UID:kcm_ops_queue */
};
/*
* Per-UID wait queue
*
* They key in the hash table is the UID of the peer. The value of each
* hash table entry is kcm_ops_queue structure which in turn contains a
* linked list of kcm_ops_queue_entry structures * which primarily hold the
* tevent request being queued.
*/
{
return NULL;
}
&queue_ctx->wait_queue_hash, 0, 0, 0, 0,
return NULL;
}
return queue_ctx;
}
struct tevent_immediate *imm,
void *private_data)
{
struct kcm_ops_queue);
int ret;
return;
}
/* If this was the last entry, remove the key (the UID) from the
* hash table to signal the queue is empty
*/
if (ret != HASH_SUCCESS) {
return;
}
}
{
return 1;
}
/* Take the next entry from the queue */
/* Remove the current entry from the queue */
if (next_entry == NULL) {
/* If there was no other entry, schedule removal of the queue. Do it
* in another tevent tick to avoid issues with callbacks invoking
* the descructor while another request is touching the queue
*/
return 1;
}
return 0;
}
/* Otherwise, mark the current head as done to run the next request */
return 0;
}
struct tevent_context *ev,
{
switch (ret) {
case HASH_SUCCESS:
return NULL;
}
return NULL;
}
break;
case HASH_ERROR_KEY_NOT_FOUND:
/* No request for this UID yet. Enqueue this request in case
* another one comes in and return EOK to run the current request
* immediately
*/
return NULL;
}
if (ret != HASH_SUCCESS) {
return NULL;
}
break;
default:
return NULL;
}
return kq;
}
struct kcm_op_queue_state {
};
struct tevent_req *req);
/*
* Enqueue a request.
*
* If the request queue /for the given ID/ is empty, that is, if this
* request is the first one in the queue, run the request immediately.
*
* Otherwise just add it to the queue and wait until the previous request
* finishes and only at that point mark the current request as done, which
* will trigger calling the recv function and allow the request to continue.
*/
struct tevent_context *ev,
struct kcm_ops_queue_ctx *qctx,
{
return NULL;
}
goto immediate;
}
"Queue was empty, running the request immediately\n");
goto immediate;
goto immediate;
}
return req;
} else {
}
return req;
}
struct tevent_req *req)
{
struct kcm_op_queue_state);
return ENOMEM;
}
/* First entry, will run callback at once */
} else {
/* Will wait for the previous callbacks to finish */
}
return ret;
}
/*
* The queue recv function is called when this request is 'activated'. The queue
* entry should be allocated on the same memory context as the enqueued request
* to trigger freeing the kcm_ops_queue_entry structure destructor when the
* parent request is done and its tevent_req freed. This would in turn unblock
* the next request in the queue
*/
struct kcm_ops_queue_entry **_entry)
{
struct kcm_op_queue_state);
return EOK;
}