ascii-chat 0.11.33
Video chat in your terminal
Loading...
Searching...
No Matches
/home/runner/work/ascii-chat/ascii-chat/include/ascii-chat/discovery/nouns.h

Generate a unique client ID (noun only, no counter or port)

Generate a unique client ID (noun only, no counter or port)Returns just the noun part without counters or transport information. Used for internal client identification in thread names, buffer pools, event logs, etc.

Parameters
bufferOutput buffer for the generated ID
buffer_sizeSize of the output buffer (minimum recommended: 32 bytes)
Returns
0 on success, -1 on error (invalid args or buffer too small)
Note
Does not guarantee uniqueness. For user-facing names, use generate_client_name() instead.
char id[32];
if (generate_client_id(id, sizeof(id)) == 0) {
printf("Client ID: %s\n", id); // Output: "Client ID: mountain"
}
int generate_client_id(char *buffer, size_t buffer_size)
Generate a unique client ID (noun only, no counter or port)
Definition nouns.c:780
See also
generate_client_name() for client display names with uniqueness guarantees
#ifndef ASCII_CHAT_DISCOVERY_NOUNS_H
#define ASCII_CHAT_DISCOVERY_NOUNS_H
#include <stddef.h>
#include <stdbool.h>
extern const char *nouns[];
extern const size_t nouns_count;
int generate_client_id(char *buffer, size_t buffer_size);
int generate_client_name(char *buffer, size_t buffer_size, void *existing_clients_hash, int port, bool is_tcp);
#endif // ASCII_CHAT_DISCOVERY_NOUNS_H
int buffer_size
Size of circular buffer.
Definition grep.c:90
const char * nouns[]
Array of English nouns for session and client naming.
Definition nouns.c:55
const size_t nouns_count
Count of nouns in the nouns array.
Definition nouns.c:772
int generate_client_name(char *buffer, size_t buffer_size, void *existing_clients_hash, int port, bool is_tcp)
Generate a unique client name from the nouns wordlist.
Definition nouns.c:809
ClangTool/LibTooling compatibility shim for stdbool.h.