- Add generate_qr_code() function for creating QR codes from PrivateBin links - Implement SVG output format for scalable QR code generation - Add qr_generator.h/cpp with self-contained QR code implementation - Update CMakeLists.txt to include new QR code source files - Integrate QR code documentation into README.md - Update example program to demonstrate QR code generation - Update CHANGELOG.md with v0.1.1.6 release notes - Remove separate README_QR_CODE.md file The implementation provides simplified QR code generation with: - Position detection patterns for QR code recognition - Configurable size and border parameters - No external dependencies - Comprehensive error handling - Memory management using existing free_string() function
102 lines
3.8 KiB
C
102 lines
3.8 KiB
C
#ifndef PRIVATEBIN_API_H
|
|
#define PRIVATEBIN_API_H
|
|
|
|
#ifdef _WIN32
|
|
#ifdef PRIVATEBINAPI_EXPORTS
|
|
#define PRIVATEBIN_API __declspec(dllexport)
|
|
#else
|
|
#define PRIVATEBIN_API __declspec(dllimport)
|
|
#endif
|
|
#else
|
|
#define PRIVATEBIN_API
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/**
|
|
* Creates a new paste on a PrivateBin server
|
|
*
|
|
* @param server_url The URL of the PrivateBin server
|
|
* @param content The content to paste
|
|
* @param password Optional password for the paste (can be NULL)
|
|
* @param expiration Expiration time ("5min", "10min", "1hour", "1day", "1week", "1month", "1year", "never")
|
|
* @param format Format of the paste ("plaintext", "syntaxhighlighting", "markdown")
|
|
* @param burn_after_reading Set to 1 to enable burn after reading, 0 to disable
|
|
* @param open_discussion Set to 1 to enable discussion, 0 to disable
|
|
* @param paste_url Output parameter for the URL of the created paste
|
|
* @param delete_token Output parameter for the deletion token
|
|
* @return 0 on success, error code on failure
|
|
*/
|
|
PRIVATEBIN_API int create_paste(const char* server_url, const char* content,
|
|
const char* password, const char* expiration,
|
|
const char* format, int burn_after_reading,
|
|
int open_discussion, char** paste_url,
|
|
char** delete_token);
|
|
|
|
/**
|
|
* Uploads a file to a PrivateBin server
|
|
*
|
|
* @param server_url The URL of the PrivateBin server
|
|
* @param file_path The path to the file to upload
|
|
* @param password Optional password for the paste (can be NULL)
|
|
* @param expiration Expiration time ("5min", "10min", "1hour", "1day", "1week", "1month", "1year", "never")
|
|
* @param burn_after_reading Set to 1 to enable burn after reading, 0 to disable
|
|
* @param open_discussion Set to 1 to enable discussion, 0 to disable
|
|
* @param paste_url Output parameter for the URL of the created paste
|
|
* @param delete_token Output parameter for the deletion token
|
|
* @return 0 on success, error code on failure
|
|
*/
|
|
PRIVATEBIN_API int upload_file(const char* server_url, const char* file_path,
|
|
const char* password, const char* expiration,
|
|
int burn_after_reading, int open_discussion,
|
|
char** paste_url, char** delete_token);
|
|
|
|
/**
|
|
* Retrieves a paste from a PrivateBin server
|
|
*
|
|
* @param server_url The URL of the PrivateBin server
|
|
* @param paste_id The ID of the paste to retrieve
|
|
* @param key The decryption key for the paste
|
|
* @param content Output parameter for the content of the paste
|
|
* @return 0 on success, error code on failure
|
|
*/
|
|
PRIVATEBIN_API int get_paste(const char* server_url, const char* paste_id,
|
|
const char* key, char** content);
|
|
|
|
/**
|
|
* Deletes a paste from a PrivateBin server
|
|
*
|
|
* @param server_url The URL of the PrivateBin server
|
|
* @param paste_id The ID of the paste to delete
|
|
* @param delete_token The deletion token for the paste
|
|
* @return 0 on success, error code on failure
|
|
*/
|
|
PRIVATEBIN_API int delete_paste(const char* server_url, const char* paste_id,
|
|
const char* delete_token);
|
|
|
|
/**
|
|
* Generates a QR code for a PrivateBin link
|
|
*
|
|
* @param url The PrivateBin URL to encode in the QR code
|
|
* @param qr_code_data Output parameter for the QR code data (SVG format)
|
|
* @param size The size of the QR code in pixels (default: 256)
|
|
* @param border The border size around the QR code in modules (default: 4)
|
|
* @return 0 on success, error code on failure
|
|
*/
|
|
PRIVATEBIN_API int generate_qr_code(const char* url, char** qr_code_data,
|
|
int size, int border);
|
|
|
|
/**
|
|
* Frees memory allocated by the API functions
|
|
*
|
|
* @param str The string to free
|
|
*/
|
|
PRIVATEBIN_API void free_string(char* str);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif // PRIVATEBIN_API_H
|