]> git.proxmox.com Git - ceph.git/blob - ceph/src/common/random_string.h
import 15.2.0 Octopus source
[ceph.git] / ceph / src / common / random_string.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab ft=cpp
3
4 /*
5 * Ceph - scalable distributed file system
6 *
7 * Copyright (C) 2004-2009 Sage Weil <sage@newdream.net>
8 * Copyright (C) 2015 Yehuda Sadeh <yehuda@redhat.com>
9 *
10 * This is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License version 2.1, as published by the Free Software
13 * Foundation. See file COPYING.
14 *
15 */
16
17 #pragma once
18
19 #include <string>
20 #include "include/common_fwd.h"
21
22 /* size should be the required string size + 1 */
23 int gen_rand_base64(CephContext *cct, char *dest, size_t size);
24 void gen_rand_alphanumeric(CephContext *cct, char *dest, size_t size);
25 void gen_rand_alphanumeric_lower(CephContext *cct, char *dest, size_t size);
26 void gen_rand_alphanumeric_upper(CephContext *cct, char *dest, size_t size);
27 void gen_rand_alphanumeric_no_underscore(CephContext *cct, char *dest, size_t size);
28 void gen_rand_alphanumeric_plain(CephContext *cct, char *dest, size_t size);
29
30 // returns a std::string with 'size' random characters
31 std::string gen_rand_alphanumeric(CephContext *cct, size_t size);
32 std::string gen_rand_alphanumeric_lower(CephContext *cct, size_t size);
33 std::string gen_rand_alphanumeric_upper(CephContext *cct, size_t size);
34 std::string gen_rand_alphanumeric_no_underscore(CephContext *cct, size_t size);
35 std::string gen_rand_alphanumeric_plain(CephContext *cct, size_t size);