[SOLVED] CS #pragma once

$25

File Name: CS_#pragma_once.zip
File Size: 141.3 KB

5/5 - (1 vote)

#pragma once

#include

#include ../common/bytevec.h
#include ../common/protocol.h

#include storage.h

/// In response to a request for a key, do a reliable send of the contents of
/// the pubfile
///
/// @param sdThe socket on which to write the pubfile
/// @param pubfile A vector consisting of pubfile contents
///
/// @return false, to indicate that the server shouldnt stop
bool handle_key(int sd, const bytevec &pubfile);

/// Respond to an ALL command by generating a list of all the usernames in the
/// Auth table and returning them, one per line.
///
/// @param sdThe socket onto which the result should be written
/// @param storage The Storage object, which contains the auth table
/// @param ctx The AES encryption context
/// @param req The unencrypted contents of the request
///
/// @return false, to indicate that the server shouldnt stop
bool handle_all(int sd, Storage &storage, EVP_CIPHER_CTX *ctx,
const bytevec &req);

/// Respond to a SET command by putting the provided data into the Auth table
///
/// @param sdThe socket onto which the result should be written
/// @param storage The Storage object, which contains the auth table
/// @param ctx The AES encryption context
/// @param req The unencrypted contents of the request
///
/// @return false, to indicate that the server shouldnt stop
bool handle_set(int sd, Storage &storage, EVP_CIPHER_CTX *ctx,
const bytevec &req);

/// Respond to a GET command by getting the data for a user
///
/// @param sdThe socket onto which the result should be written
/// @param storage The Storage object, which contains the auth table
/// @param ctx The AES encryption context
/// @param req The unencrypted contents of the request
///
/// @return false, to indicate that the server shouldnt stop
bool handle_get(int sd, Storage &storage, EVP_CIPHER_CTX *ctx,
const bytevec &req);

/// Respond to a REG command by trying to add a new user
///
/// @param sdThe socket onto which the result should be written
/// @param storage The Storage object, which contains the auth table
/// @param ctx The AES encryption context
/// @param req The unencrypted contents of the request
///
/// @return false, to indicate that the server shouldnt stop
bool handle_reg(int sd, Storage &storage, EVP_CIPHER_CTX *ctx,
const bytevec &req);

/// Respond to a BYE command by returning false, but only if the user
/// authenticates
///
/// @param sdThe socket onto which the result should be written
/// @param storage The Storage object, which contains the auth table
/// @param ctx The AES encryption context
/// @param req The unencrypted contents of the request
///
/// @return true, to indicate that the server should stop, or false on an error
bool handle_bye(int sd, Storage &storage, EVP_CIPHER_CTX *ctx,
const bytevec &req);

/// Respond to a SAV command by persisting the file, but only if the user
/// authenticates
///
/// @param sdThe socket onto which the result should be written
/// @param storage The Storage object, which contains the auth table
/// @param ctx The AES encryption context
/// @param req The unencrypted contents of the request
///
/// @return false, to indicate that the server shouldnt stop
bool handle_sav(int sd, Storage &storage, EVP_CIPHER_CTX *ctx,
const bytevec &req);

/// Respond to a KVA command by generating a list of all the keys in the
/// KV Store and returning them, one per line.
///
/// @param sdThe socket onto which the result should be written
/// @param storage The Storage object
/// @param ctx The AES encryption context
/// @param req The unencrypted contents of the request
///
/// @return false, to indicate that the server shouldnt stop
bool handle_kva(int sd, Storage &storage, EVP_CIPHER_CTX *ctx,
const bytevec &req);

/// Respond to a KVI command by putting the provided key/value pair into the KV
/// Store only if it doesnt already exist
///
/// @param sdThe socket onto which the result should be written
/// @param storage The Storage object, which contains the auth table
/// @param ctx The AES encryption context
/// @param req The unencrypted contents of the request
///
/// @return false, to indicate that the server shouldnt stop
bool handle_kvi(int sd, Storage &storage, EVP_CIPHER_CTX *ctx,
const bytevec &req);

/// Respond to a KVU command by putting the provided key/value pair into the KV
/// Store, or updating if the key is already present
///
/// @param sdThe socket onto which the result should be written
/// @param storage The Storage object, which contains the auth table
/// @param ctx The AES encryption context
/// @param req The unencrypted contents of the request
///
/// @return false, to indicate that the server shouldnt stop
bool handle_kvu(int sd, Storage &storage, EVP_CIPHER_CTX *ctx,
const bytevec &req);

/// Respond to a KVG command by getting the data for a key
///
/// @param sdThe socket onto which the result should be written
/// @param storage The Storage object, which contains the auth table
/// @param ctx The AES encryption context
/// @param req The unencrypted contents of the request
///
/// @return false, to indicate that the server shouldnt stop
bool handle_kvg(int sd, Storage &storage, EVP_CIPHER_CTX *ctx,
const bytevec &req);

/// Respond to a KVD command by deleting a key/value mapping
///
/// @param sdThe socket onto which the result should be written
/// @param storage The Storage object, which contains the auth table
/// @param ctx The AES encryption context
/// @param req The unencrypted contents of the request
///
/// @return false, to indicate that the server shouldnt stop
bool handle_kvd(int sd, Storage &storage, EVP_CIPHER_CTX *ctx,
const bytevec &req);

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] CS #pragma once
$25