id
int64
0
755k
file_name
stringlengths
3
109
file_path
stringlengths
13
185
content
stringlengths
31
9.38M
size
int64
31
9.38M
language
stringclasses
1 value
extension
stringclasses
11 values
total_lines
int64
1
340k
avg_line_length
float64
2.18
149k
max_line_length
int64
7
2.22M
alphanum_fraction
float64
0
1
repo_name
stringlengths
6
65
repo_stars
int64
100
47.3k
repo_forks
int64
0
12k
repo_open_issues
int64
0
3.4k
repo_license
stringclasses
9 values
repo_extraction_date
stringclasses
92 values
exact_duplicates_redpajama
bool
2 classes
near_duplicates_redpajama
bool
2 classes
exact_duplicates_githubcode
bool
2 classes
exact_duplicates_stackv2
bool
1 class
exact_duplicates_stackv1
bool
2 classes
near_duplicates_githubcode
bool
2 classes
near_duplicates_stackv1
bool
2 classes
near_duplicates_stackv2
bool
1 class
15,155
ConnectionSettings.h
Studio3T_robomongo/src/robomongo/core/settings/ConnectionSettings.h
#pragma once #include <QString> #include <QVariant> #include <QVariantMap> #include <mongo/client/dbclient_base.h> #include <mongo/client/mongo_uri.h> #include <mongo/util/net/hostandport.h> namespace Robomongo { class CredentialSettings; class SshSettings; class SslSettings; class ReplicaSetSettings; /** * @brief Represents connection record */ class ConnectionSettings : public QObject { Q_OBJECT public: /** * @brief Creates ConnectionSettings with default values */ ConnectionSettings(bool isClone); /** * @brief Creates ConnectionSettings from mongo connection string URI */ ConnectionSettings(const mongo::MongoURI& uri, bool isClone); explicit ConnectionSettings(QVariantMap map, bool isClone); /** * @brief Cleanup used resources */ ~ConnectionSettings(); /** * @brief Creates completely new ConnectionSettings by cloning this record. */ ConnectionSettings *clone() const; /** * @brief Discards current state and applies state from 'source' ConnectionSettings. */ void apply(const ConnectionSettings *source); /** * @brief Converts to QVariantMap */ QVariant toVariant() const; void fromVariant(const QVariantMap &map); /** * @brief Name of connection */ std::string connectionName() const { return _connectionName; } void setConnectionName(const std::string &connectionName) { _connectionName = connectionName; } /** * @brief Server host */ std::string serverHost() const { return _host; } void setServerHost(const std::string &serverHost) { _host = serverHost; } /** * @brief Port of server */ int serverPort() const { return _port; } void setServerPort(const int port) { _port = port; } /** * @brief Default database */ std::string defaultDatabase() const { return _defaultDatabase; } void setDefaultDatabase(const std::string &defaultDatabase) { _defaultDatabase = defaultDatabase; } /** * Was this connection imported from somewhere? */ bool imported() const { return _imported; } void setImported(bool imported) { _imported = imported; } /** * @brief Adds credential to this connection */ void addCredential(CredentialSettings *credential); /** * @brief Clears and releases memory occupied by credentials */ void clearCredentials(); /** * @brief Checks whether this connection has primary credential * which is also enabled. */ bool hasEnabledPrimaryCredential() const; /** * @brief Returns primary credential */ CredentialSettings *primaryCredential() const; /** * @brief Returns number of credentials */ int credentialCount() const { return _credentials.size(); } /** * @brief Returns all credentials */ QList<CredentialSettings *> credentials() const { return _credentials; } /** * @brief Checks that auth required */ /*bool isAuthNeeded() const { bool userSpecified = !_userName.isEmpty(); bool passwordSpecified = !_userPassword.isEmpty(); return (userSpecified || passwordSpecified); }*/ /** * @brief Returns connection full address (i.e. locahost:8090) */ std::string getFullAddress() const; std::string getReadableName() const { if (_connectionName.empty()) return getFullAddress(); return _connectionName; } mongo::HostAndPort hostAndPort() const; SshSettings *sshSettings() const { return _sshSettings.get(); } SslSettings *sslSettings() const { return _sslSettings.get(); } ReplicaSetSettings *replicaSetSettings() const { return _replicaSetSettings.get(); } bool isReplicaSet() const { return _isReplicaSet; } void setReplicaSet(bool flag) { _isReplicaSet = flag; } QString uuid() const { return _uuid; } void setUuid(QString const& uuid) { _uuid = uuid; } private: CredentialSettings *findCredential(const std::string &databaseName) const; std::string _connectionName; std::string _host; int _port; std::string _defaultDatabase; mutable QList<CredentialSettings *> _credentials; std::unique_ptr<SshSettings> _sshSettings; std::unique_ptr<SslSettings> _sslSettings; bool _isReplicaSet; std::unique_ptr<ReplicaSetSettings> _replicaSetSettings; // Was this connection imported from somewhere? bool _imported; // Flag to check if this is a clone(copy) or original ConnectionSettings // Note: If this is not a clone connection settings, this object is original connection // ConnectionSettings object which is loaded/saved into Robomongo config. file. bool _clone = false; // If this is a clone connection settings, unique ID will be used to identify from which // original connection settings this object is cloned. // -1 for invalid(uninitialized) unique ID which should not be seen in theory int _uniqueId = -1; // UUID string taken from QUuid. // It is used to identify the unique ID of a connection settings object QString _uuid; }; } Q_DECLARE_METATYPE(Robomongo::ConnectionSettings *)
5,808
C++
.h
149
30.020134
107
0.62404
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,156
SettingsManager.h
Studio3T_robomongo/src/robomongo/core/settings/SettingsManager.h
#pragma once #include <QString> #include <QVariantMap> #include <QSet> #include <QDir> #include <vector> #include <cstdlib> #include "robomongo/core/Enums.h" namespace Robomongo { class ConnectionSettings; struct ConfigFileAndImportFunction; // Current cache directory auto const CacheDir = QString("%1/.3T/robo-3t/%2/cache/").arg(QDir::homePath()) .arg(PROJECT_VERSION); // Current config file auto const ConfigFilePath = QString("%1/.3T/robo-3t/%2/robo3t.json").arg(QDir::homePath()) .arg(PROJECT_VERSION); // Current config file directory auto const ConfigDir = QString("%1/.3T/robo-3t/%2/").arg(QDir::homePath()) .arg(PROJECT_VERSION); /* ----------------------------- SettingsManager ------------------------------ */ /** * @brief SettingsManager gives you access to all settings, that is used * by Robomongo. It can load() and save() them. Config file usually * located here: ~/.config/robomongo/robomongo.json * * You can access this manager via: * AppRegistry::instance().settingsManager() * * @threadsafe no */ class SettingsManager { public: typedef std::vector<ConnectionSettings *> ConnectionSettingsContainerType; typedef QMap<QString, QVariant> ToolbarSettingsContainerType; /** * @brief Creates SettingsManager for config file in default location * (usually ~/.config/robomongo/robomongo.json) */ SettingsManager(); /** * @brief Cleanup owned objects */ ~SettingsManager(); /** * @brief Load settings from config file. * @return true if success, false otherwise */ bool load(); /** * @brief Saves all settings to config file. * @return true if success, false otherwise */ bool save(); /** * @brief Adds connection to the end of list. * Connection now will be owned by SettingsManager. */ static void addConnection(ConnectionSettings *connection); /** * @brief Removes connection by index */ void removeConnection(ConnectionSettings *connection); /** * @brief Finds and returns original (non-clone) connection settings which is * loaded/saved from/into Robomongo config. file. * @return If uniqueID is valid returns original connection settings, * nullptr otherwise. */ ConnectionSettings* getConnectionSettingsByUuid(QString const& uuid) const; ConnectionSettings* getConnectionSettingsByUuid(std::string const& uuid) const; void reorderConnections(const ConnectionSettingsContainerType &connections); void setToolbarSettings(QString toolbarName, bool visible); /** * @brief Returns list of connections */ ConnectionSettingsContainerType connections() const { return _connections; } ToolbarSettingsContainerType toolbars() const { return _toolbars; } void setUuidEncoding(UUIDEncoding encoding) { _uuidEncoding = encoding; } UUIDEncoding uuidEncoding() const { return _uuidEncoding; } void setTimeZone(SupportedTimes timeZ) { _timeZone = timeZ; } SupportedTimes timeZone() const { return _timeZone; } void setViewMode(ViewMode viewMode) { _viewMode = viewMode; } ViewMode viewMode() const { return _viewMode; } void setAutocompletionMode(AutocompletionMode mode) { _autocompletionMode = mode; } AutocompletionMode autocompletionMode() const { return _autocompletionMode; } void setAutoExpand(bool isExpand) { _autoExpand = isExpand; } bool autoExpand() const { return _autoExpand; } void setAutoExec(bool isAutoExec) { _autoExec = isAutoExec; } bool autoExec() const { return _autoExec; } void setMinimizeToTray(bool isMinimizingToTray) { _minimizeToTray = isMinimizingToTray; } bool minimizeToTray() const { return _minimizeToTray; } void setLineNumbers(bool showLineNumbers) { _lineNumbers = showLineNumbers; } bool lineNumbers() const { return _lineNumbers; } void setLoadMongoRcJs(bool isLoadJs) { _loadMongoRcJs = isLoadJs; } bool loadMongoRcJs() const { return _loadMongoRcJs; } void setDisableConnectionShortcuts(bool isDisable) { _disableConnectionShortcuts = isDisable; } bool disableConnectionShortcuts() const { return _disableConnectionShortcuts; } void addAcceptedEulaVersion(QString const& version) { _acceptedEulaVersions.insert(version); } QSet<QString> const& acceptedEulaVersions() const { return _acceptedEulaVersions; } QSet<QString>::iterator addDbVersionConnected(QString const& version) { return _dbVersionsConnected.insert(version); } QSet<QString> const& dbVersionsConnected() const { return _dbVersionsConnected; } void setCheckForUpdates(bool checkForUpdates) { _checkForUpdates = checkForUpdates; } bool checkForUpdates() const { return _checkForUpdates; } void setBatchSize(int batchSize) { _batchSize = batchSize; } int batchSize() const { return _batchSize; } QString currentStyle() const { return _currentStyle; } void setCurrentStyle(const QString& style); QString textFontFamily() const { return _textFontFamily; } void setTextFontFamily(const QString& fontFamily); int textFontPointSize() const { return _textFontPointSize; } void setTextFontPointSize(int pointSize); int mongoTimeoutSec() const { return _mongoTimeoutSec; } int shellTimeoutSec() const { return _shellTimeoutSec; } void setShellTimeoutSec(int newValue) { _shellTimeoutSec = std::abs(newValue); } // True when settings from previous versions of Robomongo are imported void setImported(bool imported) { _imported = imported; } bool imported() const { return _imported; } QString anonymousID() const { return _anonymousID; } void addCacheData(QString const& key, QVariant const& value); QVariant cacheData(QString const& key) const; void setProgramExitedNormally(bool value) { _programExitedNormally = value; } bool programExitedNormally() const { return _programExitedNormally; } // Designed to be set only by human users bool disableHttpsFeatures() const { return _disableHttpsFeatures; } bool debugMode() const { return _debugMode; } /** * Returns number of imported connections */ int importedConnectionsCount(); private: /** * Load settings from the map. Existing settings will be overwritten. */ void loadFromMap(QVariantMap &map); /** * Save all settings to map. */ QVariantMap convertToMap() const; // Find existing anonymousID from Robomongo and 3T config files, if not found create // a new anonymousID. QString getOrCreateAnonymousID(QVariantMap const& map) const; /** * Load connection settings from previous versions of Robomongo */ void importFromOldVersion(); // Imports connections from oldConfigFilePath into current config file bool importFromFile(QString const& oldConfigFilePath); static bool importConnectionsFrom_0_8_5(); /** * @brief Version of settings schema currently loaded */ QString _version; UUIDEncoding _uuidEncoding; SupportedTimes _timeZone; ViewMode _viewMode; AutocompletionMode _autocompletionMode; bool _loadMongoRcJs; bool _autoExpand; bool _autoExec; bool _minimizeToTray; bool _lineNumbers; bool _disableConnectionShortcuts; bool _programExitedNormally = true; bool _disableHttpsFeatures = false; bool _debugMode = false; QSet<QString> _acceptedEulaVersions; QSet<QString> _dbVersionsConnected; int _batchSize; bool _checkForUpdates = true; QString _currentStyle; QString _textFontFamily; int _textFontPointSize; int _mongoTimeoutSec; int _shellTimeoutSec; // True when settings from previous versions of Robomongo are imported bool _imported; /** * @brief This is an anonymous string taken from QUuid that is generated when Robomongo * is first installed on a user's machine and then launched for the first time * It stays the same throughout all upgrades. */ QString _anonymousID; // Various cache data QMap<QString, QVariant> _cacheData; /** * @brief List of connections */ static std::vector<ConnectionSettings*> _connections; ToolbarSettingsContainerType _toolbars; // List of config. file absolute paths of old versions // Must be updated with care and with every new version. Details on cpp file. static std::vector<QString> const _configFilesOfOldVersions; }; }
9,513
C++
.h
199
38.150754
103
0.648666
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,157
ReplicaSetSettings.h
Studio3T_robomongo/src/robomongo/core/settings/ReplicaSetSettings.h
#pragma once #include <QString> #include <QVariant> #include <QVariantMap> #include <mongo/util/net/hostandport.h> #include <mongo/client/mongo_uri.h> namespace Robomongo { class ReplicaSetSettings { public: enum class ReadPreference { PRIMARY = 0, PRIMARY_PREFERRED = 1 // todo: Add all supported read preferences }; ReplicaSetSettings(); ReplicaSetSettings(const mongo::MongoURI& uri); /** * Clones Replica Set settings. */ ReplicaSetSettings* clone() const; /** * Converts to QVariantMap */ QVariant toVariant() const; void fromVariant(const QVariantMap &map); // Getters std::string const& setNameUserEntered() { return _setNameUserEntered; } std::string const& cachedSetName() { return _cachedSetName; } std::vector<std::string> const& members() const { return _members; } std::vector<mongo::HostAndPort> membersToHostAndPort() const; std::set<mongo::HostAndPort> membersToHostAndPortAsSet() const { auto const& members = membersToHostAndPort(); return std::set<mongo::HostAndPort>(members.begin(), members.end()); } ReadPreference readPreference() const { return _readPreference; } // Setters void setSetNameUserEntered(const std::string& setName) { _setNameUserEntered = setName; } void setCachedSetName(const std::string& setName) { _cachedSetName = setName; } void setMembers(const std::vector<std::string>& members); void setMembers(const std::vector<std::pair<std::string,bool>>& membersAndHealts); void deleteAllMembers() { _members.clear(); } void setReadPreference(ReadPreference readPreference) { _readPreference = readPreference; } private: std::string _setNameUserEntered; std::string _cachedSetName; std::vector<std::string> _members; ReadPreference _readPreference = ReadPreference::PRIMARY; }; }
2,115
C++
.h
53
31.641509
99
0.646335
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,158
ScriptEngine.h
Studio3T_robomongo/src/robomongo/core/engine/ScriptEngine.h
#pragma once #include <QObject> #include <QMutex> #include <mongo/scripting/engine.h> //#include <third_party/js-1.7/jsparse.h> #include "robomongo/core/domain/MongoShellResult.h" #include "robomongo/core/Enums.h" namespace Robomongo { class ConnectionSettings; class ScriptEngine : public QObject { Q_OBJECT public: ScriptEngine(ConnectionSettings *connection, int timeoutSec); ~ScriptEngine(); void init(bool isLoadMongoJs, const std::string& serverAddr = "", const std::string& dbName = ""); MongoShellExecResult exec(const std::string &script, const std::string &dbName = std::string(), AggrInfo aggrInfo = AggrInfo()); void interrupt(); void use(const std::string &dbName); void setBatchSize(int batchSize); void ping(); QStringList complete(const std::string &prefix, const AutocompletionMode mode); void invalidateDbCollectionsCache(); bool failedScope() const { return _failedScope; } void changeTimeout(int newTimeout) { _timeoutSec = newTimeout; } private: ConnectionSettings *_connection; MongoShellResult prepareResult(const std::string &type, const std::string &output, const std::vector<MongoDocumentPtr> &objects, qint64 elapsedms, const std::string &statement, AggrInfo aggrInfo = AggrInfo()); MongoShellExecResult prepareExecResult( const std::vector<MongoShellResult> &results, bool timeoutReached = false); std::string loadFile(const QString &path, bool throwOnError); std::string getString(const char *fieldName); bool statementize( const std::string &script, std::vector<std::string> &outVec, std::string &outError); int _timeoutSec; mongo::ScriptEngine *_engine; std::unique_ptr<mongo::Scope> _scope; // MozJSProxyScope bool _failedScope = false; QMutex _mutex; bool _initialized; }; }
2,084
C++
.h
46
36.130435
106
0.653979
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,159
private.h
Studio3T_robomongo/src/robomongo/ssh/private.h
#ifndef ROBOMONGO_SSH_PRIVATE_H #define ROBOMONGO_SSH_PRIVATE_H #ifdef __cplusplus extern "C" { #endif // We do not need to use IPv6 for local bind. But we do support IPv6 for remote connection. // It means we can ignore MSVC warning: "Use inet_ntop() or InetNtop() instead" of "inet_ntoa" #define _WINSOCK_DEPRECATED_NO_WARNINGS #include <libssh2.h> #include <stdarg.h> // for va_list in log functions #include "robomongo/ssh/ssh.h" #ifdef _WIN32 #include "robomongo/ssh/win.h" #else #include "robomongo/ssh/unix.h" #endif //===----------------------------------------------------------------------===// // Common constants //===----------------------------------------------------------------------===// enum { RBM_SUCCESS = 0, RBM_ERROR = -1, RBM_CHANNEL_CREATION_ERROR = -10, RBM_BUFSIZE = 16384, // Size of the in/out buffers }; //===----------------------------------------------------------------------===// // Data structures //===----------------------------------------------------------------------===// struct rbm_channel { struct rbm_session* session; LIBSSH2_CHANNEL *channel; rbm_socket_t socket; char *inbuf; char *outbuf; int bufmaxsize; }; struct rbm_session { rbm_socket_t localsocket; rbm_socket_t sshsocket; LIBSSH2_SESSION *sshsession; struct rbm_ssh_tunnel_config *config; struct rbm_channel **channels; // array of channels int channelssize; // number of channels struct rbm_ssh_session *publicsession; char lasterror[2048]; }; // Channels struct rbm_channel *rbm_channel_create(struct rbm_session* session, rbm_socket_t socket, LIBSSH2_CHANNEL *lchannel); void rbm_channel_close(struct rbm_channel *channel); struct rbm_channel *rbm_channel_find_by_socket(struct rbm_session *session, rbm_socket_t socket); void rbm_session_cleanup(struct rbm_session *session); int rbm_open_tunnel(struct rbm_session *connection); int rbm_ssh_setup(struct rbm_session *session); static rbm_socket_t socket_connect(struct rbm_session* session, char *ip, int port); LIBSSH2_SESSION *ssh_connect(struct rbm_session *rsession, rbm_socket_t sock, enum rbm_ssh_auth_type type, char *username, char *password, char *publickeypath, char *privatekeypath, char *passphrase); rbm_socket_t socket_listen(struct rbm_session *rsession, char *ip, int *port); //===----------------------------------------------------------------------===// // Logging //===----------------------------------------------------------------------===// int log_error(const char *format, ...); int log_msg(const char *format, ...); void ssh_log_v(struct rbm_session *session, enum rbm_ssh_log_type type, const char *format, va_list args, int errsave); void ssh_log_msg(struct rbm_session *session, const char *format, ...); void ssh_log_warn(struct rbm_session *session, const char *format, ...); void ssh_log_debug(struct rbm_session *session, const char *format, ...); void ssh_log_error(struct rbm_session *session, const char *format, ...); //===----------------------------------------------------------------------===// // Utils //===----------------------------------------------------------------------===// int rbm_array_add(void ***array, int *currentsize, void *data); int rbm_array_remove(void ***array, int *currentsize, void *data); #ifdef __cplusplus } #endif #endif // ROBOMONGO_SSH_PRIVATE_H
3,444
C++
.h
76
42.684211
138
0.586248
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,160
ssh.h
Studio3T_robomongo/src/robomongo/ssh/ssh.h
#ifndef ROBOMONGO_SSH_H #define ROBOMONGO_SSH_H #ifdef __cplusplus extern "C" { #endif enum rbm_ssh_log_type { RBM_SSH_LOG_TYPE_ERROR = 1, RBM_SSH_LOG_TYPE_WARN = 2, RBM_SSH_LOG_TYPE_INFO = 3, RBM_SSH_LOG_TYPE_DEBUG = 100 // log as much as possible }; enum rbm_ssh_auth_type { RBM_SSH_AUTH_TYPE_NONE = 0, RBM_SSH_AUTH_TYPE_PASSWORD = 1, RBM_SSH_AUTH_TYPE_PUBLICKEY = 2 }; /* * SSH Tunnel configuration */ struct rbm_ssh_tunnel_config { enum rbm_ssh_auth_type authtype; // Keys and optional passphrase char *privatekeyfile; char *publickeyfile; char *passphrase; // May be NULL or "" // Local IP and port to bind and listen to char *localip; unsigned int localport; // Remote host (domain or IPv4/v6) and port to connect to char *remotehost; // Resolved by the remote server unsigned int remoteport; // Username and password of remote user char *username; char *password; // May be NULL or "" // Remote host (domain or IPv4/v6) char *sshserverhost; unsigned int sshserverport; // Logging facilities enum rbm_ssh_log_type loglevel; void *logcontext; // Pointer to user-defined data (can be NULL) void (*logcallback)(void *logcontext, char *message, int level); }; struct rbm_ssh_session { char *lasterror; void *handle; // opaque pointer to rbm_session }; int rbm_ssh_init(); void rbm_ssh_cleanup(); struct rbm_ssh_session* rbm_ssh_session_create(struct rbm_ssh_tunnel_config *config); int rbm_ssh_open_tunnel(struct rbm_ssh_session *connection); int rbm_ssh_session_setup(struct rbm_ssh_session *session); void rbm_ssh_session_close(struct rbm_ssh_session *session); #ifdef __cplusplus } #endif #endif // ROBOMONGO_SSH_H
1,785
C++
.h
56
28.428571
85
0.696616
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,161
internal.h
Studio3T_robomongo/src/robomongo/ssh/temp/internal.h
#include "robomongo/ssh/ssh.h" #include <stdarg.h> int log_error(const char *format, ...); int log_msg(const char *format, ...); void ssh_log_v(rbm_ssh_session* session, enum rbm_ssh_log_type type, const char *format, va_list args, int errsave); void ssh_log_msg(rbm_ssh_session* session, const char *format, ...); void ssh_log_warn(rbm_ssh_session* session, const char *format, ...); void ssh_log_debug(rbm_ssh_session* session, const char *format, ...); void ssh_log_error(rbm_ssh_session* session, const char *format, ...);
530
C++
.h
9
57.555556
116
0.716216
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,162
temp_ssh.h
Studio3T_robomongo/src/robomongo/ssh/temp/temp_ssh.h
#ifndef ROBOMONGO_SSH_H #define ROBOMONGO_SSH_H #include <libssh2.h> #ifdef __cplusplus extern "C" { #endif #ifdef _WIN32 # define rbm_socket_t SOCKET # define rbm_socket_invalid INVALID_SOCKET #else # define rbm_socket_t int # define rbm_socket_invalid (-1) #endif enum rbm_ssh_log_type { RBM_SSH_LOG_TYPE_ERROR = 1, RBM_SSH_LOG_TYPE_WARN = 2, RBM_SSH_LOG_TYPE_INFO = 3, RBM_SSH_LOG_TYPE_DEBUG = 100 // log as much as possible }; enum rbm_ssh_auth_type { RBM_SSH_AUTH_TYPE_NONE = 0, RBM_SSH_AUTH_TYPE_PASSWORD = 1, RBM_SSH_AUTH_TYPE_PUBLICKEY = 2 }; struct rbm_ssh_session; /* * SSH Tunnel configuration */ typedef struct rbm_ssh_tunnel_config { enum rbm_ssh_auth_type authtype; enum rbm_ssh_log_type loglevel; // Keys and optional passphrase char *privatekeyfile; char *publickeyfile; char *passphrase; // May be NULL or "" // Local IP and port to bind and listen to char *localip; unsigned int localport; // Remote host and port to connect to char *remotehost; // Resolved by the remote server unsigned int remoteport; // Username and password of remote user char *username; char *password; // May be NULL or "" // Remote IP and (host, port) in remote network char *sshserverip; unsigned int sshserverport; // SSH port void *context; // pointer to user-defined data void (*logcallback)(struct rbm_ssh_session* session, char *message, int level); } rbm_ssh_tunnel_config; typedef struct rbm_ssh_channel { struct rbm_ssh_session* session; LIBSSH2_CHANNEL *channel; rbm_socket_t socket; char *inbuf; char *outbuf; int bufmaxsize; } rbm_ssh_channel; typedef struct rbm_ssh_session { rbm_socket_t localsocket; rbm_socket_t sshsocket; LIBSSH2_SESSION *sshsession; rbm_ssh_tunnel_config *config; rbm_ssh_channel **channels; int channelssize; // number of channels char lasterror[2048]; } rbm_ssh_session; int rbm_ssh_init(); void rbm_ssh_cleanup(); rbm_ssh_session* rbm_ssh_session_create(struct rbm_ssh_tunnel_config *config); int rbm_ssh_session_setup(rbm_ssh_session *session); void rbm_ssh_session_close(rbm_ssh_session *session); int rbm_ssh_open_tunnel(struct rbm_ssh_session *connection); #ifdef __cplusplus } #endif #endif // ROBOMONGO_SSH_H
2,358
C++
.h
77
27.233766
83
0.708278
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,164
common.h
Studio3T_robomongo/src/robomongo/utils/common.h
#pragma once // todo: rename to utils.h #include <string> #include <QObject> namespace Robomongo /* todo ::utils */ { class Event; class EventBus; // Special handler designed to be used in MongoDatanase and MongoServer classes and only for // event->isError() is true case. void genericEventErrorHandler( Event *event, const std::string &userFriendlyMessage, EventBus* bus, QObject* sender); bool fileExists(const QString& filePath); template<typename T> bool vectorContains(std::vector<T> const& vec, T const& value); QVariant getSetting(QString const& key); void saveSetting(QString const& key, QVariant const& value); }
678
C++
.h
18
33.611111
97
0.729358
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,165
StringOperations.h
Studio3T_robomongo/src/robomongo/utils/StringOperations.h
#pragma once #include <string> namespace Robomongo { // Capitalize first char (Mongo errors often come all lower case) std::string captilizeFirstChar(std::string str); }
180
C++
.h
7
23.285714
69
0.766082
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,166
RoboCrypt.h
Studio3T_robomongo/src/robomongo/utils/RoboCrypt.h
#include "SimpleCrypt.h" #include <string> #include <mongo/logger/log_severity.h> namespace Robomongo { class RoboCrypt { using LogAndSeverity = std::pair<std::string, mongo::logger::LogSeverity>; public: static SimpleCrypt& simpleCrypter() { static SimpleCrypt simpleCrypt(_KEY); return simpleCrypt; } static std::string encrypt(std::string passwd) { return simpleCrypter().encryptToString(QString::fromStdString(passwd)).toStdString(); } static std::string decrypt(std::string cryptedPasswd) { return simpleCrypter().decryptToString(QString::fromStdString(cryptedPasswd)).toStdString(); } // Read key from key file otherwise create a new key and save it into file static void initKey(); static std::vector<LogAndSeverity> const& roboCryptLogs() { return _roboCryptLogs; } private: static long long _KEY; static std::vector<LogAndSeverity> _roboCryptLogs; }; }
1,060
C++
.h
27
30.925926
104
0.657843
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,167
qtgui-config_p.h
Studio3T_robomongo/src/robomongo/utils/qzip/qtgui-config_p.h
#define QT_FEATURE_xcb -1 #define QT_FEATURE_accessibility_atspi_bridge -1 #define QT_FEATURE_angle_d3d11_qdtd 1 #define QT_FEATURE_direct2d 1 #define QT_FEATURE_directfb -1 #define QT_FEATURE_directwrite 1 #define QT_FEATURE_directwrite2 1 #define QT_FEATURE_egl 1 #define QT_FEATURE_egl_x11 -1 #define QT_FEATURE_eglfs -1 #define QT_FEATURE_eglfs_brcm -1 #define QT_FEATURE_eglfs_egldevice -1 #define QT_FEATURE_eglfs_gbm -1 #define QT_FEATURE_eglfs_mali -1 #define QT_FEATURE_eglfs_viv -1 #define QT_FEATURE_eglfs_viv_wl -1 #define QT_FEATURE_evdev -1 #define QT_FEATURE_fontconfig -1 #define QT_FEATURE_freetype 1 #define QT_FEATURE_gif 1 #define QT_FEATURE_harfbuzz 1 #define QT_FEATURE_ico 1 #define QT_FEATURE_integrityfb -1 #define QT_FEATURE_integrityhid -1 #define QT_FEATURE_jpeg 1 #define QT_FEATURE_kms -1 #define QT_FEATURE_libinput -1 #define QT_FEATURE_libinput_axis_api -1 #define QT_FEATURE_linuxfb -1 #define QT_FEATURE_mirclient -1 #define QT_FEATURE_mtdev -1 #define QT_FEATURE_multiprocess 1 #define QT_FEATURE_png 1 #define QT_FEATURE_system_freetype -1 #define QT_FEATURE_system_harfbuzz -1 #define QT_FEATURE_system_jpeg -1 #define QT_FEATURE_system_png -1 #define QT_FEATURE_system_xcb -1 #define QT_FEATURE_tslib -1 #define QT_FEATURE_vnc -1 #define QT_FEATURE_xkbcommon_evdev -1 #define QT_FEATURE_xlib -1
1,334
C++
.h
42
30.761905
48
0.798762
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,168
qconfig_p.h
Studio3T_robomongo/src/robomongo/utils/qzip/qconfig_p.h
#define QT_FEATURE_alloca_h -1 #define QT_FEATURE_alloca_malloc_h 1 #define QT_FEATURE_alloca 1 #define QT_FEATURE_android_style_assets -1 #define QT_FEATURE_sse2 1 #define QT_FEATURE_private_tests -1 #define QT_FEATURE_dbus 1 #define QT_FEATURE_dbus_linked -1 #define QT_FEATURE_gui 1 #define QT_FEATURE_libudev -1 #define QT_FEATURE_network 1 #define QT_FEATURE_posix_fallocate -1 #define QT_FEATURE_qml_debug 1 #define QT_FEATURE_reduce_exports -1 #define QT_FEATURE_reduce_relocations -1 #define QT_FEATURE_release_tools -1 #define QT_FEATURE_sql 1 #define QT_FEATURE_stack_protector_strong -1 #define QT_FEATURE_system_zlib -1 #define QT_FEATURE_testlib 1 #define QT_FEATURE_widgets 1 #define QT_FEATURE_xml 1
715
C++
.h
22
31.5
44
0.803752
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,169
qtguiglobal_p.h
Studio3T_robomongo/src/robomongo/utils/qzip/qtguiglobal_p.h
/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 3 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL3 included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 3 requirements ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 2.0 or (at your option) the GNU General ** Public license version 3 or any later version approved by the KDE Free ** Qt Foundation. The licenses are as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will ** be met: https://www.gnu.org/licenses/gpl-2.0.html and ** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QTGUIGLOBAL_P_H #define QTGUIGLOBAL_P_H // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists purely as an // implementation detail. This header file may change from version to // version without notice, or even be removed. // // We mean it. // #include <QtGui/qtguiglobal.h> #include "qglobal_p.h" #include "qtgui-config_p.h" #endif // QTGUIGLOBAL_P_H
2,324
C++
.h
54
41.962963
77
0.707855
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,171
qtcore-config_p.h
Studio3T_robomongo/src/robomongo/utils/qzip/qtcore-config_p.h
#define QT_FEATURE_clock_gettime -1 #define QT_FEATURE_datetimeparser 1 #define QT_FEATURE_dlopen -1 #define QT_FEATURE_doubleconversion 1 #define QT_FEATURE_glib -1 #define QT_FEATURE_gnu_libiconv -1 #define QT_FEATURE_icu -1 #define QT_FEATURE_posix_libiconv -1 #define QT_FEATURE_iconv -1 #define QT_FEATURE_inotify -1 #define QT_FEATURE_journald -1 #define QT_FEATURE_sha3_fast 1 #define QT_FEATURE_slog2 -1 #define QT_FEATURE_syslog -1 #define QT_FEATURE_system_doubleconversion -1 #define QT_FEATURE_system_pcre2 -1
522
C++
.h
16
31.625
45
0.804348
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,172
qglobal_p.h
Studio3T_robomongo/src/robomongo/utils/qzip/qglobal_p.h
/**************************************************************************** ** ** Copyright (C) 2015 Intel Corporation. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 3 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL3 included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 3 requirements ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 2.0 or (at your option) the GNU General ** Public license version 3 or any later version approved by the KDE Free ** Qt Foundation. The licenses are as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will ** be met: https://www.gnu.org/licenses/gpl-2.0.html and ** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QGLOBAL_P_H #define QGLOBAL_P_H // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists purely as an // implementation detail. This header file may change from version to // version without notice, or even be removed. // // We mean it. // #include "qglobal.h" #include "qglobal_p.h" // include self to avoid syncqt warning - no-op #ifndef QT_BOOTSTRAPPED #include "qconfig_p.h" #include "qtcore-config_p.h" #endif #endif // QGLOBAL_P_H
2,412
C++
.h
57
41.210526
77
0.707535
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,174
ptimeutil.h
Studio3T_robomongo/src/robomongo/shell/db/ptimeutil.h
/* wdb - weather and water data storage Copyright (C) 2007 met.no Contact information: Norwegian Meteorological Institute Box 43 Blindern 0313 OSLO NORWAY E-mail: wdb@met.no This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 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, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #ifndef __RFC1123DATE_H__ #define __RFC1123DATE_H__ #include <string> #include <boost/date_time/posix_time/posix_time.hpp> namespace miutil { extern const long long minDate; extern const long long maxDate; /** * Takes an ptime and convert it to a time string coded in * the RFC 1123 format. This is the date format used by * the HTTP protocol. * * \b Ex. on RFC 1123 coded string * * Fri, 16 Mar 2007 08:13:37 GMT * * @param t the time to convert to a RFC 1123 coded string representation. * @return On success a string coded in the RFC 1123 format. On error an * empty string is returned. */ std::string rfc1123date(const boost::posix_time::ptime &t); /** * Takes an RFC 1123 coded date string and return an boost::posix_time. * * \b Ex. on RFC 1123 coded string * * Fri, 16 Mar 2007 08:13:37 GMT * * @param rfc1123 coded data string. * @return An valid ptime on success and not_a_date_time on failure. */ boost::posix_time::ptime rfc1123date(const std::string &rfc1123); /** * Takes an RFC 1123 coded date string and return an boost::posix_time. * * \b Ex. on RFC 1123 coded string * * Fri, 16 Mar 2007 08:13:37 GMT * * @param rfc1123 coded data string. * @return An valid ptime on success and not_a_date_time on failure. */ boost::posix_time::ptime rfc1123date(const char *rfc1123); /** * isotimeString generates a timeformatted string in one of two * iso compatible formats. * * - YYYY-MM-DD hh:mm:ss * - YYYY-MM-DDThh:mm:ss * * The second form separates the date part from the timepart with a T. * * If markAsZulu is true an Z is added to the end of the timestring. * * ex. 2008-02-15T18:00:00Z * * An empty string is returned if the \em time is not a valid * ptime, ie. the call to is_special return true. * * @param t the time to return as a string. * @param useTseparator is true if we want the datepart and timepart separated with a T. * @param markAsZulu Add an Z to the end of the timestring * @return An iso compatible string on success or an empty string if \em t is invalid. */ std::string isotimeString(const boost::posix_time::ptime &t, bool useTseparator=false, bool isLocalFormat=false); /** * ptimeFromIsoString decodes a time string on the followwing formates to a ptime. * * - YYYY-MM-DDThh:mm:ssZ * - YYYY-MM-DDThh:mm:ssSHHMM * - YYYYMMDDThhmmssSHHMM * - Sun, 01 Apr 2007 09:51:04 GMT * * Z is optional and means ZULU time (GMT). * S in front of HHMM stands for - or +. HHMM is an offset to UTC. * T is an optional separator it my bee an space. * * If the timestring is invallid an logic_error exception is thrown. * * @param isoTime A timestring. * @return An ptime. */ boost::posix_time::ptime ptimeFromIsoString( const std::string &isoTime); boost::posix_time::ptime ptimeFromIsoString( const std::string &isoTime, bool &isSuccessfull); } #endif
4,108
C++
.h
108
32.666667
117
0.68091
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,175
MainWindow.h
Studio3T_robomongo/src/robomongo/gui/MainWindow.h
#pragma once #include <QMainWindow> #include <QSystemTrayIcon> QT_BEGIN_NAMESPACE class QLabel; class QToolBar; class QDockWidget; class QToolButton; class QPushButton; class QTreeWidgetItem; class QNetworkReply; class QNetworkAccessManager; QT_END_NAMESPACE namespace Robomongo { class ConnectionFailedEvent; class ScriptExecutingEvent; class ScriptExecutedEvent; class OperationFailedEvent; class QueryWidgetUpdatedEvent; class WorkAreaTabWidget; class ConnectionMenu; class App; class ExplorerWidget; class WelcomeTab; class MainWindow : public QMainWindow { Q_OBJECT public: typedef QMainWindow BaseClass; MainWindow(); WelcomeTab* getWelcomeTab(); void showQueryWidgetProgressBar() const; void hideQueryWidgetProgressBar() const; public Q_SLOTS: void manageConnections(); void toggleOrientation(); void enterTextMode(); void enterTreeMode(); void enterTableMode(); void enterCustomMode(); void toggleAutoExpand(); void toggleAutoExec(); void toggleLineNumbers(); void executeScript(); void stopScript(); void toggleFullScreen2(); void selectNextTab(); void selectPrevTab(); void duplicateTab(); void refreshConnections(); void aboutRobomongo(); void open(); void save(); void saveAs(); void changeStyle(QAction *); void exit(); void setDefaultUuidEncoding(); void setJavaUuidEncoding(); void setCSharpUuidEncoding(); void setPythonUuidEncoding(); void setShellAutocompletionAll(); void setShellAutocompletionNoCollectionNames(); void setShellAutocompletionNone(); void setLoadMongoRcJs(); void setDisableConnectionShortcuts(); void toggleLogs(bool show); void connectToServer(QAction *action); void handle(ConnectionFailedEvent *event); void handle(ScriptExecutingEvent *event); void handle(ScriptExecutedEvent *event); void handle(QueryWidgetUpdatedEvent *event); void handle(OperationFailedEvent *event); protected: void keyPressEvent(QKeyEvent *event) override; void closeEvent(QCloseEvent *event) override; void hideEvent(QHideEvent *event) override; void showEvent(QShowEvent *event) override; bool eventFilter(QObject *target, QEvent *event) override; void resizeEvent(QResizeEvent* event) override; private Q_SLOTS: void updateMenus(); void setUtcTimeZone(); void setLocalTimeZone(); void openPreferences(); void openWelcomeTab(); void onConnectToolbarVisibilityChanged(bool isVisisble); void onOpenSaveToolbarVisibilityChanged(bool isVisisble); void onExecToolbarVisibilityChanged(bool isVisisble); void onExplorerVisibilityChanged(bool isVisisble); void on_tabChange(); void toggleMinimize(); void trayActivated(QSystemTrayIcon::ActivationReason reason); void toggleMinimizeToTray(); // On application focus changes void on_focusChanged(); void on_networkReply(QNetworkReply* reply); void on_closeButton_clicked(); void checkUpdates(); void toggleCheckUpdates(); void openShellTimeoutDialog(); private: void updateConnectionsMenu(); void createDatabaseExplorer(); void createTabs(); void createStylesMenu(); void createStatusBar(); void restoreWindowSettings(); void saveWindowSettings() const; void adjustUpdatesBarHeight(); QDockWidget *_logDock; WorkAreaTabWidget *_workArea; ExplorerWidget* _explorer; App *_app; ConnectionMenu *_connectionsMenu; QToolButton *_connectButton; QMenu *_viewMenu; QMenu *_toolbarsMenu; QAction *_connectAction; // Open/Save tool bar QAction *_openAction; QAction *_saveAction; QAction *_saveAsAction; // Execution tool bar QAction *_executeAction; QAction *_stopAction; QAction *_orientationAction; QToolBar *_execToolBar; QToolBar *_updateBar; QLabel *_updateLabel; QPushButton* _closeButton; QNetworkAccessManager *_networkAccessManager; #if defined(Q_OS_WIN) QSystemTrayIcon *_trayIcon; #endif bool _allowExit; bool _updateMenusAtStart = true; }; }
4,639
C++
.h
139
25.618705
69
0.676688
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,176
GuiRegistry.h
Studio3T_robomongo/src/robomongo/gui/GuiRegistry.h
#pragma once #include <QIcon> #include <QBrush> #include <QAbstractItemView> namespace Robomongo { /** * @brief GuiRegistry is a simple registry-like singleton, that provides access to * to another various singletons (including access to the data that is stored in * resources (i.e. gui.qrc) and caches it, if needed) */ class GuiRegistry { public: /** * @brief Returns single instance of GuiRegistry */ static GuiRegistry& instance() { static GuiRegistry _instance; return _instance; } void setAlternatingColor(QAbstractItemView *view); /** * @brief Functions that provide access to various icons */ const QIcon& serverIcon() const; const QIcon& serverImportedIcon() const; const QIcon& serverPrimaryIcon() const; const QIcon& serverSecondaryIcon() const; const QIcon& replicaSetIcon() const; const QIcon& replicaSetOfflineIcon() const; const QIcon& saveIcon() const; const QIcon& openIcon() const; const QIcon& databaseIcon() const; const QIcon& collectionIcon() const; const QIcon& indexIcon() const; const QIcon& userIcon() const; const QIcon& functionIcon() const; const QIcon& maximizeIcon() const; const QIcon& minimizeIcon() const; const QIcon& undockIcon() const; const QIcon& dockIcon() const; const QIcon& textIcon() const; const QIcon& textHighlightedIcon() const; const QIcon& treeIcon() const; const QIcon& treeHighlightedIcon() const; const QIcon& tableIcon() const; const QIcon& tableHighlightedIcon() const; const QIcon& customIcon() const; const QIcon& customHighlightedIcon() const; const QIcon& rotateIcon() const; const QIcon& visualIcon() const; const QIcon& folderIcon() const; const QIcon& circleIcon() const; const QIcon& leftIcon() const; const QIcon& rightIcon() const; const QIcon& mongodbIcon() const; const QIcon& mongodbIconForMAC() const; const QIcon& connectIcon() const; const QIcon& executeIcon() const; const QIcon& stopIcon() const; const QIcon& exportIcon() const; const QIcon& importIcon() const; const QIcon& deleteIcon() const; const QIcon& deleteIconRed() const; const QIcon& deleteIconMouseHovered() const; const QIcon& mainWindowIcon() const; const QIcon& bsonObjectIcon() const; const QIcon& bsonArrayIcon() const; const QIcon& bsonStringIcon() const; const QIcon& bsonIntegerIcon() const; const QIcon& bsonDoubleIcon() const; const QIcon& bsonNumberDecimalIcon() const; const QIcon& bsonDateTimeIcon() const; const QIcon& bsonBinaryIcon() const; const QIcon& bsonNullIcon() const; const QIcon& bsonBooleanIcon() const; const QIcon& noMarkIcon() const; const QIcon& yesMarkIcon() const; const QIcon& skipMarkIcon() const; const QIcon& questionMarkIcon() const; const QIcon& timeIcon() const; const QIcon& keyIcon() const; const QIcon& showIcon() const; const QIcon& hideIcon() const; const QIcon& plusIcon() const; const QIcon& minusIcon() const; const QIcon& welcomeTabIcon() const; const QBrush& typeBrush() const; const QFont& font() const; private: /** * @brief Private, because this is singleton */ GuiRegistry(); }; }
3,683
C++
.h
98
29.438776
91
0.636211
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,177
AppStyle.h
Studio3T_robomongo/src/robomongo/gui/AppStyle.h
#pragma once #include <QStyle> #include <QProxyStyle> namespace Robomongo { namespace AppStyleUtils { void initStyle(); void applyStyle(const QString &styleName); QStringList getSupportedStyles(); } class AppStyle : public QProxyStyle { Q_OBJECT public: static const QString StyleName; virtual void drawControl(ControlElement element, const QStyleOption * option, QPainter * painter, const QWidget * widget) const; virtual void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const; virtual QRect subElementRect( SubElement element, const QStyleOption * option, const QWidget * widget = 0 ) const; }; }
761
C++
.h
21
30.666667
137
0.720109
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,178
CreateDatabaseDialog.h
Studio3T_robomongo/src/robomongo/gui/dialogs/CreateDatabaseDialog.h
#pragma once #include <QDialog> QT_BEGIN_NAMESPACE class QLabel; class QDialogButtonBox; class QLineEdit; QT_END_NAMESPACE namespace Robomongo { class Indicator; class CreateDatabaseDialog : public QDialog { Q_OBJECT public: explicit CreateDatabaseDialog(const QString &serverName, const QString &database = QString(), const QString &collection = QString(), QWidget *parent = 0); QString databaseName() const; void setOkButtonText(const QString &text); void setInputLabelText(const QString &text); void setInputText(const QString &text); enum { maxLenghtName = 60 }; const static QSize dialogSize; public Q_SLOTS: virtual void accept(); private: Indicator *createDatabaseIndicator(const QString &database); Indicator *createCollectionIndicator(const QString &collection); QLineEdit *_inputEdit; QLabel *_inputLabel; QDialogButtonBox *_buttonBox; }; }
1,073
C++
.h
33
24.787879
98
0.656673
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,179
CreateUserDialog.h
Studio3T_robomongo/src/robomongo/gui/dialogs/CreateUserDialog.h
#pragma once #include <QDialog> QT_BEGIN_NAMESPACE class QTextEdit; class QLabel; class QCheckBox; class QLineEdit; class QComboBox; QT_END_NAMESPACE #include "robomongo/core/domain/MongoUser.h" namespace Robomongo { class CreateUserDialog : public QDialog { Q_OBJECT public: static const QSize minimumSize; CreateUserDialog(const QStringList &databases, const QString &serverName, const QString &database, const MongoUser &user, QWidget *parent = 0); CreateUserDialog(const QString &serverName, const QString &database, const MongoUser &user, QWidget *parent = 0); MongoUser user() const { return _user; } void setUserPasswordLabelText(const QString &text); enum { RolesCount = 9}; public Q_SLOTS: virtual void accept(); private: MongoUser _user; QLabel *_userNameLabel; QLineEdit *_userNameEdit; QLabel *_userPassLabel; QLineEdit *_userPassEdit; QLabel *_userSourceLabel; QComboBox *_userSourceComboBox; QCheckBox *_readOnlyCheckBox; QCheckBox *_rolesArray[RolesCount]; }; }
1,259
C++
.h
42
22.261905
81
0.640133
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,180
PreferencesDialog.h
Studio3T_robomongo/src/robomongo/gui/dialogs/PreferencesDialog.h
#pragma once #include <QDialog> QT_BEGIN_NAMESPACE class QComboBox; class QCheckBox; QT_END_NAMESPACE namespace Robomongo { class PreferencesDialog : public QDialog { Q_OBJECT public: typedef QDialog BaseClass; explicit PreferencesDialog(QWidget *parent); enum { height = 640, width = 480}; public Q_SLOTS: virtual void accept(); private: void syncWithSettings(); private: QComboBox *_defDisplayModeComboBox; QComboBox *_timeZoneComboBox; QComboBox *_uuidEncodingComboBox; QCheckBox *_loadMongoRcJsCheckBox; QCheckBox *_disabelConnectionShortcutsCheckBox; QComboBox *_stylesComboBox; }; }
717
C++
.h
28
20.071429
55
0.690962
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,181
ConnectionAdvancedTab.h
Studio3T_robomongo/src/robomongo/gui/dialogs/ConnectionAdvancedTab.h
#pragma once #include <QWidget> QT_BEGIN_NAMESPACE class QLineEdit; class QCheckBox; class QPushButton; QT_END_NAMESPACE namespace Robomongo { class ConnectionSettings; class ConnectionAdvancedTab : public QWidget { Q_OBJECT public: ConnectionAdvancedTab(ConnectionSettings *settings); void accept(); void setDefaultDb(const QString& defaultDb); /* --- Disabling unfinished export URI connection string feature private Q_SLOTS : void on_generateButton_clicked(); void on_copyButton_clicked(); void on_includePasswordsCheckBox_toggle(bool checked); */ private: QLineEdit *_defaultDatabaseName; /* --- Disabling unfinished export URI connection string feature QLineEdit *_uriString; QCheckBox *_includePasswordCheckBox; QPushButton *_copyButton; */ ConnectionSettings *_settings; }; }
940
C++
.h
33
22.727273
72
0.700445
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,182
ConnectionAuthTab.h
Studio3T_robomongo/src/robomongo/gui/dialogs/ConnectionAuthTab.h
#pragma once #include <QWidget> #include "robomongo/gui/utils/GuiConstants.h" QT_BEGIN_NAMESPACE class QLineEdit; class QLabel; class QCheckBox; class QPushButton; class QComboBox; QT_END_NAMESPACE namespace Robomongo { class ConnectionSettings; class ConnectionAuthTab : public QWidget { Q_OBJECT public: ConnectionAuthTab(ConnectionSettings *settings); void accept(); void setAuthTab( QString const db, QString const username, QString const pwd, AuthMechanism authMech ); void clearTab(); private Q_SLOTS: void toggleEchoMode(); void authChecked(bool checked); void useManuallyVisibleDbsChecked(bool checked); private: QLineEdit *_userName; QLabel *_userNameLabel; QLineEdit *_userPassword; QLabel *_userPasswordLabel; QLineEdit *_databaseName; QLabel *_databaseNameLabel; QLabel *_databaseNameDescriptionLabel; QCheckBox *_useAuth; QPushButton *_echoModeButton; QLabel *_mechanismLabel; QComboBox *_mechanismComboBox; QCheckBox *_useManuallyVisibleDbs; QLineEdit *_manuallyVisibleDbs; QLabel *_manuallyVisibleDbsLabel; QLabel *_manuallyVisibleDbsInfo; ConnectionSettings *const _settings; }; }
1,414
C++
.h
49
21.816327
56
0.660029
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,183
ExportDialog.h
Studio3T_robomongo/src/robomongo/gui/dialogs/ExportDialog.h
#pragma once #include <QDialog> #include <QProcess> QT_BEGIN_NAMESPACE class QLabel; class QDialogButtonBox; class QLineEdit; class QTreeWidgetItem; class QTreeWidget; class QComboBox; class QPushButton; class QGroupBox; class QTextEdit; class QProcess; QT_END_NAMESPACE namespace Robomongo { class Indicator; /** * @brief This class is not finished, it is still under development. * Currently export is disabled in the GUI. If enabled in GUI, export * will work with current code. However, the code is unfinished; * it needs to finished, reviewed and tested. * Currently, there is support for simultaneous export which can be done * on multiple export dialogs without blocking each other or main window. * So user can still work while multiple export dialogs are doing export. * This achieved by the assumption that there will be usable export executable for * Robomongo to use. Currently, this location is hard coded as * "D:\\mongo_export\\bin\\mongoexport.exe". One of the next actions will be * to design the location of mongoexport which should be cross-platform, * generic and not hard coded. */ class ExportDialog : public QDialog { Q_OBJECT enum MODE { AUTO = 0, MANUAL = 1 }; public: explicit ExportDialog(QString const& dbName, QString const& collName, QWidget *parent = 0); void setOkButtonText(const QString &text); void setInputLabelText(const QString &text); void setInputText(const QString &text); enum { maxLenghtName = 60 }; public Q_SLOTS: virtual void accept(); private Q_SLOTS: void ui_itemExpanded(QTreeWidgetItem *item); void ui_itemDoubleClicked(QTreeWidgetItem *item, int column); void on_browseButton_clicked(); void on_formatComboBox_change(int index); void on_modeButton_clicked(); void on_exportFinished(int exitCode, QProcess::ExitStatus exitStatus); void on_processErrorOccurred(QProcess::ProcessError); void on_viewOutputLink(QString); private: // todo: remove if unused Indicator *createDatabaseIndicator(const QString &database); Indicator *createCollectionIndicator(const QString &collection); // Enable/Disable widgets during/after export operation // @param enable: true to enable, false to disable widgets void enableDisableWidgets(bool enable) const; // Auto Mode QGroupBox* _inputsGroupBox; QComboBox* _formatComboBox; QLabel* _fieldsLabel; QLineEdit* _fields; QLineEdit* _query; QLineEdit* _outputFileName; QLineEdit* _outputDir; QPushButton* _browseButton; QGroupBox* _autoOutputsGroup; QTextEdit* _exportOutput; QLabel* _viewOutputLink; // QTextEdit* _mongoExportOutput; // Manual Mode QTextEdit* _manualExportCmd; QPushButton* _modeButton; QGroupBox* _manualGroupBox; // Common QDialogButtonBox* _buttonBox; MODE _mode; QString _dbName; QString _collName; QString _mongoExportArgs; QString _exportResult; QString _mongoExportOutputStr; QProcess* _activeProcess; // pointer to running/finished process }; }
3,479
C++
.h
93
30.569892
99
0.667358
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,184
ConnectionsDialog.h
Studio3T_robomongo/src/robomongo/gui/dialogs/ConnectionsDialog.h
#pragma once #include <QDialog> #include <QTreeWidget> #include "robomongo/core/Core.h" namespace Robomongo { class ConnectionListWidgetItem; class SettingsManager; class ConnectionSettings; /** * @brief Dialog allows select/edit/add/delete connections */ class ConnectionsDialog : public QDialog { Q_OBJECT public: typedef std::vector<ConnectionListWidgetItem *> ConnectionListItemContainerType; ConnectionsDialog(SettingsManager *manager, bool checkForImported, QWidget *parent = 0); ~ConnectionsDialog(); /** * @brief ConnectionSettings, that was selected after pressing on * "Connect" button */ ConnectionSettings *selectedConnection() const { return _selectedConnection; } public Q_SLOTS: /** * @brief This function is called when user clicks on "Connect" button. */ void accept() override; /** * @brief Called when "Cancel" button clicked. */ void reject() override; /** * @brief Add connection to the list widget */ void add(ConnectionSettings *connection); private Q_SLOTS: void linkActivated(const QString &link); /** * @brief Initiate 'add' action, usually when user clicked on Add button */ void add(); /** * @brief Initiate 'edit' action, usually when user clicked on Edit * button */ void edit(); /** * @brief Initiate 'remove' action, usually when user clicked on Remove * button */ void remove(); /** * @brief Initiate 'clone' action, usually when user clicked on Clone * button */ void clone(); /** * @brief Handles ListWidget layoutChanged() signal */ void listWidget_layoutChanged(); void keyPressEvent(QKeyEvent* event) override; private: /** * @brief ConnectionSettings, that was selected after pressing on * "Connect" button */ ConnectionSettings *_selectedConnection; /** * @brief Main list widget */ QTreeWidget *_listWidget; /** * @brief Settings manager */ SettingsManager *_settingsManager; /** * @brief Hash that helps to connect ConnectionSettings with * ConnectionListWidgetItem* */ ConnectionListItemContainerType _connectionItems; bool _checkForImported; }; class ConnectionsTreeWidget : public QTreeWidget { Q_OBJECT public: ConnectionsTreeWidget(); Q_SIGNALS: void layoutChanged(); protected: void dropEvent(QDropEvent *event); #ifdef __APPLE__ // macOS: Set one re-order limit per new connections window. // Workaround for Qt bug came in Qt 5.12.8. // https://github.com/Studio3T/robomongo/issues/1790 private: int _dragDropCount = 0; #endif }; }
3,098
C++
.h
102
22.343137
96
0.605857
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,185
ConnectionDialog.h
Studio3T_robomongo/src/robomongo/gui/dialogs/ConnectionDialog.h
#pragma once #include <QDialog> #include "robomongo/core/Core.h" #include "robomongo/gui/utils/GuiConstants.h" namespace Robomongo { class ConnectionSettings; class ConnectionAuthTab; class ConnectionBasicTab; class ConnectionAdvancedTab; class SSLTab; class SshTunnelTab; /** * @brief This Dialog allows to edit single connection */ class ConnectionDialog : public QDialog { Q_OBJECT public: /** * @brief Constructs dialog with specified connection */ ConnectionDialog(ConnectionSettings *connection, QWidget *parent = nullptr); ConnectionSettings *const connection() const { return _connection; } void setAuthTab( QString const& db, QString const& username, QString const& pwd, AuthMechanism authMech ); void setDefaultDb(QString const& defaultDb); void toggleSshSupport(bool isReplicaSet); void clearConnAuthTab(); void clearSslTab(); void setSslTab( int index, bool allowInvalidHostnames, std::string_view caFile, std::string_view certPemFile, std::string_view certPemFilePwd ); public Q_SLOTS: /** * @brief Accept() is called when user agree with entered data. */ virtual void accept(); private Q_SLOTS: /** * @brief Test current connection */ void testConnection(); private: void reject(); void closeEvent(QCloseEvent *event); void restoreWindowSettings(); void saveWindowSettings() const; bool validateAndApply(); ConnectionAuthTab *_authTab = nullptr; ConnectionBasicTab *_basicTab = nullptr; ConnectionAdvancedTab *_advancedTab = nullptr; SshTunnelTab *_sshTab = nullptr; SSLTab *_sslTab = nullptr; #ifdef SSH_SUPPORT_ENABLED SshTunnelTab *_sshTab; #endif /** * @brief Edited connection */ ConnectionSettings *const _connection; }; }
2,183
C++
.h
71
22.140845
84
0.62089
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,186
SSHTunnelTab.h
Studio3T_robomongo/src/robomongo/gui/dialogs/SSHTunnelTab.h
#pragma once #include <QWidget> #include "robomongo/core/settings/ConnectionSettings.h" QT_BEGIN_NAMESPACE class QLabel; class QLineEdit; class QCheckBox; class QPushButton; class QComboBox; class QFrame; QT_END_NAMESPACE namespace Robomongo { class ConnectionSettings; class SshTunnelTab : public QWidget { Q_OBJECT public: SshTunnelTab(ConnectionSettings *settings); bool accept(); void toggleSshCheckboxToolTip(bool isReplicaSet); private Q_SLOTS: void sshSupportStateChange(int checked); void askForPasswordStateChanged(int checked); void securityChange(const QString& val); void setPrivateFile(); void togglePasswordEchoMode(); void togglePassphraseEchoMode(); private: void setPasswordFieldsEnabled(bool enabled); private: QCheckBox *_useSsh; QCheckBox *_askForPassword; QLineEdit *_sshHostName; QLineEdit *_userName; QLineEdit *_sshPort; QComboBox *_security; QLabel *_sshPrivateKeyLabel; QLabel *_sshPassphraseLabel; QLabel *_sshAddressLabel; QLabel *_sshUserNameLabel; QLabel *_sshAuthMethodLabel; QPushButton *_selectPrivateFileButton; QLineEdit *_passwordBox; QLabel *_passwordLabel; QPushButton *_passwordEchoModeButton; QLineEdit *_privateKeyBox; QLineEdit *_passphraseBox; QPushButton *_passphraseEchoModeButton; ConnectionSettings *const _settings; }; }
1,563
C++
.h
52
23.403846
57
0.695594
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,187
EulaDialog.h
Studio3T_robomongo/src/robomongo/gui/dialogs/EulaDialog.h
#pragma once #include <QWizard> QT_BEGIN_NAMESPACE class QLabel; class QLineEdit; class QCheckBox; class QPushButton; class QDialogButtonBox; class QComboBox; class QNetworkReply; QT_END_NAMESPACE namespace Robomongo { class EulaDialog : public QWizard { Q_OBJECT public: static const QSize minimumSize; explicit EulaDialog(bool showFormPage, QWidget *parent = nullptr); public Q_SLOTS: void accept() override; void reject() override; protected: void closeEvent(QCloseEvent *event) override; private Q_SLOTS: void on_agreeButton_clicked(); void on_notAgreeButton_clicked(); void on_next_clicked(); void on_back_clicked(); void on_finish_clicked(); private: // Send name, last name and email data of user to home server void postUserData() const; /** * @brief Restore window settings from system registry */ void restoreWindowSettings(); /** * @brief Save window settings into system registry */ void saveWindowSettings() const; QLineEdit* _nameEdit; QLineEdit* _lastNameEdit; QLineEdit* _emailEdit; QLineEdit* _phone; QLineEdit* _company; QByteArray _postData; mutable QNetworkReply* _reply; bool _showFormPage = true; }; }
1,412
C++
.h
51
21.039216
74
0.653702
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,188
FunctionTextEditor.h
Studio3T_robomongo/src/robomongo/gui/dialogs/FunctionTextEditor.h
#pragma once #include <QDialog> QT_BEGIN_NAMESPACE class QLineEdit; class QLabel; QT_END_NAMESPACE #include "robomongo/core/domain/MongoFunction.h" namespace Robomongo { class FindFrame; class FunctionTextEditor : public QDialog { Q_OBJECT public: typedef QDialog BaseClass; explicit FunctionTextEditor(const QString &server, const QString &database, const MongoFunction &code, QWidget *parent = 0); MongoFunction function() const { return _function; } void setCursorPosition(int line, int column); void setCode(const QString &code); public Q_SLOTS: virtual void accept(); private: void _configureQueryText(); QLineEdit *_nameEdit; FindFrame *_queryText; MongoFunction _function; }; }
847
C++
.h
29
22.62069
84
0.669554
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,189
CreateCollectionDialog.h
Studio3T_robomongo/src/robomongo/gui/dialogs/CreateCollectionDialog.h
#pragma once #include <mongo/bson/bsonobj.h> #include <QDialog> QT_BEGIN_NAMESPACE class QLabel; class QDialogButtonBox; class QLineEdit; class QTabWidget; class QCheckBox; class QComboBox; QT_END_NAMESPACE class QsciScintilla; namespace Robomongo { class FindFrame; class Indicator; /** * @brief This Dialog allows to create collection with selective options. */ class CreateCollectionDialog : public QDialog { Q_OBJECT public: using JSONFrame = FindFrame; /** * @brief Construct dialog with parameters * @param serverName: Database name * @param dbVersion: Database version * @param storageEngine: Storage engine type * @param database: Name of the database * @param collection: Name of the collection */ explicit CreateCollectionDialog(const QString &serverName, const float dbVersion, const std::string& storageEngine, const QString &database = QString(), const QString &collection = QString(), QWidget *parent = 0); /** * @brief Used if dialog exec() method returns QDialog::Accepted * @return Extra options as BSONObj */ const mongo::BSONObj getExtraOptions() const; /** * @return Collection name */ QString getCollectionName() const; /** * @return true if capped option checked, false otherwise */ bool isCapped() const; /** * @return Size option input */ long long getSizeInputValue() const; /** * @return Max number of documents option input */ int getMaxDocNumberInputValue() const; /** * @return true if auto index_id option checked, false otherwise */ bool isCheckedAutoIndexid() const; /** * @return true if use power-of-2 sizes option checked, false otherwise */ bool isCheckedUsePowerOfTwo() const; /** * @return true if no padding option checked, false otherwise */ bool isCheckedNoPadding() const; public Q_SLOTS: /** * @brief Validate all input fields and make extraOptions object if all valid when create button clicked. */ void accept() override; /** * @brief Called when "Cancel" button clicked. */ void reject() override; protected: /** * @brief Reimplementing closeEvent in order to do implement functionalities before close this dialog. */ void closeEvent(QCloseEvent *event) override; private Q_SLOTS: /** * @brief Set indicator position when active JSON frame text changed */ void onFrameTextChanged(); /** * @brief Validate active JSON frame text when validate button clicked */ void onValidateButtonClicked(); /** * @brief Enable create button if input edit has text * @param text : string from _inputEdit widget */ void enableCreateButton(const QString &text); /** * @brief Enable/disable capped options when capped checkbox state changed * @param newState : New state of capped checkbox */ void onCappedCheckBoxChanged(int newState); /** * @brief Show/hide validate JSON button, update active JSON frame and object according to active tab * @param Index of active tab (i.e. index = 0 for the first tab) */ void onTabChanged(int index); /** * @brief Show/hide advanced options menu (_tabwidget) when advancedButton toggled. * @param state : true if dialog is expanding, false if shrinking. */ void onAdvancedButtonToggled(bool state); private: /** * @brief Tool tip strings for disabled options and tabs */ static const QString STORAGE_ENGINE_TAB_HINT; static const QString VALIDATOR_TAB_HINT; static const QString INDEX_OPTION_DEFAULTS_TAB_HINT; static const QString NO_PADDING_HINT; static const QString USE_POWEROFTWO_HINT; static const QString AUTO_INDEXID_HINT; /** * @brief Create database indicator widget * @param database : Name of the database * @return : Pointer to newly created Indicator */ Indicator* createDatabaseIndicator(const QString &database); /** * @brief Create collection indicator widget * @param database : Name of the collection * @return : Pointer to newly created Indicator */ Indicator* createCollectionIndicator(const QString &collection); /** * @brief Creators for the tabs * @return : Pointer to newly created tab */ QWidget* createOptionsTab(); QWidget* createStorageEngineTab(); QWidget* createValidatorTab(); QWidget* createIndexOptionDefaultsTab(); /** * @brief Save windows settings into system registry */ void saveWindowSettings() const; /** * @brief Restore windows settings from system registry */ void restoreWindowSettings(); /** * @brief Do initial configuration of given JSON frame. * @param frame : Pointer to newly created tab */ void configureFrameText(JSONFrame* frame); /** * @brief Build extraOptions BSON Object */ void makeExtraOptionsObj(); /** * @brief Validate dependencies and requirements between all inputs * @return : true if all options valid, false at least one dependency not met */ bool validateOptionDependencies() const; /** * @brief Disable options if they are not supported by database version or storage engine type */ void disableUnsupportedOptions() const; /** * @brief Disable widget if unsupported * @param option : Widget to disable * @param hint : Hint string to be shown */ void disableOption(QWidget* option, const QString& hint) const; /** * @brief Disable tab if unsupported * @param index : Tab index * @param hint : Hint string to be shown */ void disableTab(int index, const QString& hint) const; /** * @brief Set cursor position of the active JSON frame * @param line : Line number * @param column : Column number */ void setCursorPosition(int line, int column); /** * @return : String from given JSON frame * @param frame : Pointer to JSON frame */ QString jsonText(JSONFrame* frame) const; /** * @brief Do JSON validation/creation for given frame text * @param frame : Pointer to JSON frame * @param bsonObj : BSON object to be validated * @param silentOnSuccess : true for silent validation, false for message box on validation * @return true if text is valid JSON, false otherwise */ bool validate(JSONFrame* frame, mongo::BSONObj& bsonObj, bool silentOnSuccess = true); /** * @brief Main Window */ QLineEdit *_inputEdit; QLabel *_inputLabel; QTabWidget *_advancedOptions; QPushButton *_validateJsonButton; QDialogButtonBox *_buttonBox; QPushButton *_advancedButton; /** * @brief Options Tab */ QCheckBox *_cappedCheckBox; QLabel *_sizeInputLabel; QLineEdit *_sizeInputEdit; QLabel *_maxDocNumberInputLabel; QLineEdit *_maxDocNumberInputEdit; QCheckBox *_autoIndexCheckBox; QCheckBox *_usePowerOfTwoSizeCheckBox; QCheckBox *_noPaddingCheckBox; /** * @brief Storage Engine Tab */ JSONFrame *_storageEngineFrame; QLabel * _storageEngineFrameLabel; /** * @brief Validator Tab */ QLabel * _validatorLevelLabel; QComboBox * _validatorLevelComboBox; QLabel * _validatorActionLabel; QComboBox * _validatorActionComboBox; JSONFrame *_validatorFrame; QLabel * _validatorFrameLabel; /** * @brief Index Options Defaults Tab */ JSONFrame *_indexOptionDefaultsFrame; QLabel * _indexOptionDefaultsFrameLabel; /** * @brief Pointer to active tab's frame */ JSONFrame *_activeFrame; /** * @brief Pointer to active tab's BSON obj. */ mongo::BSONObj *_activeObj; /** * @brief Main BSON obj. with all extra options */ mongo::BSONObj _extraOptionsObj; /** * @brief Sub objects for each JSON tab to create extraOptions object finally. */ mongo::BSONObj _storageEngineObj; mongo::BSONObj _validatorObj; mongo::BSONObj _indexOptionDefaultsObj; /** * @brief Database version */ const float _dbVersion; /** * @brief Storage engine type */ const std::string _storageEngine; }; }
9,313
C++
.h
264
26.537879
124
0.616131
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,190
DocumentTextEditor.h
Studio3T_robomongo/src/robomongo/gui/dialogs/DocumentTextEditor.h
#pragma once #include <QDialog> #include <mongo/bson/bsonobj.h> #include "robomongo/core/domain/MongoQueryInfo.h" namespace Robomongo { class FindFrame; class DocumentTextEditor : public QDialog { Q_OBJECT public: typedef std::vector<mongo::BSONObj> ReturnType; static const QSize minimumSize; explicit DocumentTextEditor(const CollectionInfo &info, const QString &json, bool readonly = false, QWidget *parent = 0); QString jsonText() const; /** * @brief Use returned BSONObj only if Dialog exec() method returns QDialog::Accepted */ ReturnType bsonObj() const { return _obj; } void setCursorPosition(int line, int column); public Q_SLOTS: void accept() override; void reject() override; bool validate(bool silentOnSuccess = true); private Q_SLOTS: void onQueryTextChanged(); void onValidateButtonClicked(); protected: /** * @brief Reimplementing closeEvent in order to do some pre-close actions. */ void closeEvent(QCloseEvent *event) override; private: void _configureQueryText(); /** * @brief Restore window settings from system registry */ void restoreWindowSettings(); /** * @brief Save window settings into system registry */ void saveWindowSettings() const; const CollectionInfo _info; FindFrame *_queryText; bool _readonly; ReturnType _obj; }; }
1,564
C++
.h
48
25.125
129
0.646
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,191
ConnectionDiagnosticDialog.h
Studio3T_robomongo/src/robomongo/gui/dialogs/ConnectionDiagnosticDialog.h
#pragma once #include <QDialog> #include <QIcon> class QLabel; class QMovie; namespace Robomongo { struct ConnectionEstablishedEvent; class ConnectionFailedEvent; class ConnectionSettings; class MongoServer; class ConnectionDiagnosticDialog : public QDialog { Q_OBJECT public: ConnectionDiagnosticDialog(ConnectionSettings *connection, QWidget *parent = 0); ~ConnectionDiagnosticDialog(); bool continueExec() const { return _continueExec; } protected Q_SLOTS: void handle(ConnectionEstablishedEvent *event); void handle(ConnectionFailedEvent *event); void errorLinkActivated(const QString &link); private: enum State { InitialState, CompletedState, FailedState, NotPerformedState }; void sshStatus(State state); void connectionStatus(State state); void authStatus(State state); void listStatus(State state); ConnectionSettings *_connSettings; QIcon _yesIcon; QIcon _noIcon; QIcon _questionIcon; QMovie *_loadingMovie; QPixmap _yesPixmap; QPixmap _noPixmap; QPixmap _questionPixmap; QLabel *_sshIconLabel; QLabel *_sshLabel; QLabel *_connectionIconLabel; QLabel *_connectionLabel; QLabel *_authIconLabel; QLabel *_authLabel; QLabel *_listIconLabel; // List database names QLabel *_listLabel; QLabel *_viewErrorLink; std::string _lastErrorMessage; MongoServer *_server; int _serverHandle; bool _continueExec; }; }
1,696
C++
.h
57
22.035088
88
0.651692
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,192
SSLTab.h
Studio3T_robomongo/src/robomongo/gui/dialogs/SSLTab.h
#pragma once #include <QWidget> #include "robomongo/core/settings/ConnectionSettings.h" QT_BEGIN_NAMESPACE class QLabel; class QLineEdit; class QCheckBox; class QPushButton; class QRadioButton; class QComboBox; QT_END_NAMESPACE namespace Robomongo { class ConnectionSettings; class SSLTab : public QWidget { Q_OBJECT public: /** * @brief Construct SSL tab of ConnectionDialog * @param settings: Pointer to active connection's ConnectionsSettings member */ SSLTab(ConnectionSettings *settings); /** * @brief Save dialog input into connection's ssl settings * @return true on success, false otherwise */ bool accept(); /** * @return true if use SSL checkbox is checked, false otherwise */ bool sslEnabled() const; void clearTab(); void setSslOptions( int index, bool allowInvalidHostnames, std::string_view caFile, std::string_view certPemFile, std::string_view certPemFilePwd ); private Q_SLOTS : /** * @brief Disable/enable widgets according to SSL check box state */ void useSslCheckBoxStateChange(int checked); /** * @brief Disable/enable widgets according to state of authentication method combo box */ void on_authModeComboBox_change(int index); /** * @brief Disable/enable widgets according to state of use PEM file combo box */ void on_usePemFileCheckBox_toggle(bool checked); /** * @brief Disable/enable widgets according to state of advanced options combo box */ void on_useAdvancedOptionsCheckBox_toggle(bool checked); /** * @brief File browsers for SSL related cert/key files */ void on_caFileBrowseButton_clicked(); void on_pemKeyFileBrowseButton_clicked(); void on_crlFileBrowseButton_clicked(); /** * @brief Show/hide client cert's passphrase on Show/Hide button pressed */ void togglePassphraseShowMode(); /** * @brief Enable/disable/clean PEM passphrase widgets section */ void on_askPemPassCheckBox_toggle(bool checked); private: /** * @brief Do validation according to user input in UI * @return true on success, false otherwise */ bool validate(); /** * @brief Check existence of files: CA cert, Client Cert and CRL file * @return true if all files exist, false any of them does not exist * @return QString Lable of file which does not exist, empty string if all files exist */ std::pair<bool, QString> checkExistenseOfFiles() const; /** * @brief Save dialog input into connection's ssl settings */ void saveSslSettings() const; /** * @brief * @param initialPath Previously selected file path * @return Selected file absolute path and file name */ QString openFileBrowseDialog(const QString& initialPath); /** * @brief Main checkbox to disable/enable all other SSL tab widgets */ QCheckBox *_useSslCheckBox; /** * @brief Auth. Method widgets */ QLabel *_authMethodLabel; QComboBox *_authMethodComboBox; QLabel *_selfSignedInfoStr; QLabel *_caFileLabel; QLineEdit *_caFilePathLineEdit; QPushButton *_caFileBrowseButton; /** * @brief PEM file widgets */ QCheckBox* _usePemFileCheckBox; QLabel* _pemFileInfoStr; QLabel* _pemFileLabel; QLineEdit *_pemFilePathLineEdit; QPushButton *_pemFileBrowseButton; QLabel* _pemPassLabel; QLineEdit* _pemPassLineEdit; QPushButton* _pemPassShowButton; QCheckBox* _askPemPassCheckBox; /** * @brief Advanced options widgets */ QCheckBox* _useAdvancedOptionsCheckBox; QLabel *_crlFileLabel; QLineEdit *_crlFilePathLineEdit; QPushButton *_crlFileBrowseButton; QLabel *_allowInvalidHostnamesLabel; QComboBox *_allowInvalidHostnamesComboBox; /** * @brief Pointer to active connection's settings */ ConnectionSettings *const _connSettings; }; } /* end of Robomongo namespace */
4,547
C++
.h
133
25.496241
93
0.629869
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,193
ConnectionBasicTab.h
Studio3T_robomongo/src/robomongo/gui/dialogs/ConnectionBasicTab.h
#pragma once #include <QWidget> QT_BEGIN_NAMESPACE class QLineEdit; class QLabel; class QCheckBox; class QPushButton; class QComboBox; class QTreeWidget; class QTreeWidgetItem; class QDialogButtonBox; QT_END_NAMESPACE namespace Robomongo { class ConnectionSettings; class ConnectionDialog; class ConnectionBasicTab : public QWidget { Q_OBJECT public: ConnectionBasicTab(ConnectionSettings *settings, ConnectionDialog *connectionDialog); bool accept(); void clearTab(); private Q_SLOTS: void on_ConnectionTypeChange(int index); void deleteItem(); void on_addButton_clicked(); void on_removeButton_clicked(); void on_replicaMemberItemEdit(QTreeWidgetItem* item, int column); void on_uriButton_clicked(); private: QLabel *_typeLabel; QComboBox *_connectionType; QLabel *_nameLabel; QLineEdit *_connectionName; QLabel *_connInfoLabel; QLabel *_addressLabel; QLineEdit *_serverAddress; QLabel *_colon; QLineEdit *_serverPort; QLabel *_addInfoLabel; QLabel *_membersLabel; QTreeWidget *_members; QPushButton *_addButton; QPushButton *_removeButton; QDialogButtonBox *_minusPlusButtonBox; QLabel *_setNameLabel; QLineEdit *_setNameEdit; QLineEdit *_uriEdit; QPushButton *_uriButton; QPushButton *_discoverButton; QLabel *_readPrefLabel; QComboBox *_readPreference; ConnectionSettings *const _settings; ConnectionDialog *_connectionDialog; }; }
1,648
C++
.h
57
22.45614
93
0.682449
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,194
CopyCollectionDialog.h
Studio3T_robomongo/src/robomongo/gui/dialogs/CopyCollectionDialog.h
#pragma once #include <QDialog> #include "robomongo/core/domain/App.h" QT_BEGIN_NAMESPACE class QDialogButtonBox; class QComboBox; QT_END_NAMESPACE namespace Robomongo { class MongoDatabase; class CopyCollection : public QDialog { Q_OBJECT public: static const QSize minimumSize; explicit CopyCollection(const QString &serverName, const QString &database, const QString &collection, QWidget *parent = 0); public Q_SLOTS: virtual void accept(); void updateDatabaseComboBox(int index); MongoDatabase *selectedDatabase(); private: std::vector<MongoServer*> _servers; const QString _currentServerName; const QString _currentDatabase; QComboBox *_serverComboBox; QComboBox *_databaseComboBox; QDialogButtonBox *_buttonBox; }; }
929
C++
.h
31
22.322581
86
0.652466
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,196
LogWidget.h
Studio3T_robomongo/src/robomongo/gui/widgets/LogWidget.h
#pragma once #include <QWidget> #include <mongo/logger/log_severity.h> QT_BEGIN_NAMESPACE class QTextEdit; class QAction; QT_END_NAMESPACE namespace Robomongo { class LogWidget : public QWidget { Q_OBJECT public: typedef QWidget BaseClass; LogWidget(QWidget* parent = 0); public Q_SLOTS: void addMessage(const QString &message, mongo::logger::LogSeverity level); private Q_SLOTS: void showContextMenu(const QPoint &pt); private: QTextEdit *const _logTextEdit; QAction *_clear; }; }
590
C++
.h
24
19.083333
82
0.672043
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,197
ExplorerCollectionTreeItem.h
Studio3T_robomongo/src/robomongo/gui/widgets/explorer/ExplorerCollectionTreeItem.h
#pragma once #include "robomongo/core/Event.h" #include "robomongo/gui/widgets/explorer/ExplorerTreeItem.h" #include "robomongo/gui/widgets/explorer/ExplorerCollectionIndexesDir.h" #include "robomongo/core/domain/CursorPosition.h" #include "robomongo/core/events/MongoEventsInfo.h" #include "robomongo/core/domain/MongoCollection.h" namespace Robomongo { class LoadCollectionIndexesResponse; struct AddEditIndexResponse; class DropCollectionIndexResponse; class ExplorerCollectionIndexesDir; class ExplorerDatabaseTreeItem; class CollectionIndexesLoadingEvent : public Event { R_EVENT CollectionIndexesLoadingEvent(QObject *sender) : Event(sender) {} }; class ExplorerCollectionTreeItem: public ExplorerTreeItem { Q_OBJECT public: typedef ExplorerTreeItem BaseClass; ExplorerCollectionTreeItem(QTreeWidgetItem *parent, ExplorerDatabaseTreeItem *databaseItem, MongoCollection *collection); MongoCollection *collection() const { return _collection; } void expand(); void dropIndex(const QTreeWidgetItem * const ind); void openCurrentCollectionShell(const QString &script, bool execute = true, const CursorPosition &cursor = CursorPosition()); ExplorerDatabaseTreeItem *const databaseItem() const { return _databaseItem; } public Q_SLOTS: void handle(LoadCollectionIndexesResponse *event); void handle(AddEditIndexResponse *event); void handle(DropCollectionIndexResponse *event); void handle(CollectionIndexesLoadingEvent *event); private Q_SLOTS: void ui_addDocument(); void ui_removeDocument(); void ui_updateDocument(); void ui_collectionStatistics(); void ui_removeAllDocuments(); void ui_storageSize(); void ui_totalIndexSize(); void ui_totalSize(); void ui_shardVersion(); void ui_shardDistribution(); void ui_dropCollection(); void ui_renameCollection(); void ui_duplicateCollection(); void ui_copyToCollectionToDiffrentServer(); void ui_viewCollection(); private: QString buildToolTip(MongoCollection *collection); ExplorerCollectionIndexesDir *_indexDir; MongoCollection *const _collection; ExplorerDatabaseTreeItem *const _databaseItem; }; }
2,385
C++
.h
58
34.344828
133
0.729741
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,198
AddEditIndexDialog.h
Studio3T_robomongo/src/robomongo/gui/widgets/explorer/AddEditIndexDialog.h
#pragma once #include <QDialog> QT_BEGIN_NAMESPACE class QLineEdit; class QCheckBox; class QTextEdit; QT_END_NAMESPACE #include "robomongo/core/events/MongoEventsInfo.h" namespace Robomongo { class FindFrame; class AddEditIndexDialog: public QDialog { Q_OBJECT public: typedef QDialog BaseClass; enum { HeightWidget = 320, WidthWidget = 480 }; explicit AddEditIndexDialog( const IndexInfo &info, const QString &databaseName, const QString &serverAdress, bool const isAddIndex, QWidget *parent = nullptr ); IndexInfo info() const; public Q_SLOTS: virtual void accept(); void expireStateChanged(int value); private: QWidget *createBasicTab(); QWidget *createAdvancedTab(); QWidget *createTextSearchTab(); bool const _isAddIndex; IndexInfo const _info; QLineEdit *_nameLineEdit; FindFrame *_jsonText; QCheckBox *_uniqueCheckBox; QCheckBox *_backGroundCheckBox; QCheckBox *_sparceCheckBox; QLineEdit *_expireAfterLineEdit; QLineEdit *_defaultLanguageLineEdit; QLineEdit *_languageOverrideLineEdit; FindFrame *_textWeightsLineEdit; }; }
1,297
C++
.h
46
21.434783
64
0.666667
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,199
ExplorerDatabaseCategoryTreeItem.h
Studio3T_robomongo/src/robomongo/gui/widgets/explorer/ExplorerDatabaseCategoryTreeItem.h
#pragma once #include "robomongo/gui/widgets/explorer/ExplorerTreeItem.h" namespace Robomongo { class ExplorerDatabaseTreeItem; enum ExplorerDatabaseCategory { Collections, Functions, Files, Users }; /* ** Database category Tree Item (looks like folder in the UI) */ class ExplorerDatabaseCategoryTreeItem : public ExplorerTreeItem { Q_OBJECT public: typedef ExplorerTreeItem BaseClass; ExplorerDatabaseCategoryTreeItem(ExplorerDatabaseTreeItem *databaseItem, ExplorerDatabaseCategory category); void expand(); private Q_SLOTS: void ui_createCollection(); void ui_addUser(); void ui_addFunction(); void ui_refreshCollections(); void ui_dbCollectionsStatistics(); void ui_refreshUsers(); void ui_refreshFunctions(); void ui_viewUsers(); void ui_viewFunctions(); private: ExplorerDatabaseTreeItem *databaseItem() const; const ExplorerDatabaseCategory _category; }; }
1,079
C++
.h
37
22.378378
116
0.678571
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,200
ExplorerUserTreeItem.h
Studio3T_robomongo/src/robomongo/gui/widgets/explorer/ExplorerUserTreeItem.h
#pragma once #include "robomongo/core/domain/MongoUser.h" #include "robomongo/gui/widgets/explorer/ExplorerTreeItem.h" namespace Robomongo { class MongoDatabase; class ExplorerUserTreeItem : public ExplorerTreeItem { Q_OBJECT public: typedef ExplorerTreeItem BaseClass; ExplorerUserTreeItem(QTreeWidgetItem *parent, MongoDatabase *const database, const MongoUser &user); public Q_SLOTS: void ui_dropUser(); void ui_viewUser(); private: const MongoUser _user; MongoDatabase *_database; }; }
580
C++
.h
20
23.5
108
0.714801
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,201
ExplorerCollectionIndexItem.h
Studio3T_robomongo/src/robomongo/gui/widgets/explorer/ExplorerCollectionIndexItem.h
#pragma once #include "robomongo/core/events/MongoEventsInfo.h" #include "robomongo/gui/widgets/explorer/ExplorerTreeItem.h" namespace Robomongo { class ExplorerCollectionIndexesDir; class ExplorerCollectionIndexItem : public ExplorerTreeItem { Q_OBJECT public: using BaseClass = ExplorerTreeItem ; explicit ExplorerCollectionIndexItem( ExplorerCollectionIndexesDir *parent, const IndexInfo &info); private Q_SLOTS: void ui_dropIndex(); void ui_edit(); private: IndexInfo _info; }; }
577
C++
.h
20
23.2
73
0.717391
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,202
ExplorerReplicaSetFolderItem.h
Studio3T_robomongo/src/robomongo/gui/widgets/explorer/ExplorerReplicaSetFolderItem.h
#pragma once #include "robomongo/gui/widgets/explorer/ExplorerTreeItem.h" namespace Robomongo { class MongoServer; struct ReplicaSetFolderLoading; class ExplorerReplicaSetFolderItem : public ExplorerTreeItem { Q_OBJECT public: using BaseClass = ExplorerTreeItem; ExplorerReplicaSetFolderItem(ExplorerTreeItem *item, MongoServer *const server); void updateText(); void disableSomeContextMenuActions(); void expand(); void setRefreshFlag(bool state) { _refreshFlag = state; } bool refreshFlag() const { return _refreshFlag; } private Q_SLOTS: void on_refresh(); void on_repSetStatus(); void handle(ReplicaSetFolderLoading *event); private: MongoServer *const _server = nullptr; bool _refreshFlag = true; }; }
852
C++
.h
26
26.192308
88
0.692778
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,203
ExplorerDatabaseTreeItem.h
Studio3T_robomongo/src/robomongo/gui/widgets/explorer/ExplorerDatabaseTreeItem.h
#pragma once #include "robomongo/gui/widgets/explorer/ExplorerTreeItem.h" namespace Robomongo { namespace detail { QString buildName(const QString& text, int count); } class ExplorerCollectionTreeItem; class ExplorerDatabaseCategoryTreeItem; class EventBus; class MongoDatabaseCollectionListLoadedEvent; class MongoDatabaseUsersLoadedEvent; class MongoDatabaseFunctionsLoadedEvent; class MongoDatabaseCollectionsLoadingEvent; class MongoDatabaseFunctionsLoadingEvent; class MongoDatabaseUsersLoadingEvent; class MongoDatabase; class MongoUser; class MongoFunction; class MongoCollection; struct IndexInfo; class ExplorerDatabaseTreeItem : public ExplorerTreeItem { Q_OBJECT public: typedef ExplorerTreeItem BaseClass; ExplorerDatabaseTreeItem(QTreeWidgetItem *parent, MongoDatabase *const database); MongoDatabase *database() const { return _database; } void expandCollections(); void expandUsers(); void expandFunctions(); void expandColection(ExplorerCollectionTreeItem *const item); void dropIndexFromCollection(ExplorerCollectionTreeItem *const item, const std::string &indexName); void addEditIndex(ExplorerCollectionTreeItem *const item, const IndexInfo &oldInfo, const IndexInfo &newInfo) const; public Q_SLOTS: void handle(MongoDatabaseCollectionListLoadedEvent *event); void handle(MongoDatabaseUsersLoadedEvent *event); void handle(MongoDatabaseFunctionsLoadedEvent *event); void handle(MongoDatabaseCollectionsLoadingEvent *event); void handle(MongoDatabaseFunctionsLoadingEvent *event); void handle(MongoDatabaseUsersLoadingEvent *event); private Q_SLOTS: void ui_dbStatistics(); void ui_dbCurrentOps(); void ui_dbKillOp(); void ui_dbDrop(); void ui_dbRepair(); void ui_dbOpenShell(); void ui_refreshDatabase(); private: void addCollectionItem(MongoCollection *collection); void addSystemCollectionItem(MongoCollection *collection); void showCollectionSystemFolderIfNeeded(); void addUserItem(MongoDatabase *database, const MongoUser &user); void addFunctionItem(MongoDatabase *database, const MongoFunction &function); EventBus *_bus; ExplorerDatabaseCategoryTreeItem *_collectionFolderItem; ExplorerDatabaseCategoryTreeItem *_functionsFolderItem; ExplorerDatabaseCategoryTreeItem *_usersFolderItem; ExplorerTreeItem *_collectionSystemFolderItem; MongoDatabase *const _database; }; }
2,711
C++
.h
65
34.338462
107
0.740038
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,204
ExplorerWidget.h
Studio3T_robomongo/src/robomongo/gui/widgets/explorer/ExplorerWidget.h
#pragma once #include <QWidget> QT_BEGIN_NAMESPACE class QTreeWidget; class QTreeWidgetItem; class QLabel; QT_END_NAMESPACE #include "robomongo/core/events/MongoEvents.h" namespace Robomongo { class MainWindow; /** * @brief Explorer widget (usually you'll see it at the left of main window) */ class ExplorerWidget : public QWidget { Q_OBJECT public: typedef QWidget BaseClass; ExplorerWidget(MainWindow *parent); ~ExplorerWidget(); QTreeWidgetItem* getSelectedTreeItem() const; protected Q_SLOTS: void handle(ConnectingEvent *event); void handle(ConnectionEstablishedEvent *event); void handle(ConnectionFailedEvent *event); private Q_SLOTS: void ui_itemExpanded(QTreeWidgetItem *item); void ui_itemDoubleClicked(QTreeWidgetItem *item, int column); protected: void keyPressEvent(QKeyEvent *event) override; private: QSize sizeHint() const override; int _progress; void increaseProgress(); void decreaseProgress(); QLabel *_progressLabel; QTreeWidget *_treeWidget; }; }
1,169
C++
.h
40
23.25
80
0.692583
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,205
ExplorerReplicaSetTreeItem.h
Studio3T_robomongo/src/robomongo/gui/widgets/explorer/ExplorerReplicaSetTreeItem.h
#pragma once #include "robomongo/core/events/MongoEvents.h" #include "robomongo/gui/widgets/explorer/ExplorerTreeItem.h" namespace Robomongo { class EventBus; class MongoServerLoadingDatabasesEvent; class ExplorerReplicaSetTreeItem : public ExplorerTreeItem { Q_OBJECT public: using BaseClass = ExplorerTreeItem; /* ** Constructs ExplorerReplicaSetTreeItem */ ExplorerReplicaSetTreeItem(QTreeWidgetItem *parent, MongoServer *const server, const mongo::HostAndPort& repMemberHostAndPort, const bool isPrimary, const bool isUp); /** * @brief Updates this widget's text and icon * @param isUp: true if this set member is reachable, false otherwise * @param isPrimary: true if this set member is primary, false otherwise */ void updateTextAndIcon(bool isUp, bool isPrimary); // Getters ConnectionSettings* connectionSettings() { return _connSettings.get(); } bool isUp() const { return _isUp; } MongoServer* server() const { return _server; } private Q_SLOTS: void ui_openShell(); void ui_openDirectConnection(); void ui_serverHostInfo(); void ui_serverStatus(); void ui_serverVersion(); void ui_showLog(); private: mongo::HostAndPort _repMemberHostAndPort; bool _isPrimary; // true if this set member is primary, false otherwise bool _isUp; // true if this set member is reachable, false otherwise MongoServer *const _server; std::unique_ptr<ConnectionSettings> _connSettings; EventBus *_bus; // todo: remove? }; }
1,733
C++
.h
43
32.093023
134
0.661281
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,206
ExplorerTreeWidget.h
Studio3T_robomongo/src/robomongo/gui/widgets/explorer/ExplorerTreeWidget.h
#pragma once #include <QTreeWidget> namespace Robomongo { class ExplorerTreeWidget : public QTreeWidget { Q_OBJECT public: explicit ExplorerTreeWidget(QWidget *parent = 0); protected: virtual void contextMenuEvent(QContextMenuEvent *event); }; }
292
C++
.h
13
17.923077
64
0.711191
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,207
ExplorerTreeItem.h
Studio3T_robomongo/src/robomongo/gui/widgets/explorer/ExplorerTreeItem.h
#pragma once #include <QTreeWidgetItem> QT_BEGIN_NAMESPACE class QMenu; QT_END_NAMESPACE namespace Robomongo { class ExplorerTreeItem :public QObject, public QTreeWidgetItem { Q_OBJECT public: typedef QTreeWidgetItem BaseClass; explicit ExplorerTreeItem(QTreeWidget *view); explicit ExplorerTreeItem(QTreeWidgetItem *parent); virtual void showContextMenuAtPos(const QPoint &pos); using BaseClass::parent; virtual ~ExplorerTreeItem(); protected: QMenu *const _contextMenu; }; }
564
C++
.h
21
21.714286
66
0.724074
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,208
ExplorerServerTreeItem.h
Studio3T_robomongo/src/robomongo/gui/widgets/explorer/ExplorerServerTreeItem.h
#pragma once #include "robomongo/core/events/MongoEvents.h" #include "robomongo/gui/widgets/explorer/ExplorerTreeItem.h" namespace Robomongo { class EventBus; class MongoServerLoadingDatabasesEvent; class ExplorerReplicaSetFolderItem; class ExplorerTreeItem; class ExplorerServerTreeItem : public ExplorerTreeItem { Q_OBJECT public: typedef ExplorerTreeItem BaseClass; /* ** Constructs ExplorerServerTreeItem */ ExplorerServerTreeItem(QTreeWidget *view, MongoServer *const server, ConnectionInfo connInfo); /* ** Expand server tree item; */ void expand(); // Disable/enable menu items, except [1]:Refresh and [9]:Disconnect which are // always enabled, according to replica set status (online or offline). void disableSomeContextMenuActions(bool disable); public Q_SLOTS: void databaseRefreshed(const QList<MongoDatabase *> &dbs); void handle(DatabaseListLoadedEvent *event); void handle(MongoServerLoadingDatabasesEvent *event); void handle(ReplicaSetFolderRefreshed *event); // Special handle for server refresh events for replica set connections only void handle(ConnectionEstablishedEvent *event); // Special handle for server refresh events for replica set connections only void handle(ConnectionFailedEvent *event); private Q_SLOTS: void ui_showLog(); void ui_openShell(); void ui_disconnectServer(); void ui_refreshServer(); void ui_createDatabase(); void ui_serverHostInfo(); void ui_serverStatus(); void ui_serverVersion(); private: // Build all items for a root replica set server item, only used in refresh events // (not designed to be used in primary connection) void buildReplicaSetServerItem(); // Build only replica set folder and member items void buildReplicaSetFolder(bool expanded); // This function assumes there is no existing db items (system folder and other db tree items), // so existing db items should be deleted before calling this function. void buildDatabaseItems(); void replicaSetPrimaryReachable(); void replicaSetPrimaryUnreachable(); /** * @brief Builds server * @param count: Number of databases. * If NULL - name will be without count of databases. * If -1 - name will contain "..." at the end. */ QString buildServerName(int *count = NULL, bool isOnline = true); ExplorerReplicaSetFolderItem *_replicaSetFolder; ExplorerTreeItem *_systemFolder; MongoServer *const _server; EventBus *_bus; // Flag to track last replica set connection's primary status bool _primaryWasUnreachable = false; }; }
2,951
C++
.h
69
34.681159
104
0.675402
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,209
ExplorerFunctionTreeItem.h
Studio3T_robomongo/src/robomongo/gui/widgets/explorer/ExplorerFunctionTreeItem.h
#pragma once #include "robomongo/core/domain/MongoFunction.h" #include "robomongo/gui/widgets/explorer/ExplorerTreeItem.h" namespace Robomongo { class MongoDatabase; class ExplorerFunctionTreeItem :public ExplorerTreeItem { Q_OBJECT public: typedef ExplorerTreeItem BaseClass; ExplorerFunctionTreeItem(QTreeWidgetItem *parent, MongoDatabase *database, const MongoFunction &function); MongoFunction function() const { return _function; } MongoDatabase *database() const { return _database; } private Q_SLOTS: void ui_editFunction(); void ui_dropFunction(); private: QString buildToolTip(const MongoFunction &function); MongoFunction _function; MongoDatabase *_database; }; }
796
C++
.h
23
28.304348
114
0.714472
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,210
ExplorerCollectionIndexesDir.h
Studio3T_robomongo/src/robomongo/gui/widgets/explorer/ExplorerCollectionIndexesDir.h
#pragma once #include "robomongo/gui/widgets/explorer/ExplorerTreeItem.h" namespace Robomongo { class ExplorerCollectionIndexesDir : public ExplorerTreeItem { Q_OBJECT public: using BaseClass = ExplorerTreeItem; static const QString labelText; explicit ExplorerCollectionIndexesDir(QTreeWidgetItem *parent); void expand(); private Q_SLOTS: void ui_addIndex(); void ui_reIndex(); void ui_viewIndex(); void ui_refreshIndex(); }; }
524
C++
.h
19
21.578947
71
0.685259
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,211
JsonPrepareThread.h
Studio3T_robomongo/src/robomongo/gui/widgets/workarea/JsonPrepareThread.h
#pragma once #include <QThread> #include <vector> #include "robomongo/core/Core.h" #include "robomongo/core/Enums.h" namespace Robomongo { /* ** In this thread we are running task to prepare JSON string from list of BSON objects */ class JsonPrepareThread : public QThread { Q_OBJECT public: /* ** Constructor */ JsonPrepareThread(const std::vector<MongoDocumentPtr> &bsonObjects, UUIDEncoding uuidEncoding, SupportedTimes timeZone); void stop(); Q_SIGNALS: /** * @brief Signals when all parts prepared */ void done(); /** * @brief Signals when json part is ready */ void partReady(const QString &part); protected: /* ** Overload function */ virtual void run(); private: /* ** List of documents */ const std::vector<MongoDocumentPtr> _bsonObjects; const UUIDEncoding _uuidEncoding; const SupportedTimes _timeZone; volatile bool _stop; }; }
1,091
C++
.h
43
18.534884
128
0.602885
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,213
CollectionStatsTreeItem.h
Studio3T_robomongo/src/robomongo/gui/widgets/workarea/CollectionStatsTreeItem.h
#pragma once #include <QTreeWidgetItem> #include "robomongo/core/Core.h" namespace Robomongo { class CollectionStatsTreeItem : public QTreeWidgetItem { public: CollectionStatsTreeItem(MongoDocumentPtr document); }; }
242
C++
.h
11
18.727273
59
0.769565
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,214
BsonTreeView.h
Studio3T_robomongo/src/robomongo/gui/widgets/workarea/BsonTreeView.h
#pragma once #include <QTreeView> #include "robomongo/core/domain/Notifier.h" #include "robomongo/gui/widgets/workarea/OutputItemContentWidget.h" namespace Robomongo { class InsertDocumentResponse; class BsonTreeView : public QTreeView, public INotifierObserver { Q_OBJECT public: typedef QTreeView BaseClass; BsonTreeView(MongoShell *shell, const MongoQueryInfo &queryInfo, QWidget *parent = NULL); virtual QModelIndex selectedIndex() const; virtual QModelIndexList selectedIndexes() const; void expandNode(const QModelIndex &index); void collapseNode(const QModelIndex &index); private Q_SLOTS: void onExpandRecursive(); void onCollapseRecursive(); void showContextMenu(const QPoint &point); protected: virtual void resizeEvent(QResizeEvent *event); virtual void keyPressEvent(QKeyEvent *event); private: Notifier _notifier; QAction *_expandRecursive; QAction *_collapseRecursive; const OutputItemContentWidget* _outputItemContentWidget; }; }
1,129
C++
.h
31
29.483871
97
0.723464
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,215
WelcomeTab.h
Studio3T_robomongo/src/robomongo/gui/widgets/workarea/WelcomeTab.h
#pragma once #ifndef __linux__ // ---------------------- Windows, macOS impl. --------------------------// #include <QWidget> #include <QWebEnginePage> QT_BEGIN_NAMESPACE class QScrollArea; QT_END_NAMESPACE namespace Robomongo { // ------------------ WelcomeTab class WelcomeTab : public QWidget { Q_OBJECT public: WelcomeTab(QScrollArea* parent = nullptr); QScrollArea* getParent() const { return _parent; } void resize() { /* Not implemented for Windows and macOS */} private: QScrollArea* _parent; }; // ------------------ MyWebPage class MyWebPage : public QWebEnginePage { Q_OBJECT public: MyWebPage(QObject* parent = nullptr) : QWebEnginePage(parent) {} bool acceptNavigationRequest( QUrl const& url, NavigationType type, bool /*isMainFrame*/) override; }; } #else // -------------------------------- Linux impl. ------------------------------------// #include <QWidget> #include <QUrl> QT_BEGIN_NAMESPACE class QPushButton; class QNetworkReply; class QLabel; class QVBoxLayout; class QScrollArea; class QEvent; class QUrl; QT_END_NAMESPACE namespace Robomongo { struct ConnectionEstablishedEvent; class ConnectionSettings; class WelcomeTab : public QWidget { Q_OBJECT public: WelcomeTab(QScrollArea *parent = nullptr); ~WelcomeTab(); QScrollArea* getParent() const { return _parent; } void resize(); protected: bool eventFilter(QObject *target, QEvent *event) override; private Q_SLOTS: void on_downloadTextReply(QNetworkReply* reply); void on_downloadPictureReply(QNetworkReply* reply); void on_downloadRssReply(QNetworkReply* reply); void on_allBlogsButton_clicked(); private: void setWhatsNewHeaderAndText(QString const& str); QLabel* _pic1 = nullptr; QLabel* _blogsSection; QLabel* _blogsHeader; QPushButton* _allBlogsButton = nullptr; QVBoxLayout* _blogLinksLay; QLabel* _whatsNewHeader; QLabel* _whatsNewText; QPushButton* _clearButton; QScrollArea* _parent; QPixmap _image; QUrl _pic1_URL; QUrl _text1_URL; QUrl _rss_URL; }; } #endif // -------------------------------- end of Linux ------------------------------------//
2,409
C++
.h
79
24.810127
95
0.603202
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,216
BsonTableView.h
Studio3T_robomongo/src/robomongo/gui/widgets/workarea/BsonTableView.h
#pragma once #include <QTableView> #include "robomongo/core/domain/Notifier.h" namespace Robomongo { class BsonTableView : public QTableView , public INotifierObserver { Q_OBJECT public: typedef QTableView BaseClass; explicit BsonTableView(MongoShell *shell, const MongoQueryInfo &queryInfo, QWidget *parent = 0); virtual QModelIndex selectedIndex() const; virtual QModelIndexList selectedIndexes() const; public Q_SLOTS: void showContextMenu(const QPoint &point); protected: virtual void keyPressEvent(QKeyEvent *event); private: Notifier _notifier; }; }
658
C++
.h
21
25.47619
109
0.710443
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,217
OutputItemHeaderWidget.h
Studio3T_robomongo/src/robomongo/gui/widgets/workarea/OutputItemHeaderWidget.h
#pragma once #include <QWidget> QT_BEGIN_NAMESPACE class QPushButton; QT_END_NAMESPACE #include "robomongo/gui/editors/PlainJavaScriptEditor.h" #include "robomongo/core/domain/MongoShellResult.h" #include "robomongo/gui/widgets/workarea/PagingWidget.h" namespace Robomongo { class OutputItemContentWidget; class Indicator; class OutputItemHeaderWidget : public QFrame { Q_OBJECT public: OutputItemHeaderWidget(OutputItemContentWidget *output, bool multipleResults, bool tabbedResults, bool firstItem, bool lastItem, QWidget *parent = nullptr); PagingWidget *paging() const { return _paging; } void showText(); void showTree(); void showTable(); void showCustom(); void applyDockUndockSettings(bool docking); void toggleOrientation(Qt::Orientation orientation); protected: virtual void mouseDoubleClickEvent(QMouseEvent *); Q_SIGNALS: void restoredSize(); void maximizedPart(); public Q_SLOTS: void setTime(const QString &time); void setCollection(const QString &collection); void maximizeMinimizePart(); private: void updateDockButtonOnToggleOrientation() const; QPushButton *_textButton; QPushButton *_treeButton; QPushButton *_tableButton; QPushButton *_customButton; QPushButton *_maxButton; QFrame *_verticalLine; QPushButton *_dockUndockButton; Indicator *_collectionIndicator; Indicator *_timeIndicator; PagingWidget *_paging; bool _maximized; bool _multipleResults; bool _firstItem; bool _lastItem; Qt::Orientation _orientation; }; }
1,779
C++
.h
53
26.188679
105
0.68105
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,218
PagingWidget.h
Studio3T_robomongo/src/robomongo/gui/widgets/workarea/PagingWidget.h
#pragma once #include <QWidget> QT_BEGIN_NAMESPACE class QLineEdit; QT_END_NAMESPACE namespace Robomongo { class PagingWidget : public QWidget { Q_OBJECT public: typedef QWidget BaseClass; enum {pageLimit = 50}; PagingWidget(QWidget *parent = NULL); void setSkip(int skip); void setBatchSize(int limit); Q_SIGNALS: void leftClicked(int skip, int limit); void rightClicked(int skip, int limit); void refreshed(int skip, int limit); private Q_SLOTS: void leftButton_clicked(); void rightButton_clicked(); void refresh(); private: QLineEdit *_skipEdit; QLineEdit *_batchSizeEdit; }; }
728
C++
.h
29
19.068966
47
0.646465
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,219
CollectionStatsTreeWidget.h
Studio3T_robomongo/src/robomongo/gui/widgets/workarea/CollectionStatsTreeWidget.h
#pragma once #include <QTreeWidget> #include "robomongo/core/Core.h" namespace Robomongo { class CollectionStatsTreeWidget : public QTreeWidget { Q_OBJECT public: CollectionStatsTreeWidget(const std::vector<MongoDocumentPtr> &documents, QWidget *parent = NULL); }; }
302
C++
.h
12
21.25
106
0.738676
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,220
BsonTableModel.h
Studio3T_robomongo/src/robomongo/gui/widgets/workarea/BsonTableModel.h
#pragma once #include <vector> #include <QAbstractProxyModel> namespace Robomongo { class BsonTreeItem; class BsonTableModelProxy : public QAbstractProxyModel { Q_OBJECT public: typedef QAbstractProxyModel BaseClass; typedef std::vector<QString> ColumnsValuesType; explicit BsonTableModelProxy(QObject *parent = 0); QVariant data(const QModelIndex &index, int role) const; int rowCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &parent) const; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; QModelIndex index( int row, int col, const QModelIndex& index ) const; virtual QModelIndex mapFromSource( const QModelIndex & sourceIndex ) const; virtual QModelIndex mapToSource( const QModelIndex &proxyIndex ) const; virtual void setSourceModel( QAbstractItemModel* model ); virtual QModelIndex parent( const QModelIndex& index ) const; virtual QModelIndex sibling(int row, int column, const QModelIndex &idx) const; private: QString column(int col) const; size_t addColumn(const QString &col); size_t findIndexColumn(const QString &col) const; ColumnsValuesType _columns; BsonTreeItem *_root; }; }
1,368
C++
.h
31
37.193548
104
0.717081
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,221
ScriptWidget.h
Studio3T_robomongo/src/robomongo/gui/widgets/workarea/ScriptWidget.h
#pragma once #include <QFrame> QT_BEGIN_NAMESPACE class QLabel; class QCompleter; QT_END_NAMESPACE #include "robomongo/core/domain/MongoShellResult.h" #include "robomongo/core/domain/CursorPosition.h" namespace Robomongo { class FindFrame; class TopStatusBar; class MongoShell; class Indicator; class QueryWidget; class AutoCompletionInfo { public: AutoCompletionInfo() : _text(""), _line(0), _lineIndexLeft(0), _lineIndexRight(0) {} AutoCompletionInfo(const QString &text, int line, int lineIndexLeft, int lineIndexRight = 0) : _text(text), _line(line), _lineIndexLeft(lineIndexLeft), _lineIndexRight(lineIndexRight) {} QString text() const { return _text; } int line() const { return _line; } int lineIndexLeft() const { return _lineIndexLeft; } int lineIndexRight() const { return _lineIndexRight; } bool isEmpty() const { return _text.isEmpty(); } private: QString _text; // text, for which we are trying to find completions int _line; // line number in editor, where 'text' is located int _lineIndexLeft; // index of first char in the line, where 'text' is started int _lineIndexRight;// index of last char in the line, where 'text' is ended }; class ScriptWidget : public QFrame { Q_OBJECT public: ScriptWidget(MongoShell *shell, QueryWidget* parent); /** * @reimp */ bool eventFilter(QObject *obj, QEvent *e); void setup(const MongoShellExecResult & execResult); void setTextCursor(const CursorPosition &cursor = CursorPosition()); QString text() const; QString selectedText() const; void selectAll(); void setScriptFocus(); void setCurrentDatabase(const std::string &database, bool isValid = true); void setCurrentServer(const std::string &address, bool isValid = true); void showAutocompletion(const QStringList &list, const QString &prefix); void showAutocompletion(); void hideAutocompletion(); bool getDisableTextAndCursorNotifications() { return _disableTextAndCursorNotifications; } void setDisableTextAndCursorNotifications(const bool value) { _disableTextAndCursorNotifications = value; } void disableFixedHeight() const; Q_SIGNALS: void textChanged(); public Q_SLOTS: void setText(const QString &text); void ui_queryLinesCountChanged(); private Q_SLOTS: void onTextChanged(); void onCursorPositionChanged(int line, int index); void onCompletionActivated(const QString&); private: void configureQueryText(); /** * @brief Calculates line height of text editor */ int lineHeight() const; /** * @brief Calculates char width of text editor */ int charWidth(); /** * @brief Because of different fonts, differents OSes etc. we didn't find * a better way to find required position for autocompletion box. * We just hardcoded it. */ int autocompletionBoxLeftPosition(); /** * @brief Calculates preferable editor height for specified number of lines */ int editorHeight(int lines) const; AutoCompletionInfo sanitizeForAutocompletion(); FindFrame *_queryText; TopStatusBar *_topStatusBar; QCompleter *_completer; MongoShell *_shell; AutoCompletionInfo _currentAutoCompletionInfo; QueryWidget *_parent; bool _textChanged; bool _disableTextAndCursorNotifications; }; class TopStatusBar : public QFrame { Q_OBJECT public: TopStatusBar(const std::string &connectionName, const std::string &serverName, const std::string &dbName); void setCurrentDatabase(const std::string &database, bool isValid = true); void setCurrentServer(const std::string &address, bool isValid = true); void showProgress(); void hideProgress(); private: Indicator *_currentDatabaseLabel; Indicator *_currentServerLabel; Indicator *_currentConnectionLabel; QColor _textColor; }; }
4,404
C++
.h
117
29.512821
115
0.65107
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,222
QueryWidget.h
Studio3T_robomongo/src/robomongo/gui/widgets/workarea/QueryWidget.h
#pragma once #include <QWidget> #include <QDockWidget> #include <QCloseEvent> QT_BEGIN_NAMESPACE class QLabel; class QVBoxLayout; class QMainWindow; class QPushButton; class QFrame; QT_END_NAMESPACE #include "robomongo/core/Core.h" #include "robomongo/core/domain/MongoShellResult.h" namespace Robomongo { class BsonWidget; class DocumentListLoadedEvent; class ScriptExecutedEvent; class AutocompleteResponse; class OutputWidget; class ScriptWidget; class MongoShell; class QueryWidget : public QWidget { Q_OBJECT public: class CustomDockWidget; typedef QWidget BaseClass; QueryWidget(MongoShell *shell, QWidget *parent = NULL); ~QueryWidget(); void toggleOrientation(); void activateTabContent(); void openNewTab(); void reload(); void duplicate(); void enterTreeMode(); void enterTextMode(); void enterTableMode(); void enterCustomMode(); void setScriptFocus(); void showAutocompletion(); void hideAutocompletion(); void setCurrentDatabase(const std::string &dbname); // Bring active tab's dock into front void bringDockToFront(); // Get output window's dock status bool outputWindowDocked() const; Q_SIGNALS: void titleChanged(const QString &text); void toolTipChanged(const QString &text); public Q_SLOTS: void execute(); void stop(); void saveToFile(); void savebToFileAs(); void openFile(); void textChange(); void showProgress(); void hideProgress(); void handle(DocumentListLoadedEvent *event); void handle(ScriptExecutedEvent *event); void handle(AutocompleteResponse *event); private Q_SLOTS: // Make adjustments between output window dock/undock events void on_dock_undock(); // Toggle output window between dock/undock status void dockUndock(); void changeShellTimeout(); private: void updateCurrentTab(); void displayData(const std::vector<MongoShellResult> &results, bool empty); MongoShell *_shell; OutputWidget *_viewer; ScriptWidget *_scriptWidget; QLabel *_outputLabel; QDockWidget *_dock; QMainWindow *_outputWindow; QFrame *_line; QVBoxLayout *_mainLayout; MongoShellExecResult _currentResult; bool _isTextChanged; }; /* ------- class CustomDockWidget -------- */ /* Custom dock widget for output window */ class QueryWidget::CustomDockWidget : public QDockWidget { Q_OBJECT public: CustomDockWidget(QueryWidget* parent) : _parent(parent) {} QueryWidget* getParentQueryWidget() const { return _parent; } protected: // Dock instead of close void closeEvent(QCloseEvent *event) override { event->ignore(); setFloating(false); } private: QueryWidget* _parent; }; }
3,147
C++
.h
103
23.097087
83
0.645418
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,223
OutputWidget.h
Studio3T_robomongo/src/robomongo/gui/widgets/workarea/OutputWidget.h
#pragma once #include <QTabWidget> QT_BEGIN_NAMESPACE class QSplitter; QT_END_NAMESPACE #include "robomongo/core/domain/MongoShellResult.h" #include "robomongo/core/Enums.h" namespace Robomongo { class OutputItemContentWidget; class ProgressBarPopup; class MongoShell; class OutputWidget : public QTabWidget { Q_OBJECT public: explicit OutputWidget(QWidget *parent); void present(MongoShell *shell, const std::vector<MongoShellResult> &documents); void updatePart(int partIndex, const MongoQueryInfo &queryInfo, const std::vector<MongoDocumentPtr> &documents); void updatePart(int partIndex, const AggrInfo &agrrInfo, const std::vector<MongoDocumentPtr> &documents); void toggleOrientation(); void switchMode(std::function<void(OutputItemContentWidget*)> modeFunc); void enterTreeMode(); void enterTextMode(); void enterTableMode(); void enterCustomMode(); int resultIndex(OutputItemContentWidget *result); void showProgress(); void hideProgress(); bool progressBarActive() const; void applyDockUndockSettings(bool isDocking) const; Qt::Orientation getOrientation() const; private Q_SLOTS: void restoreSize(); void maximizePart(); void tabCloseRequested(int); private: void mouseReleaseEvent(QMouseEvent *event); void clearAllParts(); QString buildStyleSheet(); void tryToMakeAllPartsEqualInSize(); bool _tabbedResults; std::vector<ViewMode> _prevViewModes; int _prevResultsCount; QSplitter *_splitter; ProgressBarPopup *_progressBarPopup; std::vector<OutputItemContentWidget*> _outputItemContentWidgets; }; }
1,848
C++
.h
51
28.607843
88
0.688901
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,224
BsonTreeModel.h
Studio3T_robomongo/src/robomongo/gui/widgets/workarea/BsonTreeModel.h
#pragma once #include <vector> #include <QAbstractItemModel> #include "robomongo/core/Core.h" namespace Robomongo { class BsonTreeItem; class BsonTreeModel : public QAbstractItemModel { Q_OBJECT public: typedef QAbstractItemModel BaseClass; static const QIcon &getIcon(BsonTreeItem *item); explicit BsonTreeModel(const std::vector<MongoDocumentPtr> &documents, QObject *parent = 0); QVariant data(const QModelIndex &index, int role) const; int rowCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &parent) const; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; Qt::ItemFlags flags(const QModelIndex &index) const; virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; virtual QModelIndex parent(const QModelIndex& index) const; void insertItem(BsonTreeItem *parent, BsonTreeItem *children); void removeitem(BsonTreeItem *children); virtual void fetchMore(const QModelIndex &parent); virtual bool canFetchMore(const QModelIndex &parent) const; virtual bool hasChildren(const QModelIndex &parent = QModelIndex()) const; protected: BsonTreeItem *const _root; }; }
1,360
C++
.h
30
38.766667
104
0.724112
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,225
IndicatorLabel.h
Studio3T_robomongo/src/robomongo/gui/widgets/workarea/IndicatorLabel.h
#pragma once #include <QWidget> QT_BEGIN_NAMESPACE class QIcon; class QLabel; QT_END_NAMESPACE namespace Robomongo { class Indicator : public QWidget { Q_OBJECT public: Indicator(const QIcon &icon, const QString &text = QString()); void setText(const QString &text); private: QLabel *createLabelWithIcon(const QIcon &icon); QLabel *_label; }; }
409
C++
.h
19
17.157895
70
0.681347
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,226
OutputItemContentWidget.h
Studio3T_robomongo/src/robomongo/gui/widgets/workarea/OutputItemContentWidget.h
#pragma once #include <QStackedWidget> #include "robomongo/core/Core.h" #include "robomongo/core/domain/MongoQueryInfo.h" #include "robomongo/core/domain/MongoAggregateInfo.h" #include "robomongo/core/Enums.h" #include <vector> namespace Robomongo { class FindFrame; class BsonTreeView; class BsonTableView; class BsonTreeModel; class JsonPrepareThread; class CollectionStatsTreeWidget; class MongoShell; class OutputItemHeaderWidget; class OutputWidget; class OutputItemContentWidget : public QWidget { Q_OBJECT public: typedef QWidget BaseClass; OutputItemContentWidget(ViewMode viewMode, MongoShell *shell, const QString &text, double secs, bool multipleResults, bool tabbedResults, bool firstItem, bool lastItem, AggrInfo aggrInfo, QWidget *parent); OutputItemContentWidget(ViewMode viewMode, MongoShell *shell, const QString &type, const std::vector<MongoDocumentPtr> &documents, const MongoQueryInfo &queryInfo, double secs, bool multipleResults, bool tabbedResults, bool firstItem, bool lastItem, AggrInfo aggrInfo, QWidget *parent); int _initialSkip; int _initialLimit; void updateWithInfo(const MongoQueryInfo &inf, const std::vector<MongoDocumentPtr> &documents); void updateWithInfo(const AggrInfo &aggrInfo, const std::vector<MongoDocumentPtr> &documents); void update(const std::vector<MongoDocumentPtr> &documents, int skip, int batchSize); bool isTextModeSupported() const { return _isTextModeSupported; } bool isTreeModeSupported() const { return _isTreeModeSupported; } bool isCustomModeSupported() const { return _isCustomModeSupported; } bool isTableModeSupported() const { return _isTableModeSupported; } ViewMode viewMode() const { return _viewMode; } void refreshOutputItem(); void markUninitialized(); void applyDockUndockSettings(bool isDocking) const; void toggleOrientation(Qt::Orientation orientation) const; const OutputWidget* outputWidget() const { return _outputWidget; } Q_SIGNALS: void restoredSize(); void maximizedPart(); public Q_SLOTS: void showText(); void showTree(); void showTable(); void showCustom(); private Q_SLOTS: void jsonPartReady(const QString &json); void refresh(int skip, int batchSize); void paging_rightClicked(int skip, int batchSize); void paging_leftClicked(int skip, int limit); private: void setup(double secs, bool multipleResults, bool tabbedResults, bool firstItem, bool lastItem); FindFrame *configureLogText(); BsonTreeModel *configureModel(); FindFrame *_textView; BsonTreeView *_bsonTreeview; BsonTableView *_bsonTable; BsonTreeModel *_mod; CollectionStatsTreeWidget *_collectionStats; QString _text; QString _type; // type of request std::vector<MongoDocumentPtr> _documents; MongoQueryInfo _queryInfo; AggrInfo _aggrInfo; QStackedWidget *_stack; JsonPrepareThread *_thread; MongoShell *_shell; OutputItemHeaderWidget *_header; OutputWidget *_outputWidget; bool _isTextModeSupported; bool _isTreeModeSupported; bool _isTableModeSupported; bool _isCustomModeSupported; bool _isTextModeInitialized; bool _isTreeModeInitialized; bool _isTableModeInitialized; bool _isCustomModeInitialized; bool _isFirstPartRendered; ViewMode _viewMode; }; }
3,857
C++
.h
90
33.522222
105
0.673959
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,227
WorkAreaTabWidget.h
Studio3T_robomongo/src/robomongo/gui/widgets/workarea/WorkAreaTabWidget.h
#pragma once #include <QTabWidget> namespace Robomongo { class QueryWidget; class OpeningShellEvent; class WelcomeTab; /** * @brief WorkArea tab widget. Each tab represents MongoDB shell. */ class WorkAreaTabWidget : public QTabWidget { Q_OBJECT public: /** * @brief Creates WorkAreaTabWidget. * @param workAreaWidget: WorkAreaWidget this tab belongs to. */ explicit WorkAreaTabWidget(QWidget *parent = 0); void closeTab(int index); void nextTab(); void previousTab(); QueryWidget *currentQueryWidget(); QueryWidget *queryWidget(int index); WelcomeTab *getWelcomeTab(); void openWelcomeTab(); public Q_SLOTS: void handle(OpeningShellEvent *event); void tabBar_tabCloseRequested(int index); void ui_newTabRequested(int index); void ui_reloadTabRequested(int index); void ui_duplicateTabRequested(int index); void ui_closeOtherTabsRequested(int index); void ui_closeTabsToTheRightRequested(int index); void ui_currentChanged(int index); void tabTextChange(const QString &text); void tooltipTextChange(const QString &text); protected: /** * @brief Overrides QTabWidget::keyPressEvent() in order to intercept * tab close key shortcuts (Ctrl+F4 and Ctrl+W) */ virtual void keyPressEvent(QKeyEvent *event) override; void resizeEvent(QResizeEvent* event) override; private: WelcomeTab* _welcomeTab; }; }
1,604
C++
.h
48
26.020833
76
0.663648
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,228
BsonTreeItem.h
Studio3T_robomongo/src/robomongo/gui/widgets/workarea/BsonTreeItem.h
#pragma once #include <vector> #include <QObject> #include <mongo/bson/bsonobj.h> #include <mongo/bson/bsonelement.h> namespace Robomongo { /** * @brief BSON tree item (represents array or object) */ struct BsonItemFields { QString _key; QString _value; mongo::BSONType _type; mongo::BinDataType _binType; }; class BsonTreeItem : public QObject { Q_OBJECT public: enum eColumn { eKey = 0, eValue = 1, eType = 2, eCountColumns = 3 }; typedef QObject BaseClass; typedef std::vector<BsonTreeItem*> ChildContainerType; explicit BsonTreeItem(QObject *parent = 0); explicit BsonTreeItem(const mongo::BSONObj &bsonObjRoot, QObject *parent = 0); unsigned childrenCount() const; void clear(); void addChild(BsonTreeItem *item); void removeChild(BsonTreeItem *item); BsonTreeItem* child(unsigned pos) const; BsonTreeItem* childSafe(unsigned pos) const; BsonTreeItem* childByKey(const QString &val); int indexOf(BsonTreeItem *item) const; const BsonTreeItem* superParent() const; mongo::BSONObj root() const; mongo::BSONObj superRoot() const; std::string fieldName() const { return _fieldName; }; void setFieldName(const std::string &fieldName) { _fieldName = fieldName; }; QString key() const; void setKey(const QString &key); QString value() const; void setValue(const QString &value); mongo::BSONType type() const; void setType(mongo::BSONType type); mongo::BinDataType binType() const; void setBinType(mongo::BinDataType type); protected: const mongo::BSONObj _root; ChildContainerType _items; BsonItemFields _fields; std::string _fieldName; }; }
1,944
C++
.h
60
24.666667
86
0.628877
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,229
ProgressBarPopup.h
Studio3T_robomongo/src/robomongo/gui/widgets/workarea/ProgressBarPopup.h
#pragma once #include <QFrame> QT_BEGIN_NAMESPACE class QLabel; QT_END_NAMESPACE namespace Robomongo { class ProgressBarPopup : public QFrame { Q_OBJECT public: ProgressBarPopup(QWidget *parent = NULL); enum {heightProgress = 16, widthProgress = 164, height = heightProgress+20, width = widthProgress+20 }; private: QLabel *_progressLabel; }; }
402
C++
.h
17
19.352941
112
0.695538
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,230
GuiConstants.h
Studio3T_robomongo/src/robomongo/gui/utils/GuiConstants.h
#pragma once namespace Robomongo { namespace HighDpiConstants { int const WIN_HIGH_DPI_BUTTON_HEIGHT = 23; int const MACOS_HIGH_DPI_BUTTON_HEIGHT = 34; } enum AuthMechanism { SCRAM_SHA_1, SCRAM_SHA_256, MONGODB_CR }; inline AuthMechanism authMechanismFromStr(std::string_view str) { if (str == "SCRAM-SHA-1") return SCRAM_SHA_1; else if (str == "SCRAM-SHA-256") return SCRAM_SHA_256; else if (str == "MONGODB-CR") return MONGODB_CR; else return SCRAM_SHA_1; } } /* end of Robomongo namespace */
636
C++
.h
20
25.65
69
0.588907
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,231
ComboBoxUtils.h
Studio3T_robomongo/src/robomongo/gui/utils/ComboBoxUtils.h
#pragma once #include <QComboBox> namespace Robomongo { namespace utils { /** * @brief This function behaves identically to Qt5 QComboBox::setCurrentText(). * We are using this function in order to support Qt4 */ void setCurrentText(QComboBox *comboBox, const QString &text); } }
337
C++
.h
13
20.538462
87
0.661491
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,232
DialogUtils.h
Studio3T_robomongo/src/robomongo/gui/utils/DialogUtils.h
#pragma once #include <QMessageBox> namespace Robomongo { namespace utils { int questionDialog(QWidget *parent, const QString &actionText, const QString &itemText, const QString &valueText); int questionDialog(QWidget *parent, const QString &actionText, const QString &itemText, const QString &templateText, const QString &valueText); } }
371
C++
.h
10
32.9
151
0.756303
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,233
PlainJavaScriptEditor.h
Studio3T_robomongo/src/robomongo/gui/editors/PlainJavaScriptEditor.h
#pragma once #include <Qsci/qsciscintilla.h> namespace Robomongo { class RoboScintilla : public QsciScintilla { Q_OBJECT public: typedef QsciScintilla BaseClass; enum { rowNumberWidth = 6, indentationWidth = 4 }; static const QColor marginsBackgroundColor; static const QColor caretForegroundColor; static const QColor matchedBraceForegroundColor; RoboScintilla(QWidget *parent = NULL); void setIgnoreEnterKey(bool ignore) { _ignoreEnterKey = ignore; } void setIgnoreTabKey(bool ignore) { _ignoreTabKey = ignore; } int lineNumberMarginWidth() const; int textWidth(int style, const QString &text); void setAppropriateBraceMatching(); protected: void wheelEvent(QWheelEvent *e); void keyPressEvent(QKeyEvent *e); private Q_SLOTS: void updateLineNumbersMarginWidth(); private: void setLineNumbers(bool displayNumbers); void toggleLineNumbers(); bool _ignoreEnterKey; bool _ignoreTabKey; int _lineNumberMarginWidth; int _lineNumberDigitWidth; }; }
1,146
C++
.h
33
27.606061
73
0.690154
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,234
FindFrame.h
Studio3T_robomongo/src/robomongo/gui/editors/FindFrame.h
#pragma once #include <QFrame> QT_BEGIN_NAMESPACE class QTextEdit; class QPushButton; class QToolButton; class QCheckBox; class QLineEdit; QT_END_NAMESPACE class QsciScintilla; namespace Robomongo { class RoboScintilla; class FindFrame : public QFrame { Q_OBJECT public: enum { HeightFindPanel = 38 }; typedef QFrame BaseClass; explicit FindFrame(QWidget *parent); RoboScintilla *const sciScintilla() const { return _scin; } void toggleComments(); virtual ~FindFrame(); protected: virtual void wheelEvent(QWheelEvent *e); virtual void keyPressEvent(QKeyEvent *e); private Q_SLOTS: void goToNextElement(); void goToPrevElement(); private: void findElement(bool forward); void setLineComment(const int lineIndex, const bool commentOut); RoboScintilla *const _scin; QFrame *const _findPanel; QLineEdit *const _findLine; QToolButton *const _close; QPushButton *const _next; QPushButton *const _prev; QCheckBox *const _caseSensitive; const char *_commentSign; const int _commentSignLength; QWidget *_parent; }; }
1,288
C++
.h
50
19.18
72
0.646629
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,235
JSLexer.h
Studio3T_robomongo/src/robomongo/gui/editors/JSLexer.h
#pragma once #include <QObject> #include <QColor> #include <Qsci/qscilexerjavascript.h> namespace Robomongo { class JSLexer : public QsciLexerJavaScript { Q_OBJECT // This Q_OBJECT macro produce the following error for VC, but works on GCC: // unresolved external symbol "public: static struct QMetaObject const... // Q_OBJECT public: JSLexer(QObject *parent = 0); QColor defaultPaper(int style) const; QColor defaultColor(int style) const; const char *keywords(int set) const; }; }
566
C++
.h
19
24.421053
84
0.680147
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,236
libssh2_config.h
Studio3T_robomongo/src/third-party/libssh2-1.9.0/sources/vms/libssh2_config.h
#ifndef LIBSSH2_CONFIG_H #ifdef __VMS #define LIBSSH2_CONFIG_H /* VMS specific libssh2_config.h */ #define ssize_t SSIZE_T typedef unsigned int uint32_t ; typedef unsigned int socklen_t; /* missing in headers on VMS */ /* Have's */ #define HAVE_UNISTD_H #define HAVE_STDLIB_H #define HAVE_INTTYPES_H #define HAVE_SYS_TIME_H #define HAVE_SELECT #define HAVE_UIO #define HAVE_SYS_SOCKET.H #define HAVE_NETINET_IN_H #define HAVE_ARPA_INET_H #define HAVE_GETTIMEOFDAY 1 #define POSIX_C_SOURCE /* Enable the possibility of using tracing */ #define LIBSSH2DEBUG 1 /* For selection of proper block/unblock function in session.c */ #define HAVE_FIONBIO #include <stropts.h> /* In VMS TCP/IP Services and some BSD variants SO_STATE retrieves * a bitmask revealing amongst others the blocking state of the * socket. On VMS the bits are undocumented, but SS_NBIO * works, I did not test the other bits. Below bitdefs are * from Berkely source socketvar.h at * http://ftp.fibranet.cat/UnixArchive/PDP-11/Trees/2.11BSD/sys/h/socketvar.h * Socket state bits. * #define SS_NOFDREF 0x001 no file table ref any more * #define SS_ISCONNECTED 0x002 socket connected to a peer * #define SS_ISCONNECTING 0x004 in process of connecting to peer * #define SS_ISDISCONNECTING 0x008 in process of disconnecting * #define SS_CANTSENDMORE 0x010 can't send more data to peer * #define SS_CANTRCVMORE 0x020 can't receive more data from peer * #define SS_RCVATMARK 0x040 at mark on input * #define SS_PRIV 0x080 privileged for broadcast, raw... * #define SS_NBIO 0x100 non-blocking ops * #define SS_ASYNC 0x200 async i/o notify * */ #ifdef SO_STATE /* SO_STATE is defined in stropts.h by DECC * When running on Multinet, SO_STATE renders a protocol * not started error. Functionally this has no impact, * apart from libssh2 not being able to restore the socket * to the proper blocking/non-blocking state. */ #define SS_NBIO 0x100 #endif /* Use OpenSSL */ #define LIBSSH2_OPENSSL 1 /* Compile in zlib support. We link against gnv$libzshr, as available * from https://sourceforge.net/projects/vms-ports/files/. */ #define LIBSSH2_HAVE_ZLIB /* Enable newer diffie-hellman-group-exchange-sha1 syntax */ #define LIBSSH2_DH_GEX_NEW 1 #endif /* __VMS */ #endif /* LIBSSH2_CONFIG_H */
2,468
C++
.h
63
36.587302
77
0.715006
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
15,237
libssh2.h
Studio3T_robomongo/src/third-party/libssh2-1.9.0/sources/include/libssh2.h
/* Copyright (c) 2004-2009, Sara Golemon <sarag@libssh2.org> * Copyright (c) 2009-2015 Daniel Stenberg * Copyright (c) 2010 Simon Josefsson <simon@josefsson.org> * All rights reserved. * * Redistribution and use in source and binary forms, * with or without modification, are permitted provided * that the following conditions are met: * * Redistributions of source code must retain the above * copyright notice, this list of conditions and the * following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the copyright holder nor the names * of any other contributors may be used to endorse or * promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. */ #ifndef LIBSSH2_H #define LIBSSH2_H 1 #define LIBSSH2_COPYRIGHT "2004-2019 The libssh2 project and its contributors." /* We use underscore instead of dash when appending DEV in dev versions just to make the BANNER define (used by src/session.c) be a valid SSH banner. Release versions have no appended strings and may of course not have dashes either. */ #define LIBSSH2_VERSION "1.9.0_DEV" /* The numeric version number is also available "in parts" by using these defines: */ #define LIBSSH2_VERSION_MAJOR 1 #define LIBSSH2_VERSION_MINOR 9 #define LIBSSH2_VERSION_PATCH 0 /* This is the numeric version of the libssh2 version number, meant for easier parsing and comparions by programs. The LIBSSH2_VERSION_NUM define will always follow this syntax: 0xXXYYZZ Where XX, YY and ZZ are the main version, release and patch numbers in hexadecimal (using 8 bits each). All three numbers are always represented using two digits. 1.2 would appear as "0x010200" while version 9.11.7 appears as "0x090b07". This 6-digit (24 bits) hexadecimal number does not show pre-release number, and it is always a greater number in a more recent release. It makes comparisons with greater than and less than work. */ #define LIBSSH2_VERSION_NUM 0x010900 /* * This is the date and time when the full source package was created. The * timestamp is not stored in the source code repo, as the timestamp is * properly set in the tarballs by the maketgz script. * * The format of the date should follow this template: * * "Mon Feb 12 11:35:33 UTC 2007" */ #define LIBSSH2_TIMESTAMP "DEV" #ifndef RC_INVOKED #ifdef __cplusplus extern "C" { #endif #ifdef _WIN32 # include <basetsd.h> # include <winsock2.h> #endif #include <stddef.h> #include <string.h> #include <sys/stat.h> #include <sys/types.h> /* Allow alternate API prefix from CFLAGS or calling app */ #ifndef LIBSSH2_API # ifdef LIBSSH2_WIN32 # ifdef _WINDLL # ifdef LIBSSH2_LIBRARY # define LIBSSH2_API __declspec(dllexport) # else # define LIBSSH2_API __declspec(dllimport) # endif /* LIBSSH2_LIBRARY */ # else # define LIBSSH2_API # endif # else /* !LIBSSH2_WIN32 */ # define LIBSSH2_API # endif /* LIBSSH2_WIN32 */ #endif /* LIBSSH2_API */ #ifdef HAVE_SYS_UIO_H # include <sys/uio.h> #endif #if (defined(NETWARE) && !defined(__NOVELL_LIBC__)) # include <sys/bsdskt.h> typedef unsigned char uint8_t; typedef unsigned short int uint16_t; typedef unsigned int uint32_t; typedef int int32_t; typedef unsigned long long uint64_t; typedef long long int64_t; #endif #ifdef _MSC_VER typedef unsigned char uint8_t; typedef unsigned short int uint16_t; typedef unsigned int uint32_t; typedef __int32 int32_t; typedef __int64 int64_t; typedef unsigned __int64 uint64_t; typedef unsigned __int64 libssh2_uint64_t; typedef __int64 libssh2_int64_t; #if (!defined(HAVE_SSIZE_T) && !defined(ssize_t)) typedef SSIZE_T ssize_t; #define HAVE_SSIZE_T #endif #else #include <stdint.h> typedef unsigned long long libssh2_uint64_t; typedef long long libssh2_int64_t; #endif #ifdef WIN32 typedef SOCKET libssh2_socket_t; #define LIBSSH2_INVALID_SOCKET INVALID_SOCKET #else /* !WIN32 */ typedef int libssh2_socket_t; #define LIBSSH2_INVALID_SOCKET -1 #endif /* WIN32 */ /* * Determine whether there is small or large file support on windows. */ #if defined(_MSC_VER) && !defined(_WIN32_WCE) # if (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64) # define LIBSSH2_USE_WIN32_LARGE_FILES # else # define LIBSSH2_USE_WIN32_SMALL_FILES # endif #endif #if defined(__MINGW32__) && !defined(LIBSSH2_USE_WIN32_LARGE_FILES) # define LIBSSH2_USE_WIN32_LARGE_FILES #endif #if defined(__WATCOMC__) && !defined(LIBSSH2_USE_WIN32_LARGE_FILES) # define LIBSSH2_USE_WIN32_LARGE_FILES #endif #if defined(__POCC__) # undef LIBSSH2_USE_WIN32_LARGE_FILES #endif #if defined(_WIN32) && !defined(LIBSSH2_USE_WIN32_LARGE_FILES) && \ !defined(LIBSSH2_USE_WIN32_SMALL_FILES) # define LIBSSH2_USE_WIN32_SMALL_FILES #endif /* * Large file (>2Gb) support using WIN32 functions. */ #ifdef LIBSSH2_USE_WIN32_LARGE_FILES # include <io.h> # include <sys/types.h> # include <sys/stat.h> # define LIBSSH2_STRUCT_STAT_SIZE_FORMAT "%I64d" typedef struct _stati64 libssh2_struct_stat; typedef __int64 libssh2_struct_stat_size; #endif /* * Small file (<2Gb) support using WIN32 functions. */ #ifdef LIBSSH2_USE_WIN32_SMALL_FILES # include <sys/types.h> # include <sys/stat.h> # ifndef _WIN32_WCE # define LIBSSH2_STRUCT_STAT_SIZE_FORMAT "%d" typedef struct _stat libssh2_struct_stat; typedef off_t libssh2_struct_stat_size; # endif #endif #ifndef LIBSSH2_STRUCT_STAT_SIZE_FORMAT # ifdef __VMS /* We have to roll our own format here because %z is a C99-ism we don't have. */ # if __USE_OFF64_T || __USING_STD_STAT # define LIBSSH2_STRUCT_STAT_SIZE_FORMAT "%Ld" # else # define LIBSSH2_STRUCT_STAT_SIZE_FORMAT "%d" # endif # else # define LIBSSH2_STRUCT_STAT_SIZE_FORMAT "%zd" # endif typedef struct stat libssh2_struct_stat; typedef off_t libssh2_struct_stat_size; #endif /* Part of every banner, user specified or not */ #define LIBSSH2_SSH_BANNER "SSH-2.0-libssh2_" LIBSSH2_VERSION #define LIBSSH2_SSH_DEFAULT_BANNER LIBSSH2_SSH_BANNER #define LIBSSH2_SSH_DEFAULT_BANNER_WITH_CRLF LIBSSH2_SSH_DEFAULT_BANNER "\r\n" /* Default generate and safe prime sizes for diffie-hellman-group-exchange-sha1 */ #define LIBSSH2_DH_GEX_MINGROUP 1024 #define LIBSSH2_DH_GEX_OPTGROUP 1536 #define LIBSSH2_DH_GEX_MAXGROUP 2048 /* Defaults for pty requests */ #define LIBSSH2_TERM_WIDTH 80 #define LIBSSH2_TERM_HEIGHT 24 #define LIBSSH2_TERM_WIDTH_PX 0 #define LIBSSH2_TERM_HEIGHT_PX 0 /* 1/4 second */ #define LIBSSH2_SOCKET_POLL_UDELAY 250000 /* 0.25 * 120 == 30 seconds */ #define LIBSSH2_SOCKET_POLL_MAXLOOPS 120 /* Maximum size to allow a payload to compress to, plays it safe by falling short of spec limits */ #define LIBSSH2_PACKET_MAXCOMP 32000 /* Maximum size to allow a payload to deccompress to, plays it safe by allowing more than spec requires */ #define LIBSSH2_PACKET_MAXDECOMP 40000 /* Maximum size for an inbound compressed payload, plays it safe by overshooting spec limits */ #define LIBSSH2_PACKET_MAXPAYLOAD 40000 /* Malloc callbacks */ #define LIBSSH2_ALLOC_FUNC(name) void *name(size_t count, void **abstract) #define LIBSSH2_REALLOC_FUNC(name) void *name(void *ptr, size_t count, \ void **abstract) #define LIBSSH2_FREE_FUNC(name) void name(void *ptr, void **abstract) typedef struct _LIBSSH2_USERAUTH_KBDINT_PROMPT { char *text; unsigned int length; unsigned char echo; } LIBSSH2_USERAUTH_KBDINT_PROMPT; typedef struct _LIBSSH2_USERAUTH_KBDINT_RESPONSE { char *text; unsigned int length; } LIBSSH2_USERAUTH_KBDINT_RESPONSE; /* 'publickey' authentication callback */ #define LIBSSH2_USERAUTH_PUBLICKEY_SIGN_FUNC(name) \ int name(LIBSSH2_SESSION *session, unsigned char **sig, size_t *sig_len, \ const unsigned char *data, size_t data_len, void **abstract) /* 'keyboard-interactive' authentication callback */ #define LIBSSH2_USERAUTH_KBDINT_RESPONSE_FUNC(name_) \ void name_(const char *name, int name_len, const char *instruction, \ int instruction_len, int num_prompts, \ const LIBSSH2_USERAUTH_KBDINT_PROMPT *prompts, \ LIBSSH2_USERAUTH_KBDINT_RESPONSE *responses, void **abstract) /* Callbacks for special SSH packets */ #define LIBSSH2_IGNORE_FUNC(name) \ void name(LIBSSH2_SESSION *session, const char *message, int message_len, \ void **abstract) #define LIBSSH2_DEBUG_FUNC(name) \ void name(LIBSSH2_SESSION *session, int always_display, const char *message, \ int message_len, const char *language, int language_len, \ void **abstract) #define LIBSSH2_DISCONNECT_FUNC(name) \ void name(LIBSSH2_SESSION *session, int reason, const char *message, \ int message_len, const char *language, int language_len, \ void **abstract) #define LIBSSH2_PASSWD_CHANGEREQ_FUNC(name) \ void name(LIBSSH2_SESSION *session, char **newpw, int *newpw_len, \ void **abstract) #define LIBSSH2_MACERROR_FUNC(name) \ int name(LIBSSH2_SESSION *session, const char *packet, int packet_len, \ void **abstract) #define LIBSSH2_X11_OPEN_FUNC(name) \ void name(LIBSSH2_SESSION *session, LIBSSH2_CHANNEL *channel, \ const char *shost, int sport, void **abstract) #define LIBSSH2_CHANNEL_CLOSE_FUNC(name) \ void name(LIBSSH2_SESSION *session, void **session_abstract, \ LIBSSH2_CHANNEL *channel, void **channel_abstract) /* I/O callbacks */ #define LIBSSH2_RECV_FUNC(name) \ ssize_t name(libssh2_socket_t socket, \ void *buffer, size_t length, \ int flags, void **abstract) #define LIBSSH2_SEND_FUNC(name) \ ssize_t name(libssh2_socket_t socket, \ const void *buffer, size_t length, \ int flags, void **abstract) /* libssh2_session_callback_set() constants */ #define LIBSSH2_CALLBACK_IGNORE 0 #define LIBSSH2_CALLBACK_DEBUG 1 #define LIBSSH2_CALLBACK_DISCONNECT 2 #define LIBSSH2_CALLBACK_MACERROR 3 #define LIBSSH2_CALLBACK_X11 4 #define LIBSSH2_CALLBACK_SEND 5 #define LIBSSH2_CALLBACK_RECV 6 /* libssh2_session_method_pref() constants */ #define LIBSSH2_METHOD_KEX 0 #define LIBSSH2_METHOD_HOSTKEY 1 #define LIBSSH2_METHOD_CRYPT_CS 2 #define LIBSSH2_METHOD_CRYPT_SC 3 #define LIBSSH2_METHOD_MAC_CS 4 #define LIBSSH2_METHOD_MAC_SC 5 #define LIBSSH2_METHOD_COMP_CS 6 #define LIBSSH2_METHOD_COMP_SC 7 #define LIBSSH2_METHOD_LANG_CS 8 #define LIBSSH2_METHOD_LANG_SC 9 /* flags */ #define LIBSSH2_FLAG_SIGPIPE 1 #define LIBSSH2_FLAG_COMPRESS 2 typedef struct _LIBSSH2_SESSION LIBSSH2_SESSION; typedef struct _LIBSSH2_CHANNEL LIBSSH2_CHANNEL; typedef struct _LIBSSH2_LISTENER LIBSSH2_LISTENER; typedef struct _LIBSSH2_KNOWNHOSTS LIBSSH2_KNOWNHOSTS; typedef struct _LIBSSH2_AGENT LIBSSH2_AGENT; typedef struct _LIBSSH2_POLLFD { unsigned char type; /* LIBSSH2_POLLFD_* below */ union { libssh2_socket_t socket; /* File descriptors -- examined with system select() call */ LIBSSH2_CHANNEL *channel; /* Examined by checking internal state */ LIBSSH2_LISTENER *listener; /* Read polls only -- are inbound connections waiting to be accepted? */ } fd; unsigned long events; /* Requested Events */ unsigned long revents; /* Returned Events */ } LIBSSH2_POLLFD; /* Poll FD Descriptor Types */ #define LIBSSH2_POLLFD_SOCKET 1 #define LIBSSH2_POLLFD_CHANNEL 2 #define LIBSSH2_POLLFD_LISTENER 3 /* Note: Win32 Doesn't actually have a poll() implementation, so some of these values are faked with select() data */ /* Poll FD events/revents -- Match sys/poll.h where possible */ #define LIBSSH2_POLLFD_POLLIN 0x0001 /* Data available to be read or connection available -- All */ #define LIBSSH2_POLLFD_POLLPRI 0x0002 /* Priority data available to be read -- Socket only */ #define LIBSSH2_POLLFD_POLLEXT 0x0002 /* Extended data available to be read -- Channel only */ #define LIBSSH2_POLLFD_POLLOUT 0x0004 /* Can may be written -- Socket/Channel */ /* revents only */ #define LIBSSH2_POLLFD_POLLERR 0x0008 /* Error Condition -- Socket */ #define LIBSSH2_POLLFD_POLLHUP 0x0010 /* HangUp/EOF -- Socket */ #define LIBSSH2_POLLFD_SESSION_CLOSED 0x0010 /* Session Disconnect */ #define LIBSSH2_POLLFD_POLLNVAL 0x0020 /* Invalid request -- Socket Only */ #define LIBSSH2_POLLFD_POLLEX 0x0040 /* Exception Condition -- Socket/Win32 */ #define LIBSSH2_POLLFD_CHANNEL_CLOSED 0x0080 /* Channel Disconnect */ #define LIBSSH2_POLLFD_LISTENER_CLOSED 0x0080 /* Listener Disconnect */ #define HAVE_LIBSSH2_SESSION_BLOCK_DIRECTION /* Block Direction Types */ #define LIBSSH2_SESSION_BLOCK_INBOUND 0x0001 #define LIBSSH2_SESSION_BLOCK_OUTBOUND 0x0002 /* Hash Types */ #define LIBSSH2_HOSTKEY_HASH_MD5 1 #define LIBSSH2_HOSTKEY_HASH_SHA1 2 #define LIBSSH2_HOSTKEY_HASH_SHA256 3 /* Hostkey Types */ #define LIBSSH2_HOSTKEY_TYPE_UNKNOWN 0 #define LIBSSH2_HOSTKEY_TYPE_RSA 1 #define LIBSSH2_HOSTKEY_TYPE_DSS 2 #define LIBSSH2_HOSTKEY_TYPE_ECDSA_256 3 #define LIBSSH2_HOSTKEY_TYPE_ECDSA_384 4 #define LIBSSH2_HOSTKEY_TYPE_ECDSA_521 5 #define LIBSSH2_HOSTKEY_TYPE_ED25519 6 /* Disconnect Codes (defined by SSH protocol) */ #define SSH_DISCONNECT_HOST_NOT_ALLOWED_TO_CONNECT 1 #define SSH_DISCONNECT_PROTOCOL_ERROR 2 #define SSH_DISCONNECT_KEY_EXCHANGE_FAILED 3 #define SSH_DISCONNECT_RESERVED 4 #define SSH_DISCONNECT_MAC_ERROR 5 #define SSH_DISCONNECT_COMPRESSION_ERROR 6 #define SSH_DISCONNECT_SERVICE_NOT_AVAILABLE 7 #define SSH_DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED 8 #define SSH_DISCONNECT_HOST_KEY_NOT_VERIFIABLE 9 #define SSH_DISCONNECT_CONNECTION_LOST 10 #define SSH_DISCONNECT_BY_APPLICATION 11 #define SSH_DISCONNECT_TOO_MANY_CONNECTIONS 12 #define SSH_DISCONNECT_AUTH_CANCELLED_BY_USER 13 #define SSH_DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE 14 #define SSH_DISCONNECT_ILLEGAL_USER_NAME 15 /* Error Codes (defined by libssh2) */ #define LIBSSH2_ERROR_NONE 0 /* The library once used -1 as a generic error return value on numerous places through the code, which subsequently was converted to LIBSSH2_ERROR_SOCKET_NONE uses over time. As this is a generic error code, the goal is to never ever return this code but instead make sure that a more accurate and descriptive error code is used. */ #define LIBSSH2_ERROR_SOCKET_NONE -1 #define LIBSSH2_ERROR_BANNER_RECV -2 #define LIBSSH2_ERROR_BANNER_SEND -3 #define LIBSSH2_ERROR_INVALID_MAC -4 #define LIBSSH2_ERROR_KEX_FAILURE -5 #define LIBSSH2_ERROR_ALLOC -6 #define LIBSSH2_ERROR_SOCKET_SEND -7 #define LIBSSH2_ERROR_KEY_EXCHANGE_FAILURE -8 #define LIBSSH2_ERROR_TIMEOUT -9 #define LIBSSH2_ERROR_HOSTKEY_INIT -10 #define LIBSSH2_ERROR_HOSTKEY_SIGN -11 #define LIBSSH2_ERROR_DECRYPT -12 #define LIBSSH2_ERROR_SOCKET_DISCONNECT -13 #define LIBSSH2_ERROR_PROTO -14 #define LIBSSH2_ERROR_PASSWORD_EXPIRED -15 #define LIBSSH2_ERROR_FILE -16 #define LIBSSH2_ERROR_METHOD_NONE -17 #define LIBSSH2_ERROR_AUTHENTICATION_FAILED -18 #define LIBSSH2_ERROR_PUBLICKEY_UNRECOGNIZED \ LIBSSH2_ERROR_AUTHENTICATION_FAILED #define LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED -19 #define LIBSSH2_ERROR_CHANNEL_OUTOFORDER -20 #define LIBSSH2_ERROR_CHANNEL_FAILURE -21 #define LIBSSH2_ERROR_CHANNEL_REQUEST_DENIED -22 #define LIBSSH2_ERROR_CHANNEL_UNKNOWN -23 #define LIBSSH2_ERROR_CHANNEL_WINDOW_EXCEEDED -24 #define LIBSSH2_ERROR_CHANNEL_PACKET_EXCEEDED -25 #define LIBSSH2_ERROR_CHANNEL_CLOSED -26 #define LIBSSH2_ERROR_CHANNEL_EOF_SENT -27 #define LIBSSH2_ERROR_SCP_PROTOCOL -28 #define LIBSSH2_ERROR_ZLIB -29 #define LIBSSH2_ERROR_SOCKET_TIMEOUT -30 #define LIBSSH2_ERROR_SFTP_PROTOCOL -31 #define LIBSSH2_ERROR_REQUEST_DENIED -32 #define LIBSSH2_ERROR_METHOD_NOT_SUPPORTED -33 #define LIBSSH2_ERROR_INVAL -34 #define LIBSSH2_ERROR_INVALID_POLL_TYPE -35 #define LIBSSH2_ERROR_PUBLICKEY_PROTOCOL -36 #define LIBSSH2_ERROR_EAGAIN -37 #define LIBSSH2_ERROR_BUFFER_TOO_SMALL -38 #define LIBSSH2_ERROR_BAD_USE -39 #define LIBSSH2_ERROR_COMPRESS -40 #define LIBSSH2_ERROR_OUT_OF_BOUNDARY -41 #define LIBSSH2_ERROR_AGENT_PROTOCOL -42 #define LIBSSH2_ERROR_SOCKET_RECV -43 #define LIBSSH2_ERROR_ENCRYPT -44 #define LIBSSH2_ERROR_BAD_SOCKET -45 #define LIBSSH2_ERROR_KNOWN_HOSTS -46 #define LIBSSH2_ERROR_CHANNEL_WINDOW_FULL -47 #define LIBSSH2_ERROR_KEYFILE_AUTH_FAILED -48 /* this is a define to provide the old (<= 1.2.7) name */ #define LIBSSH2_ERROR_BANNER_NONE LIBSSH2_ERROR_BANNER_RECV /* Global API */ #define LIBSSH2_INIT_NO_CRYPTO 0x0001 /* * libssh2_init() * * Initialize the libssh2 functions. This typically initialize the * crypto library. It uses a global state, and is not thread safe -- * you must make sure this function is not called concurrently. * * Flags can be: * 0: Normal initialize * LIBSSH2_INIT_NO_CRYPTO: Do not initialize the crypto library (ie. * OPENSSL_add_cipher_algoritms() for OpenSSL * * Returns 0 if succeeded, or a negative value for error. */ LIBSSH2_API int libssh2_init(int flags); /* * libssh2_exit() * * Exit the libssh2 functions and free's all memory used internal. */ LIBSSH2_API void libssh2_exit(void); /* * libssh2_free() * * Deallocate memory allocated by earlier call to libssh2 functions. */ LIBSSH2_API void libssh2_free(LIBSSH2_SESSION *session, void *ptr); /* * libssh2_session_supported_algs() * * Fills algs with a list of supported acryptographic algorithms. Returns a * non-negative number (number of supported algorithms) on success or a * negative number (an eror code) on failure. * * NOTE: on success, algs must be deallocated (by calling libssh2_free) when * not needed anymore */ LIBSSH2_API int libssh2_session_supported_algs(LIBSSH2_SESSION* session, int method_type, const char ***algs); /* Session API */ LIBSSH2_API LIBSSH2_SESSION * libssh2_session_init_ex(LIBSSH2_ALLOC_FUNC((*my_alloc)), LIBSSH2_FREE_FUNC((*my_free)), LIBSSH2_REALLOC_FUNC((*my_realloc)), void *abstract); #define libssh2_session_init() libssh2_session_init_ex(NULL, NULL, NULL, NULL) LIBSSH2_API void **libssh2_session_abstract(LIBSSH2_SESSION *session); LIBSSH2_API void *libssh2_session_callback_set(LIBSSH2_SESSION *session, int cbtype, void *callback); LIBSSH2_API int libssh2_session_banner_set(LIBSSH2_SESSION *session, const char *banner); LIBSSH2_API int libssh2_banner_set(LIBSSH2_SESSION *session, const char *banner); LIBSSH2_API int libssh2_session_startup(LIBSSH2_SESSION *session, int sock); LIBSSH2_API int libssh2_session_handshake(LIBSSH2_SESSION *session, libssh2_socket_t sock); LIBSSH2_API int libssh2_session_disconnect_ex(LIBSSH2_SESSION *session, int reason, const char *description, const char *lang); #define libssh2_session_disconnect(session, description) \ libssh2_session_disconnect_ex((session), SSH_DISCONNECT_BY_APPLICATION, \ (description), "") LIBSSH2_API int libssh2_session_free(LIBSSH2_SESSION *session); LIBSSH2_API const char *libssh2_hostkey_hash(LIBSSH2_SESSION *session, int hash_type); LIBSSH2_API const char *libssh2_session_hostkey(LIBSSH2_SESSION *session, size_t *len, int *type); LIBSSH2_API int libssh2_session_method_pref(LIBSSH2_SESSION *session, int method_type, const char *prefs); LIBSSH2_API const char *libssh2_session_methods(LIBSSH2_SESSION *session, int method_type); LIBSSH2_API int libssh2_session_last_error(LIBSSH2_SESSION *session, char **errmsg, int *errmsg_len, int want_buf); LIBSSH2_API int libssh2_session_last_errno(LIBSSH2_SESSION *session); LIBSSH2_API int libssh2_session_set_last_error(LIBSSH2_SESSION* session, int errcode, const char *errmsg); LIBSSH2_API int libssh2_session_block_directions(LIBSSH2_SESSION *session); LIBSSH2_API int libssh2_session_flag(LIBSSH2_SESSION *session, int flag, int value); LIBSSH2_API const char *libssh2_session_banner_get(LIBSSH2_SESSION *session); /* Userauth API */ LIBSSH2_API char *libssh2_userauth_list(LIBSSH2_SESSION *session, const char *username, unsigned int username_len); LIBSSH2_API int libssh2_userauth_authenticated(LIBSSH2_SESSION *session); LIBSSH2_API int libssh2_userauth_password_ex(LIBSSH2_SESSION *session, const char *username, unsigned int username_len, const char *password, unsigned int password_len, LIBSSH2_PASSWD_CHANGEREQ_FUNC ((*passwd_change_cb))); #define libssh2_userauth_password(session, username, password) \ libssh2_userauth_password_ex((session), (username), \ (unsigned int)strlen(username), \ (password), (unsigned int)strlen(password), NULL) LIBSSH2_API int libssh2_userauth_publickey_fromfile_ex(LIBSSH2_SESSION *session, const char *username, unsigned int username_len, const char *publickey, const char *privatekey, const char *passphrase); #define libssh2_userauth_publickey_fromfile(session, username, publickey, \ privatekey, passphrase) \ libssh2_userauth_publickey_fromfile_ex((session), (username), \ (unsigned int)strlen(username), \ (publickey), \ (privatekey), (passphrase)) LIBSSH2_API int libssh2_userauth_publickey(LIBSSH2_SESSION *session, const char *username, const unsigned char *pubkeydata, size_t pubkeydata_len, LIBSSH2_USERAUTH_PUBLICKEY_SIGN_FUNC ((*sign_callback)), void **abstract); LIBSSH2_API int libssh2_userauth_hostbased_fromfile_ex(LIBSSH2_SESSION *session, const char *username, unsigned int username_len, const char *publickey, const char *privatekey, const char *passphrase, const char *hostname, unsigned int hostname_len, const char *local_username, unsigned int local_username_len); #define libssh2_userauth_hostbased_fromfile(session, username, publickey, \ privatekey, passphrase, hostname) \ libssh2_userauth_hostbased_fromfile_ex((session), (username), \ (unsigned int)strlen(username), \ (publickey), \ (privatekey), (passphrase), \ (hostname), \ (unsigned int)strlen(hostname), \ (username), \ (unsigned int)strlen(username)) LIBSSH2_API int libssh2_userauth_publickey_frommemory(LIBSSH2_SESSION *session, const char *username, size_t username_len, const char *publickeyfiledata, size_t publickeyfiledata_len, const char *privatekeyfiledata, size_t privatekeyfiledata_len, const char *passphrase); /* * response_callback is provided with filled by library prompts array, * but client must allocate and fill individual responses. Responses * array is already allocated. Responses data will be freed by libssh2 * after callback return, but before subsequent callback invokation. */ LIBSSH2_API int libssh2_userauth_keyboard_interactive_ex(LIBSSH2_SESSION* session, const char *username, unsigned int username_len, LIBSSH2_USERAUTH_KBDINT_RESPONSE_FUNC( (*response_callback))); #define libssh2_userauth_keyboard_interactive(session, username, \ response_callback) \ libssh2_userauth_keyboard_interactive_ex((session), (username), \ (unsigned int)strlen(username), \ (response_callback)) LIBSSH2_API int libssh2_poll(LIBSSH2_POLLFD *fds, unsigned int nfds, long timeout); /* Channel API */ #define LIBSSH2_CHANNEL_WINDOW_DEFAULT (2*1024*1024) #define LIBSSH2_CHANNEL_PACKET_DEFAULT 32768 #define LIBSSH2_CHANNEL_MINADJUST 1024 /* Extended Data Handling */ #define LIBSSH2_CHANNEL_EXTENDED_DATA_NORMAL 0 #define LIBSSH2_CHANNEL_EXTENDED_DATA_IGNORE 1 #define LIBSSH2_CHANNEL_EXTENDED_DATA_MERGE 2 #define SSH_EXTENDED_DATA_STDERR 1 /* Returned by any function that would block during a read/write opperation */ #define LIBSSH2CHANNEL_EAGAIN LIBSSH2_ERROR_EAGAIN LIBSSH2_API LIBSSH2_CHANNEL * libssh2_channel_open_ex(LIBSSH2_SESSION *session, const char *channel_type, unsigned int channel_type_len, unsigned int window_size, unsigned int packet_size, const char *message, unsigned int message_len); #define libssh2_channel_open_session(session) \ libssh2_channel_open_ex((session), "session", sizeof("session") - 1, \ LIBSSH2_CHANNEL_WINDOW_DEFAULT, \ LIBSSH2_CHANNEL_PACKET_DEFAULT, NULL, 0) LIBSSH2_API LIBSSH2_CHANNEL * libssh2_channel_direct_tcpip_ex(LIBSSH2_SESSION *session, const char *host, int port, const char *shost, int sport); #define libssh2_channel_direct_tcpip(session, host, port) \ libssh2_channel_direct_tcpip_ex((session), (host), (port), "127.0.0.1", 22) LIBSSH2_API LIBSSH2_LISTENER * libssh2_channel_forward_listen_ex(LIBSSH2_SESSION *session, const char *host, int port, int *bound_port, int queue_maxsize); #define libssh2_channel_forward_listen(session, port) \ libssh2_channel_forward_listen_ex((session), NULL, (port), NULL, 16) LIBSSH2_API int libssh2_channel_forward_cancel(LIBSSH2_LISTENER *listener); LIBSSH2_API LIBSSH2_CHANNEL * libssh2_channel_forward_accept(LIBSSH2_LISTENER *listener); LIBSSH2_API int libssh2_channel_setenv_ex(LIBSSH2_CHANNEL *channel, const char *varname, unsigned int varname_len, const char *value, unsigned int value_len); #define libssh2_channel_setenv(channel, varname, value) \ libssh2_channel_setenv_ex((channel), (varname), \ (unsigned int)strlen(varname), (value), \ (unsigned int)strlen(value)) LIBSSH2_API int libssh2_channel_request_pty_ex(LIBSSH2_CHANNEL *channel, const char *term, unsigned int term_len, const char *modes, unsigned int modes_len, int width, int height, int width_px, int height_px); #define libssh2_channel_request_pty(channel, term) \ libssh2_channel_request_pty_ex((channel), (term), \ (unsigned int)strlen(term), \ NULL, 0, \ LIBSSH2_TERM_WIDTH, \ LIBSSH2_TERM_HEIGHT, \ LIBSSH2_TERM_WIDTH_PX, \ LIBSSH2_TERM_HEIGHT_PX) LIBSSH2_API int libssh2_channel_request_pty_size_ex(LIBSSH2_CHANNEL *channel, int width, int height, int width_px, int height_px); #define libssh2_channel_request_pty_size(channel, width, height) \ libssh2_channel_request_pty_size_ex((channel), (width), (height), 0, 0) LIBSSH2_API int libssh2_channel_x11_req_ex(LIBSSH2_CHANNEL *channel, int single_connection, const char *auth_proto, const char *auth_cookie, int screen_number); #define libssh2_channel_x11_req(channel, screen_number) \ libssh2_channel_x11_req_ex((channel), 0, NULL, NULL, (screen_number)) LIBSSH2_API int libssh2_channel_process_startup(LIBSSH2_CHANNEL *channel, const char *request, unsigned int request_len, const char *message, unsigned int message_len); #define libssh2_channel_shell(channel) \ libssh2_channel_process_startup((channel), "shell", sizeof("shell") - 1, \ NULL, 0) #define libssh2_channel_exec(channel, command) \ libssh2_channel_process_startup((channel), "exec", sizeof("exec") - 1, \ (command), (unsigned int)strlen(command)) #define libssh2_channel_subsystem(channel, subsystem) \ libssh2_channel_process_startup((channel), "subsystem", \ sizeof("subsystem") - 1, (subsystem), \ (unsigned int)strlen(subsystem)) LIBSSH2_API ssize_t libssh2_channel_read_ex(LIBSSH2_CHANNEL *channel, int stream_id, char *buf, size_t buflen); #define libssh2_channel_read(channel, buf, buflen) \ libssh2_channel_read_ex((channel), 0, (buf), (buflen)) #define libssh2_channel_read_stderr(channel, buf, buflen) \ libssh2_channel_read_ex((channel), SSH_EXTENDED_DATA_STDERR, (buf), (buflen)) LIBSSH2_API int libssh2_poll_channel_read(LIBSSH2_CHANNEL *channel, int extended); LIBSSH2_API unsigned long libssh2_channel_window_read_ex(LIBSSH2_CHANNEL *channel, unsigned long *read_avail, unsigned long *window_size_initial); #define libssh2_channel_window_read(channel) \ libssh2_channel_window_read_ex((channel), NULL, NULL) /* libssh2_channel_receive_window_adjust is DEPRECATED, do not use! */ LIBSSH2_API unsigned long libssh2_channel_receive_window_adjust(LIBSSH2_CHANNEL *channel, unsigned long adjustment, unsigned char force); LIBSSH2_API int libssh2_channel_receive_window_adjust2(LIBSSH2_CHANNEL *channel, unsigned long adjustment, unsigned char force, unsigned int *storewindow); LIBSSH2_API ssize_t libssh2_channel_write_ex(LIBSSH2_CHANNEL *channel, int stream_id, const char *buf, size_t buflen); #define libssh2_channel_write(channel, buf, buflen) \ libssh2_channel_write_ex((channel), 0, (buf), (buflen)) #define libssh2_channel_write_stderr(channel, buf, buflen) \ libssh2_channel_write_ex((channel), SSH_EXTENDED_DATA_STDERR, \ (buf), (buflen)) LIBSSH2_API unsigned long libssh2_channel_window_write_ex(LIBSSH2_CHANNEL *channel, unsigned long *window_size_initial); #define libssh2_channel_window_write(channel) \ libssh2_channel_window_write_ex((channel), NULL) LIBSSH2_API void libssh2_session_set_blocking(LIBSSH2_SESSION* session, int blocking); LIBSSH2_API int libssh2_session_get_blocking(LIBSSH2_SESSION* session); LIBSSH2_API void libssh2_channel_set_blocking(LIBSSH2_CHANNEL *channel, int blocking); LIBSSH2_API void libssh2_session_set_timeout(LIBSSH2_SESSION* session, long timeout); LIBSSH2_API long libssh2_session_get_timeout(LIBSSH2_SESSION* session); /* libssh2_channel_handle_extended_data is DEPRECATED, do not use! */ LIBSSH2_API void libssh2_channel_handle_extended_data(LIBSSH2_CHANNEL *channel, int ignore_mode); LIBSSH2_API int libssh2_channel_handle_extended_data2(LIBSSH2_CHANNEL *channel, int ignore_mode); /* libssh2_channel_ignore_extended_data() is defined below for BC with version * 0.1 * * Future uses should use libssh2_channel_handle_extended_data() directly if * LIBSSH2_CHANNEL_EXTENDED_DATA_MERGE is passed, extended data will be read * (FIFO) from the standard data channel */ /* DEPRECATED */ #define libssh2_channel_ignore_extended_data(channel, ignore) \ libssh2_channel_handle_extended_data((channel), \ (ignore) ? \ LIBSSH2_CHANNEL_EXTENDED_DATA_IGNORE : \ LIBSSH2_CHANNEL_EXTENDED_DATA_NORMAL) #define LIBSSH2_CHANNEL_FLUSH_EXTENDED_DATA -1 #define LIBSSH2_CHANNEL_FLUSH_ALL -2 LIBSSH2_API int libssh2_channel_flush_ex(LIBSSH2_CHANNEL *channel, int streamid); #define libssh2_channel_flush(channel) libssh2_channel_flush_ex((channel), 0) #define libssh2_channel_flush_stderr(channel) \ libssh2_channel_flush_ex((channel), SSH_EXTENDED_DATA_STDERR) LIBSSH2_API int libssh2_channel_get_exit_status(LIBSSH2_CHANNEL* channel); LIBSSH2_API int libssh2_channel_get_exit_signal(LIBSSH2_CHANNEL* channel, char **exitsignal, size_t *exitsignal_len, char **errmsg, size_t *errmsg_len, char **langtag, size_t *langtag_len); LIBSSH2_API int libssh2_channel_send_eof(LIBSSH2_CHANNEL *channel); LIBSSH2_API int libssh2_channel_eof(LIBSSH2_CHANNEL *channel); LIBSSH2_API int libssh2_channel_wait_eof(LIBSSH2_CHANNEL *channel); LIBSSH2_API int libssh2_channel_close(LIBSSH2_CHANNEL *channel); LIBSSH2_API int libssh2_channel_wait_closed(LIBSSH2_CHANNEL *channel); LIBSSH2_API int libssh2_channel_free(LIBSSH2_CHANNEL *channel); /* libssh2_scp_recv is DEPRECATED, do not use! */ LIBSSH2_API LIBSSH2_CHANNEL *libssh2_scp_recv(LIBSSH2_SESSION *session, const char *path, struct stat *sb); /* Use libssh2_scp_recv2 for large (> 2GB) file support on windows */ LIBSSH2_API LIBSSH2_CHANNEL *libssh2_scp_recv2(LIBSSH2_SESSION *session, const char *path, libssh2_struct_stat *sb); LIBSSH2_API LIBSSH2_CHANNEL *libssh2_scp_send_ex(LIBSSH2_SESSION *session, const char *path, int mode, size_t size, long mtime, long atime); LIBSSH2_API LIBSSH2_CHANNEL * libssh2_scp_send64(LIBSSH2_SESSION *session, const char *path, int mode, libssh2_int64_t size, time_t mtime, time_t atime); #define libssh2_scp_send(session, path, mode, size) \ libssh2_scp_send_ex((session), (path), (mode), (size), 0, 0) LIBSSH2_API int libssh2_base64_decode(LIBSSH2_SESSION *session, char **dest, unsigned int *dest_len, const char *src, unsigned int src_len); LIBSSH2_API const char *libssh2_version(int req_version_num); #define HAVE_LIBSSH2_KNOWNHOST_API 0x010101 /* since 1.1.1 */ #define HAVE_LIBSSH2_VERSION_API 0x010100 /* libssh2_version since 1.1 */ struct libssh2_knownhost { unsigned int magic; /* magic stored by the library */ void *node; /* handle to the internal representation of this host */ char *name; /* this is NULL if no plain text host name exists */ char *key; /* key in base64/printable format */ int typemask; }; /* * libssh2_knownhost_init * * Init a collection of known hosts. Returns the pointer to a collection. * */ LIBSSH2_API LIBSSH2_KNOWNHOSTS * libssh2_knownhost_init(LIBSSH2_SESSION *session); /* * libssh2_knownhost_add * * Add a host and its associated key to the collection of known hosts. * * The 'type' argument specifies on what format the given host and keys are: * * plain - ascii "hostname.domain.tld" * sha1 - SHA1(<salt> <host>) base64-encoded! * custom - another hash * * If 'sha1' is selected as type, the salt must be provided to the salt * argument. This too base64 encoded. * * The SHA-1 hash is what OpenSSH can be told to use in known_hosts files. If * a custom type is used, salt is ignored and you must provide the host * pre-hashed when checking for it in the libssh2_knownhost_check() function. * * The keylen parameter may be omitted (zero) if the key is provided as a * NULL-terminated base64-encoded string. */ /* host format (2 bits) */ #define LIBSSH2_KNOWNHOST_TYPE_MASK 0xffff #define LIBSSH2_KNOWNHOST_TYPE_PLAIN 1 #define LIBSSH2_KNOWNHOST_TYPE_SHA1 2 /* always base64 encoded */ #define LIBSSH2_KNOWNHOST_TYPE_CUSTOM 3 /* key format (2 bits) */ #define LIBSSH2_KNOWNHOST_KEYENC_MASK (3<<16) #define LIBSSH2_KNOWNHOST_KEYENC_RAW (1<<16) #define LIBSSH2_KNOWNHOST_KEYENC_BASE64 (2<<16) /* type of key (3 bits) */ #define LIBSSH2_KNOWNHOST_KEY_MASK (15<<18) #define LIBSSH2_KNOWNHOST_KEY_SHIFT 18 #define LIBSSH2_KNOWNHOST_KEY_RSA1 (1<<18) #define LIBSSH2_KNOWNHOST_KEY_SSHRSA (2<<18) #define LIBSSH2_KNOWNHOST_KEY_SSHDSS (3<<18) #define LIBSSH2_KNOWNHOST_KEY_ECDSA_256 (4<<18) #define LIBSSH2_KNOWNHOST_KEY_ECDSA_384 (5<<18) #define LIBSSH2_KNOWNHOST_KEY_ECDSA_521 (6<<18) #define LIBSSH2_KNOWNHOST_KEY_ED25519 (7<<18) #define LIBSSH2_KNOWNHOST_KEY_UNKNOWN (15<<18) LIBSSH2_API int libssh2_knownhost_add(LIBSSH2_KNOWNHOSTS *hosts, const char *host, const char *salt, const char *key, size_t keylen, int typemask, struct libssh2_knownhost **store); /* * libssh2_knownhost_addc * * Add a host and its associated key to the collection of known hosts. * * Takes a comment argument that may be NULL. A NULL comment indicates * there is no comment and the entry will end directly after the key * when written out to a file. An empty string "" comment will indicate an * empty comment which will cause a single space to be written after the key. * * The 'type' argument specifies on what format the given host and keys are: * * plain - ascii "hostname.domain.tld" * sha1 - SHA1(<salt> <host>) base64-encoded! * custom - another hash * * If 'sha1' is selected as type, the salt must be provided to the salt * argument. This too base64 encoded. * * The SHA-1 hash is what OpenSSH can be told to use in known_hosts files. If * a custom type is used, salt is ignored and you must provide the host * pre-hashed when checking for it in the libssh2_knownhost_check() function. * * The keylen parameter may be omitted (zero) if the key is provided as a * NULL-terminated base64-encoded string. */ LIBSSH2_API int libssh2_knownhost_addc(LIBSSH2_KNOWNHOSTS *hosts, const char *host, const char *salt, const char *key, size_t keylen, const char *comment, size_t commentlen, int typemask, struct libssh2_knownhost **store); /* * libssh2_knownhost_check * * Check a host and its associated key against the collection of known hosts. * * The type is the type/format of the given host name. * * plain - ascii "hostname.domain.tld" * custom - prehashed base64 encoded. Note that this cannot use any salts. * * * 'knownhost' may be set to NULL if you don't care about that info. * * Returns: * * LIBSSH2_KNOWNHOST_CHECK_* values, see below * */ #define LIBSSH2_KNOWNHOST_CHECK_MATCH 0 #define LIBSSH2_KNOWNHOST_CHECK_MISMATCH 1 #define LIBSSH2_KNOWNHOST_CHECK_NOTFOUND 2 #define LIBSSH2_KNOWNHOST_CHECK_FAILURE 3 LIBSSH2_API int libssh2_knownhost_check(LIBSSH2_KNOWNHOSTS *hosts, const char *host, const char *key, size_t keylen, int typemask, struct libssh2_knownhost **knownhost); /* this function is identital to the above one, but also takes a port argument that allows libssh2 to do a better check */ LIBSSH2_API int libssh2_knownhost_checkp(LIBSSH2_KNOWNHOSTS *hosts, const char *host, int port, const char *key, size_t keylen, int typemask, struct libssh2_knownhost **knownhost); /* * libssh2_knownhost_del * * Remove a host from the collection of known hosts. The 'entry' struct is * retrieved by a call to libssh2_knownhost_check(). * */ LIBSSH2_API int libssh2_knownhost_del(LIBSSH2_KNOWNHOSTS *hosts, struct libssh2_knownhost *entry); /* * libssh2_knownhost_free * * Free an entire collection of known hosts. * */ LIBSSH2_API void libssh2_knownhost_free(LIBSSH2_KNOWNHOSTS *hosts); /* * libssh2_knownhost_readline() * * Pass in a line of a file of 'type'. It makes libssh2 read this line. * * LIBSSH2_KNOWNHOST_FILE_OPENSSH is the only supported type. * */ LIBSSH2_API int libssh2_knownhost_readline(LIBSSH2_KNOWNHOSTS *hosts, const char *line, size_t len, int type); /* * libssh2_knownhost_readfile * * Add hosts+key pairs from a given file. * * Returns a negative value for error or number of successfully added hosts. * * This implementation currently only knows one 'type' (openssh), all others * are reserved for future use. */ #define LIBSSH2_KNOWNHOST_FILE_OPENSSH 1 LIBSSH2_API int libssh2_knownhost_readfile(LIBSSH2_KNOWNHOSTS *hosts, const char *filename, int type); /* * libssh2_knownhost_writeline() * * Ask libssh2 to convert a known host to an output line for storage. * * Note that this function returns LIBSSH2_ERROR_BUFFER_TOO_SMALL if the given * output buffer is too small to hold the desired output. * * This implementation currently only knows one 'type' (openssh), all others * are reserved for future use. * */ LIBSSH2_API int libssh2_knownhost_writeline(LIBSSH2_KNOWNHOSTS *hosts, struct libssh2_knownhost *known, char *buffer, size_t buflen, size_t *outlen, /* the amount of written data */ int type); /* * libssh2_knownhost_writefile * * Write hosts+key pairs to a given file. * * This implementation currently only knows one 'type' (openssh), all others * are reserved for future use. */ LIBSSH2_API int libssh2_knownhost_writefile(LIBSSH2_KNOWNHOSTS *hosts, const char *filename, int type); /* * libssh2_knownhost_get() * * Traverse the internal list of known hosts. Pass NULL to 'prev' to get * the first one. Or pass a poiner to the previously returned one to get the * next. * * Returns: * 0 if a fine host was stored in 'store' * 1 if end of hosts * [negative] on errors */ LIBSSH2_API int libssh2_knownhost_get(LIBSSH2_KNOWNHOSTS *hosts, struct libssh2_knownhost **store, struct libssh2_knownhost *prev); #define HAVE_LIBSSH2_AGENT_API 0x010202 /* since 1.2.2 */ struct libssh2_agent_publickey { unsigned int magic; /* magic stored by the library */ void *node; /* handle to the internal representation of key */ unsigned char *blob; /* public key blob */ size_t blob_len; /* length of the public key blob */ char *comment; /* comment in printable format */ }; /* * libssh2_agent_init * * Init an ssh-agent handle. Returns the pointer to the handle. * */ LIBSSH2_API LIBSSH2_AGENT * libssh2_agent_init(LIBSSH2_SESSION *session); /* * libssh2_agent_connect() * * Connect to an ssh-agent. * * Returns 0 if succeeded, or a negative value for error. */ LIBSSH2_API int libssh2_agent_connect(LIBSSH2_AGENT *agent); /* * libssh2_agent_list_identities() * * Request an ssh-agent to list identities. * * Returns 0 if succeeded, or a negative value for error. */ LIBSSH2_API int libssh2_agent_list_identities(LIBSSH2_AGENT *agent); /* * libssh2_agent_get_identity() * * Traverse the internal list of public keys. Pass NULL to 'prev' to get * the first one. Or pass a poiner to the previously returned one to get the * next. * * Returns: * 0 if a fine public key was stored in 'store' * 1 if end of public keys * [negative] on errors */ LIBSSH2_API int libssh2_agent_get_identity(LIBSSH2_AGENT *agent, struct libssh2_agent_publickey **store, struct libssh2_agent_publickey *prev); /* * libssh2_agent_userauth() * * Do publickey user authentication with the help of ssh-agent. * * Returns 0 if succeeded, or a negative value for error. */ LIBSSH2_API int libssh2_agent_userauth(LIBSSH2_AGENT *agent, const char *username, struct libssh2_agent_publickey *identity); /* * libssh2_agent_disconnect() * * Close a connection to an ssh-agent. * * Returns 0 if succeeded, or a negative value for error. */ LIBSSH2_API int libssh2_agent_disconnect(LIBSSH2_AGENT *agent); /* * libssh2_agent_free() * * Free an ssh-agent handle. This function also frees the internal * collection of public keys. */ LIBSSH2_API void libssh2_agent_free(LIBSSH2_AGENT *agent); /* * libssh2_agent_set_identity_path() * * Allows a custom agent identity socket path beyond SSH_AUTH_SOCK env * */ LIBSSH2_API void libssh2_agent_set_identity_path(LIBSSH2_AGENT *agent, const char *path); /* * libssh2_agent_get_identity_path() * * Returns the custom agent identity socket path if set * */ LIBSSH2_API const char * libssh2_agent_get_identity_path(LIBSSH2_AGENT *agent); /* * libssh2_keepalive_config() * * Set how often keepalive messages should be sent. WANT_REPLY * indicates whether the keepalive messages should request a response * from the server. INTERVAL is number of seconds that can pass * without any I/O, use 0 (the default) to disable keepalives. To * avoid some busy-loop corner-cases, if you specify an interval of 1 * it will be treated as 2. * * Note that non-blocking applications are responsible for sending the * keepalive messages using libssh2_keepalive_send(). */ LIBSSH2_API void libssh2_keepalive_config(LIBSSH2_SESSION *session, int want_reply, unsigned interval); /* * libssh2_keepalive_send() * * Send a keepalive message if needed. SECONDS_TO_NEXT indicates how * many seconds you can sleep after this call before you need to call * it again. Returns 0 on success, or LIBSSH2_ERROR_SOCKET_SEND on * I/O errors. */ LIBSSH2_API int libssh2_keepalive_send(LIBSSH2_SESSION *session, int *seconds_to_next); /* NOTE NOTE NOTE libssh2_trace() has no function in builds that aren't built with debug enabled */ LIBSSH2_API int libssh2_trace(LIBSSH2_SESSION *session, int bitmask); #define LIBSSH2_TRACE_TRANS (1<<1) #define LIBSSH2_TRACE_KEX (1<<2) #define LIBSSH2_TRACE_AUTH (1<<3) #define LIBSSH2_TRACE_CONN (1<<4) #define LIBSSH2_TRACE_SCP (1<<5) #define LIBSSH2_TRACE_SFTP (1<<6) #define LIBSSH2_TRACE_ERROR (1<<7) #define LIBSSH2_TRACE_PUBLICKEY (1<<8) #define LIBSSH2_TRACE_SOCKET (1<<9) typedef void (*libssh2_trace_handler_func)(LIBSSH2_SESSION*, void *, const char *, size_t); LIBSSH2_API int libssh2_trace_sethandler(LIBSSH2_SESSION *session, void *context, libssh2_trace_handler_func callback); #ifdef __cplusplus } /* extern "C" */ #endif #endif /* !RC_INVOKED */ #endif /* LIBSSH2_H */
54,006
C++
.h
1,175
37.486809
79
0.619916
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
15,238
libssh2_publickey.h
Studio3T_robomongo/src/third-party/libssh2-1.9.0/sources/include/libssh2_publickey.h
/* Copyright (c) 2004-2006, Sara Golemon <sarag@libssh2.org> * All rights reserved. * * Redistribution and use in source and binary forms, * with or without modification, are permitted provided * that the following conditions are met: * * Redistributions of source code must retain the above * copyright notice, this list of conditions and the * following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the copyright holder nor the names * of any other contributors may be used to endorse or * promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. */ /* Note: This include file is only needed for using the * publickey SUBSYSTEM which is not the same as publickey * authentication. For authentication you only need libssh2.h * * For more information on the publickey subsystem, * refer to IETF draft: secsh-publickey */ #ifndef LIBSSH2_PUBLICKEY_H #define LIBSSH2_PUBLICKEY_H 1 #include "libssh2.h" typedef struct _LIBSSH2_PUBLICKEY LIBSSH2_PUBLICKEY; typedef struct _libssh2_publickey_attribute { const char *name; unsigned long name_len; const char *value; unsigned long value_len; char mandatory; } libssh2_publickey_attribute; typedef struct _libssh2_publickey_list { unsigned char *packet; /* For freeing */ const unsigned char *name; unsigned long name_len; const unsigned char *blob; unsigned long blob_len; unsigned long num_attrs; libssh2_publickey_attribute *attrs; /* free me */ } libssh2_publickey_list; /* Generally use the first macro here, but if both name and value are string literals, you can use _fast() to take advantage of preprocessing */ #define libssh2_publickey_attribute(name, value, mandatory) \ { (name), strlen(name), (value), strlen(value), (mandatory) }, #define libssh2_publickey_attribute_fast(name, value, mandatory) \ { (name), sizeof(name) - 1, (value), sizeof(value) - 1, (mandatory) }, #ifdef __cplusplus extern "C" { #endif /* Publickey Subsystem */ LIBSSH2_API LIBSSH2_PUBLICKEY * libssh2_publickey_init(LIBSSH2_SESSION *session); LIBSSH2_API int libssh2_publickey_add_ex(LIBSSH2_PUBLICKEY *pkey, const unsigned char *name, unsigned long name_len, const unsigned char *blob, unsigned long blob_len, char overwrite, unsigned long num_attrs, const libssh2_publickey_attribute attrs[]); #define libssh2_publickey_add(pkey, name, blob, blob_len, overwrite, \ num_attrs, attrs) \ libssh2_publickey_add_ex((pkey), (name), strlen(name), (blob), (blob_len), \ (overwrite), (num_attrs), (attrs)) LIBSSH2_API int libssh2_publickey_remove_ex(LIBSSH2_PUBLICKEY *pkey, const unsigned char *name, unsigned long name_len, const unsigned char *blob, unsigned long blob_len); #define libssh2_publickey_remove(pkey, name, blob, blob_len) \ libssh2_publickey_remove_ex((pkey), (name), strlen(name), (blob), (blob_len)) LIBSSH2_API int libssh2_publickey_list_fetch(LIBSSH2_PUBLICKEY *pkey, unsigned long *num_keys, libssh2_publickey_list **pkey_list); LIBSSH2_API void libssh2_publickey_list_free(LIBSSH2_PUBLICKEY *pkey, libssh2_publickey_list *pkey_list); LIBSSH2_API int libssh2_publickey_shutdown(LIBSSH2_PUBLICKEY *pkey); #ifdef __cplusplus } /* extern "C" */ #endif #endif /* ifndef: LIBSSH2_PUBLICKEY_H */
4,804
C++
.h
106
38.801887
79
0.681119
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
15,239
libssh2_sftp.h
Studio3T_robomongo/src/third-party/libssh2-1.9.0/sources/include/libssh2_sftp.h
/* Copyright (c) 2004-2008, Sara Golemon <sarag@libssh2.org> * All rights reserved. * * Redistribution and use in source and binary forms, * with or without modification, are permitted provided * that the following conditions are met: * * Redistributions of source code must retain the above * copyright notice, this list of conditions and the * following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the copyright holder nor the names * of any other contributors may be used to endorse or * promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. */ #ifndef LIBSSH2_SFTP_H #define LIBSSH2_SFTP_H 1 #include "libssh2.h" #ifndef WIN32 #include <unistd.h> #endif #ifdef __cplusplus extern "C" { #endif /* Note: Version 6 was documented at the time of writing * However it was marked as "DO NOT IMPLEMENT" due to pending changes * * Let's start with Version 3 (The version found in OpenSSH) and go from there */ #define LIBSSH2_SFTP_VERSION 3 typedef struct _LIBSSH2_SFTP LIBSSH2_SFTP; typedef struct _LIBSSH2_SFTP_HANDLE LIBSSH2_SFTP_HANDLE; typedef struct _LIBSSH2_SFTP_ATTRIBUTES LIBSSH2_SFTP_ATTRIBUTES; typedef struct _LIBSSH2_SFTP_STATVFS LIBSSH2_SFTP_STATVFS; /* Flags for open_ex() */ #define LIBSSH2_SFTP_OPENFILE 0 #define LIBSSH2_SFTP_OPENDIR 1 /* Flags for rename_ex() */ #define LIBSSH2_SFTP_RENAME_OVERWRITE 0x00000001 #define LIBSSH2_SFTP_RENAME_ATOMIC 0x00000002 #define LIBSSH2_SFTP_RENAME_NATIVE 0x00000004 /* Flags for stat_ex() */ #define LIBSSH2_SFTP_STAT 0 #define LIBSSH2_SFTP_LSTAT 1 #define LIBSSH2_SFTP_SETSTAT 2 /* Flags for symlink_ex() */ #define LIBSSH2_SFTP_SYMLINK 0 #define LIBSSH2_SFTP_READLINK 1 #define LIBSSH2_SFTP_REALPATH 2 /* Flags for sftp_mkdir() */ #define LIBSSH2_SFTP_DEFAULT_MODE -1 /* SFTP attribute flag bits */ #define LIBSSH2_SFTP_ATTR_SIZE 0x00000001 #define LIBSSH2_SFTP_ATTR_UIDGID 0x00000002 #define LIBSSH2_SFTP_ATTR_PERMISSIONS 0x00000004 #define LIBSSH2_SFTP_ATTR_ACMODTIME 0x00000008 #define LIBSSH2_SFTP_ATTR_EXTENDED 0x80000000 /* SFTP statvfs flag bits */ #define LIBSSH2_SFTP_ST_RDONLY 0x00000001 #define LIBSSH2_SFTP_ST_NOSUID 0x00000002 struct _LIBSSH2_SFTP_ATTRIBUTES { /* If flags & ATTR_* bit is set, then the value in this struct will be * meaningful Otherwise it should be ignored */ unsigned long flags; libssh2_uint64_t filesize; unsigned long uid, gid; unsigned long permissions; unsigned long atime, mtime; }; struct _LIBSSH2_SFTP_STATVFS { libssh2_uint64_t f_bsize; /* file system block size */ libssh2_uint64_t f_frsize; /* fragment size */ libssh2_uint64_t f_blocks; /* size of fs in f_frsize units */ libssh2_uint64_t f_bfree; /* # free blocks */ libssh2_uint64_t f_bavail; /* # free blocks for non-root */ libssh2_uint64_t f_files; /* # inodes */ libssh2_uint64_t f_ffree; /* # free inodes */ libssh2_uint64_t f_favail; /* # free inodes for non-root */ libssh2_uint64_t f_fsid; /* file system ID */ libssh2_uint64_t f_flag; /* mount flags */ libssh2_uint64_t f_namemax; /* maximum filename length */ }; /* SFTP filetypes */ #define LIBSSH2_SFTP_TYPE_REGULAR 1 #define LIBSSH2_SFTP_TYPE_DIRECTORY 2 #define LIBSSH2_SFTP_TYPE_SYMLINK 3 #define LIBSSH2_SFTP_TYPE_SPECIAL 4 #define LIBSSH2_SFTP_TYPE_UNKNOWN 5 #define LIBSSH2_SFTP_TYPE_SOCKET 6 #define LIBSSH2_SFTP_TYPE_CHAR_DEVICE 7 #define LIBSSH2_SFTP_TYPE_BLOCK_DEVICE 8 #define LIBSSH2_SFTP_TYPE_FIFO 9 /* * Reproduce the POSIX file modes here for systems that are not POSIX * compliant. * * These is used in "permissions" of "struct _LIBSSH2_SFTP_ATTRIBUTES" */ /* File type */ #define LIBSSH2_SFTP_S_IFMT 0170000 /* type of file mask */ #define LIBSSH2_SFTP_S_IFIFO 0010000 /* named pipe (fifo) */ #define LIBSSH2_SFTP_S_IFCHR 0020000 /* character special */ #define LIBSSH2_SFTP_S_IFDIR 0040000 /* directory */ #define LIBSSH2_SFTP_S_IFBLK 0060000 /* block special */ #define LIBSSH2_SFTP_S_IFREG 0100000 /* regular */ #define LIBSSH2_SFTP_S_IFLNK 0120000 /* symbolic link */ #define LIBSSH2_SFTP_S_IFSOCK 0140000 /* socket */ /* File mode */ /* Read, write, execute/search by owner */ #define LIBSSH2_SFTP_S_IRWXU 0000700 /* RWX mask for owner */ #define LIBSSH2_SFTP_S_IRUSR 0000400 /* R for owner */ #define LIBSSH2_SFTP_S_IWUSR 0000200 /* W for owner */ #define LIBSSH2_SFTP_S_IXUSR 0000100 /* X for owner */ /* Read, write, execute/search by group */ #define LIBSSH2_SFTP_S_IRWXG 0000070 /* RWX mask for group */ #define LIBSSH2_SFTP_S_IRGRP 0000040 /* R for group */ #define LIBSSH2_SFTP_S_IWGRP 0000020 /* W for group */ #define LIBSSH2_SFTP_S_IXGRP 0000010 /* X for group */ /* Read, write, execute/search by others */ #define LIBSSH2_SFTP_S_IRWXO 0000007 /* RWX mask for other */ #define LIBSSH2_SFTP_S_IROTH 0000004 /* R for other */ #define LIBSSH2_SFTP_S_IWOTH 0000002 /* W for other */ #define LIBSSH2_SFTP_S_IXOTH 0000001 /* X for other */ /* macros to check for specific file types, added in 1.2.5 */ #define LIBSSH2_SFTP_S_ISLNK(m) \ (((m) & LIBSSH2_SFTP_S_IFMT) == LIBSSH2_SFTP_S_IFLNK) #define LIBSSH2_SFTP_S_ISREG(m) \ (((m) & LIBSSH2_SFTP_S_IFMT) == LIBSSH2_SFTP_S_IFREG) #define LIBSSH2_SFTP_S_ISDIR(m) \ (((m) & LIBSSH2_SFTP_S_IFMT) == LIBSSH2_SFTP_S_IFDIR) #define LIBSSH2_SFTP_S_ISCHR(m) \ (((m) & LIBSSH2_SFTP_S_IFMT) == LIBSSH2_SFTP_S_IFCHR) #define LIBSSH2_SFTP_S_ISBLK(m) \ (((m) & LIBSSH2_SFTP_S_IFMT) == LIBSSH2_SFTP_S_IFBLK) #define LIBSSH2_SFTP_S_ISFIFO(m) \ (((m) & LIBSSH2_SFTP_S_IFMT) == LIBSSH2_SFTP_S_IFIFO) #define LIBSSH2_SFTP_S_ISSOCK(m) \ (((m) & LIBSSH2_SFTP_S_IFMT) == LIBSSH2_SFTP_S_IFSOCK) /* SFTP File Transfer Flags -- (e.g. flags parameter to sftp_open()) * Danger will robinson... APPEND doesn't have any effect on OpenSSH servers */ #define LIBSSH2_FXF_READ 0x00000001 #define LIBSSH2_FXF_WRITE 0x00000002 #define LIBSSH2_FXF_APPEND 0x00000004 #define LIBSSH2_FXF_CREAT 0x00000008 #define LIBSSH2_FXF_TRUNC 0x00000010 #define LIBSSH2_FXF_EXCL 0x00000020 /* SFTP Status Codes (returned by libssh2_sftp_last_error() ) */ #define LIBSSH2_FX_OK 0 #define LIBSSH2_FX_EOF 1 #define LIBSSH2_FX_NO_SUCH_FILE 2 #define LIBSSH2_FX_PERMISSION_DENIED 3 #define LIBSSH2_FX_FAILURE 4 #define LIBSSH2_FX_BAD_MESSAGE 5 #define LIBSSH2_FX_NO_CONNECTION 6 #define LIBSSH2_FX_CONNECTION_LOST 7 #define LIBSSH2_FX_OP_UNSUPPORTED 8 #define LIBSSH2_FX_INVALID_HANDLE 9 #define LIBSSH2_FX_NO_SUCH_PATH 10 #define LIBSSH2_FX_FILE_ALREADY_EXISTS 11 #define LIBSSH2_FX_WRITE_PROTECT 12 #define LIBSSH2_FX_NO_MEDIA 13 #define LIBSSH2_FX_NO_SPACE_ON_FILESYSTEM 14 #define LIBSSH2_FX_QUOTA_EXCEEDED 15 #define LIBSSH2_FX_UNKNOWN_PRINCIPLE 16 /* Initial mis-spelling */ #define LIBSSH2_FX_UNKNOWN_PRINCIPAL 16 #define LIBSSH2_FX_LOCK_CONFlICT 17 /* Initial mis-spelling */ #define LIBSSH2_FX_LOCK_CONFLICT 17 #define LIBSSH2_FX_DIR_NOT_EMPTY 18 #define LIBSSH2_FX_NOT_A_DIRECTORY 19 #define LIBSSH2_FX_INVALID_FILENAME 20 #define LIBSSH2_FX_LINK_LOOP 21 /* Returned by any function that would block during a read/write opperation */ #define LIBSSH2SFTP_EAGAIN LIBSSH2_ERROR_EAGAIN /* SFTP API */ LIBSSH2_API LIBSSH2_SFTP *libssh2_sftp_init(LIBSSH2_SESSION *session); LIBSSH2_API int libssh2_sftp_shutdown(LIBSSH2_SFTP *sftp); LIBSSH2_API unsigned long libssh2_sftp_last_error(LIBSSH2_SFTP *sftp); LIBSSH2_API LIBSSH2_CHANNEL *libssh2_sftp_get_channel(LIBSSH2_SFTP *sftp); /* File / Directory Ops */ LIBSSH2_API LIBSSH2_SFTP_HANDLE * libssh2_sftp_open_ex(LIBSSH2_SFTP *sftp, const char *filename, unsigned int filename_len, unsigned long flags, long mode, int open_type); #define libssh2_sftp_open(sftp, filename, flags, mode) \ libssh2_sftp_open_ex((sftp), (filename), strlen(filename), (flags), \ (mode), LIBSSH2_SFTP_OPENFILE) #define libssh2_sftp_opendir(sftp, path) \ libssh2_sftp_open_ex((sftp), (path), strlen(path), 0, 0, \ LIBSSH2_SFTP_OPENDIR) LIBSSH2_API ssize_t libssh2_sftp_read(LIBSSH2_SFTP_HANDLE *handle, char *buffer, size_t buffer_maxlen); LIBSSH2_API int libssh2_sftp_readdir_ex(LIBSSH2_SFTP_HANDLE *handle, \ char *buffer, size_t buffer_maxlen, char *longentry, size_t longentry_maxlen, LIBSSH2_SFTP_ATTRIBUTES *attrs); #define libssh2_sftp_readdir(handle, buffer, buffer_maxlen, attrs) \ libssh2_sftp_readdir_ex((handle), (buffer), (buffer_maxlen), NULL, 0, \ (attrs)) LIBSSH2_API ssize_t libssh2_sftp_write(LIBSSH2_SFTP_HANDLE *handle, const char *buffer, size_t count); LIBSSH2_API int libssh2_sftp_fsync(LIBSSH2_SFTP_HANDLE *handle); LIBSSH2_API int libssh2_sftp_close_handle(LIBSSH2_SFTP_HANDLE *handle); #define libssh2_sftp_close(handle) libssh2_sftp_close_handle(handle) #define libssh2_sftp_closedir(handle) libssh2_sftp_close_handle(handle) LIBSSH2_API void libssh2_sftp_seek(LIBSSH2_SFTP_HANDLE *handle, size_t offset); LIBSSH2_API void libssh2_sftp_seek64(LIBSSH2_SFTP_HANDLE *handle, libssh2_uint64_t offset); #define libssh2_sftp_rewind(handle) libssh2_sftp_seek64((handle), 0) LIBSSH2_API size_t libssh2_sftp_tell(LIBSSH2_SFTP_HANDLE *handle); LIBSSH2_API libssh2_uint64_t libssh2_sftp_tell64(LIBSSH2_SFTP_HANDLE *handle); LIBSSH2_API int libssh2_sftp_fstat_ex(LIBSSH2_SFTP_HANDLE *handle, LIBSSH2_SFTP_ATTRIBUTES *attrs, int setstat); #define libssh2_sftp_fstat(handle, attrs) \ libssh2_sftp_fstat_ex((handle), (attrs), 0) #define libssh2_sftp_fsetstat(handle, attrs) \ libssh2_sftp_fstat_ex((handle), (attrs), 1) /* Miscellaneous Ops */ LIBSSH2_API int libssh2_sftp_rename_ex(LIBSSH2_SFTP *sftp, const char *source_filename, unsigned int srouce_filename_len, const char *dest_filename, unsigned int dest_filename_len, long flags); #define libssh2_sftp_rename(sftp, sourcefile, destfile) \ libssh2_sftp_rename_ex((sftp), (sourcefile), strlen(sourcefile), \ (destfile), strlen(destfile), \ LIBSSH2_SFTP_RENAME_OVERWRITE | \ LIBSSH2_SFTP_RENAME_ATOMIC | \ LIBSSH2_SFTP_RENAME_NATIVE) LIBSSH2_API int libssh2_sftp_unlink_ex(LIBSSH2_SFTP *sftp, const char *filename, unsigned int filename_len); #define libssh2_sftp_unlink(sftp, filename) \ libssh2_sftp_unlink_ex((sftp), (filename), strlen(filename)) LIBSSH2_API int libssh2_sftp_fstatvfs(LIBSSH2_SFTP_HANDLE *handle, LIBSSH2_SFTP_STATVFS *st); LIBSSH2_API int libssh2_sftp_statvfs(LIBSSH2_SFTP *sftp, const char *path, size_t path_len, LIBSSH2_SFTP_STATVFS *st); LIBSSH2_API int libssh2_sftp_mkdir_ex(LIBSSH2_SFTP *sftp, const char *path, unsigned int path_len, long mode); #define libssh2_sftp_mkdir(sftp, path, mode) \ libssh2_sftp_mkdir_ex((sftp), (path), strlen(path), (mode)) LIBSSH2_API int libssh2_sftp_rmdir_ex(LIBSSH2_SFTP *sftp, const char *path, unsigned int path_len); #define libssh2_sftp_rmdir(sftp, path) \ libssh2_sftp_rmdir_ex((sftp), (path), strlen(path)) LIBSSH2_API int libssh2_sftp_stat_ex(LIBSSH2_SFTP *sftp, const char *path, unsigned int path_len, int stat_type, LIBSSH2_SFTP_ATTRIBUTES *attrs); #define libssh2_sftp_stat(sftp, path, attrs) \ libssh2_sftp_stat_ex((sftp), (path), strlen(path), LIBSSH2_SFTP_STAT, \ (attrs)) #define libssh2_sftp_lstat(sftp, path, attrs) \ libssh2_sftp_stat_ex((sftp), (path), strlen(path), LIBSSH2_SFTP_LSTAT, \ (attrs)) #define libssh2_sftp_setstat(sftp, path, attrs) \ libssh2_sftp_stat_ex((sftp), (path), strlen(path), LIBSSH2_SFTP_SETSTAT, \ (attrs)) LIBSSH2_API int libssh2_sftp_symlink_ex(LIBSSH2_SFTP *sftp, const char *path, unsigned int path_len, char *target, unsigned int target_len, int link_type); #define libssh2_sftp_symlink(sftp, orig, linkpath) \ libssh2_sftp_symlink_ex((sftp), (orig), strlen(orig), (linkpath), \ strlen(linkpath), LIBSSH2_SFTP_SYMLINK) #define libssh2_sftp_readlink(sftp, path, target, maxlen) \ libssh2_sftp_symlink_ex((sftp), (path), strlen(path), (target), (maxlen), \ LIBSSH2_SFTP_READLINK) #define libssh2_sftp_realpath(sftp, path, target, maxlen) \ libssh2_sftp_symlink_ex((sftp), (path), strlen(path), (target), (maxlen), \ LIBSSH2_SFTP_REALPATH) #ifdef __cplusplus } /* extern "C" */ #endif #endif /* LIBSSH2_SFTP_H */
15,714
C++
.h
309
43.653722
79
0.625269
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
15,240
macros.h
Studio3T_robomongo/src/third-party/libssh2-1.9.0/sources/os400/macros.h
/* * Copyright (C) 2015 Patrick Monnerat, D+H <patrick.monnerat@dh.com> * All rights reserved. * * Redistribution and use in source and binary forms, * with or without modification, are permitted provided * that the following conditions are met: * * Redistributions of source code must retain the above * copyright notice, this list of conditions and the * following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the copyright holder nor the names * of any other contributors may be used to endorse or * promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. */ #ifndef LIBSSH2_MACROS_H_ #define LIBSSH2_MACROS_H_ #include "libssh2.h" #include "libssh2_publickey.h" #include "libssh2_sftp.h" /* * Dummy prototypes to generate wrapper procedures to C macros. * This is a helper for languages without a clever preprocessor (ILE/RPG). */ LIBSSH2_API LIBSSH2_SESSION * libssh2_session_init(void); LIBSSH2_API int libssh2_session_disconnect(LIBSSH2_SESSION *session, const char *description); LIBSSH2_API int libssh2_userauth_password(LIBSSH2_SESSION *session, const char *username, const char *password); LIBSSH2_API int libssh2_userauth_publickey_fromfile(LIBSSH2_SESSION *session, const char *username, const char *publickey, const char *privatekey, const char *passphrase); LIBSSH2_API int libssh2_userauth_hostbased_fromfile(LIBSSH2_SESSION *session, const char *username, const char *publickey, const char *privatekey, const char *passphrase, const char *hostname); LIBSSH2_API int libssh2_userauth_keyboard_interactive(LIBSSH2_SESSION* session, const char *username, LIBSSH2_USERAUTH_KBDINT_RESPONSE_FUNC( (*response_callback))); LIBSSH2_API LIBSSH2_CHANNEL * libssh2_channel_open_session(LIBSSH2_SESSION *session); LIBSSH2_API LIBSSH2_CHANNEL * libssh2_channel_direct_tcpip(LIBSSH2_SESSION *session, const char *host, int port); LIBSSH2_API LIBSSH2_LISTENER * libssh2_channel_forward_listen(LIBSSH2_SESSION *session, int port); LIBSSH2_API int libssh2_channel_setenv(LIBSSH2_CHANNEL *channel, const char *varname, const char *value); LIBSSH2_API int libssh2_channel_request_pty(LIBSSH2_CHANNEL *channel, const char *term); LIBSSH2_API int libssh2_channel_request_pty_size(LIBSSH2_CHANNEL *channel, int width, int height); LIBSSH2_API int libssh2_channel_x11_req(LIBSSH2_CHANNEL *channel, int screen_number); LIBSSH2_API int libssh2_channel_shell(LIBSSH2_CHANNEL *channel); LIBSSH2_API int libssh2_channel_exec(LIBSSH2_CHANNEL *channel, const char *command); LIBSSH2_API int libssh2_channel_subsystem(LIBSSH2_CHANNEL *channel, const char *subsystem); LIBSSH2_API ssize_t libssh2_channel_read(LIBSSH2_CHANNEL *channel, char *buf, size_t buflen); LIBSSH2_API ssize_t libssh2_channel_read_stderr(LIBSSH2_CHANNEL *channel, char *buf, size_t buflen); LIBSSH2_API unsigned long libssh2_channel_window_read(LIBSSH2_CHANNEL *channel); LIBSSH2_API ssize_t libssh2_channel_write(LIBSSH2_CHANNEL *channel, const char *buf, size_t buflen); LIBSSH2_API ssize_t libssh2_channel_write_stderr(LIBSSH2_CHANNEL *channel, const char *buf, size_t buflen); LIBSSH2_API unsigned long libssh2_channel_window_write(LIBSSH2_CHANNEL *channel); LIBSSH2_API int libssh2_channel_flush(LIBSSH2_CHANNEL *channel); LIBSSH2_API int libssh2_channel_flush_stderr(LIBSSH2_CHANNEL *channel); LIBSSH2_API LIBSSH2_CHANNEL * libssh2_scp_send(LIBSSH2_SESSION *session, const char *path, int mode, libssh2_int64_t size); LIBSSH2_API int libssh2_publickey_add(LIBSSH2_PUBLICKEY *pkey, const unsigned char *name, const unsigned char *blob, unsigned long blob_len, char overwrite, unsigned long num_attrs, const libssh2_publickey_attribute attrs[]); LIBSSH2_API int libssh2_publickey_remove(LIBSSH2_PUBLICKEY *pkey, const unsigned char *name, const unsigned char *blob, unsigned long blob_len); LIBSSH2_API int LIBSSH2_SFTP_S_ISLNK(unsigned long permissions); LIBSSH2_API int LIBSSH2_SFTP_S_ISREG(unsigned long permissions); LIBSSH2_API int LIBSSH2_SFTP_S_ISDIR(unsigned long permissions); LIBSSH2_API int LIBSSH2_SFTP_S_ISCHR(unsigned long permissions); LIBSSH2_API int LIBSSH2_SFTP_S_ISBLK(unsigned long permissions); LIBSSH2_API int LIBSSH2_SFTP_S_ISFIFO(unsigned long permissions); LIBSSH2_API int LIBSSH2_SFTP_S_ISSOCK(unsigned long permissions); LIBSSH2_API LIBSSH2_SFTP_HANDLE * libssh2_sftp_open(LIBSSH2_SFTP *sftp, const char *filename, unsigned long flags, long mode); LIBSSH2_API LIBSSH2_SFTP_HANDLE * libssh2_sftp_opendir(LIBSSH2_SFTP *sftp, const char *path); LIBSSH2_API int libssh2_sftp_readdir(LIBSSH2_SFTP_HANDLE *handle, char *buffer, size_t buffer_maxlen, LIBSSH2_SFTP_ATTRIBUTES *attrs); LIBSSH2_API int libssh2_sftp_close(LIBSSH2_SFTP_HANDLE *handle); LIBSSH2_API int libssh2_sftp_closedir(LIBSSH2_SFTP_HANDLE *handle); LIBSSH2_API void libssh2_sftp_rewind(LIBSSH2_SFTP_HANDLE *handle); LIBSSH2_API int libssh2_sftp_fstat(LIBSSH2_SFTP_HANDLE *handle, LIBSSH2_SFTP_ATTRIBUTES *attrs); LIBSSH2_API int libssh2_sftp_fsetstat(LIBSSH2_SFTP_HANDLE *handle, LIBSSH2_SFTP_ATTRIBUTES *attrs); LIBSSH2_API int libssh2_sftp_rename(LIBSSH2_SFTP *sftp, const char *source_filename, const char *dest_filename); LIBSSH2_API int libssh2_sftp_unlink(LIBSSH2_SFTP *sftp, const char *filename); LIBSSH2_API int libssh2_sftp_mkdir(LIBSSH2_SFTP *sftp, const char *path, long mode); LIBSSH2_API int libssh2_sftp_rmdir(LIBSSH2_SFTP *sftp, const char *path); LIBSSH2_API int libssh2_sftp_stat(LIBSSH2_SFTP *sftp, const char *path, LIBSSH2_SFTP_ATTRIBUTES *attrs); LIBSSH2_API int libssh2_sftp_lstat(LIBSSH2_SFTP *sftp, const char *path, LIBSSH2_SFTP_ATTRIBUTES *attrs); LIBSSH2_API int libssh2_sftp_setstat(LIBSSH2_SFTP *sftp, const char *path, LIBSSH2_SFTP_ATTRIBUTES *attrs); LIBSSH2_API int libssh2_sftp_symlink(LIBSSH2_SFTP *sftp, const char *orig, char *linkpath); LIBSSH2_API int libssh2_sftp_readlink(LIBSSH2_SFTP *sftp, const char *path, char *target, unsigned int maxlen); LIBSSH2_API int libssh2_sftp_realpath(LIBSSH2_SFTP *sftp, const char *path, char *target, unsigned int maxlen); #endif
8,312
C++
.h
161
42.47205
80
0.678905
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,241
libssh2_config.h
Studio3T_robomongo/src/third-party/libssh2-1.9.0/sources/os400/libssh2_config.h
/* * Copyright (C) 2015 Patrick Monnerat, D+H <patrick.monnerat@dh.com> * All rights reserved. * * Redistribution and use in source and binary forms, * with or without modification, are permitted provided * that the following conditions are met: * * Redistributions of source code must retain the above * copyright notice, this list of conditions and the * following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the copyright holder nor the names * of any other contributors may be used to endorse or * promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. */ #ifndef LIBSSH2_CONFIG_H #define LIBSSH2_CONFIG_H /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP systems. This function is required for `alloca.c' support on those systems. */ #undef CRAY_STACKSEG_END /* Define to 1 if using `alloca.c'. */ #undef C_ALLOCA /* Define to 1 if you have `alloca', as a function or macro. */ #define HAVE_ALLOCA 1 /* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix). */ #define HAVE_ALLOCA_H 1 /* Define to 1 if you have the <arpa/inet.h> header file. */ #define HAVE_ARPA_INET_H 1 /* Define to 1 if you have the declaration of `SecureZeroMemory', and to 0 if you don't. */ #undef HAVE_DECL_SECUREZEROMEMORY /* disabled non-blocking sockets */ #undef HAVE_DISABLED_NONBLOCKING /* Define to 1 if you have the <dlfcn.h> header file. */ #undef HAVE_DLFCN_H /* Define to 1 if you have the <errno.h> header file. */ #define HAVE_ERRNO_H 1 /* Define to 1 if you have the `EVP_aes_128_ctr' function. */ #undef HAVE_EVP_AES_128_CTR /* Define to 1 if you have the <fcntl.h> header file. */ #define HAVE_FCNTL_H 1 /* use FIONBIO for non-blocking sockets */ #undef HAVE_FIONBIO /* Define to 1 if you have the `gettimeofday' function. */ #define HAVE_GETTIMEOFDAY 1 /* Define to 1 if you have the <inttypes.h> header file. */ #define HAVE_INTTYPES_H 1 /* use ioctlsocket() for non-blocking sockets */ #undef HAVE_IOCTLSOCKET /* use Ioctlsocket() for non-blocking sockets */ #undef HAVE_IOCTLSOCKET_CASE /* Define if you have the bcrypt library. */ #undef HAVE_LIBBCRYPT /* Define if you have the crypt32 library. */ #undef HAVE_LIBCRYPT32 /* Define if you have the gcrypt library. */ #undef HAVE_LIBGCRYPT /* Define if you have the ssl library. */ #undef HAVE_LIBSSL /* Define if you have the z library. */ /* #undef HAVE_LIBZ */ /* Define to 1 if the compiler supports the 'long long' data type. */ #define HAVE_LONGLONG 1 /* Define to 1 if you have the <memory.h> header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the <netinet/in.h> header file. */ #define HAVE_NETINET_IN_H 1 /* Define to 1 if you have the <ntdef.h> header file. */ #undef HAVE_NTDEF_H /* Define to 1 if you have the <ntstatus.h> header file. */ #undef HAVE_NTSTATUS_H /* use O_NONBLOCK for non-blocking sockets */ #define HAVE_O_NONBLOCK 1 /* Define to 1 if you have the `poll' function. */ #undef HAVE_POLL /* Define to 1 if you have the select function. */ #define HAVE_SELECT 1 /* use SO_NONBLOCK for non-blocking sockets */ #undef HAVE_SO_NONBLOCK /* Define to 1 if you have the <stdint.h> header file. */ #define HAVE_STDINT_H 1 /* Define to 1 if you have the <stdio.h> header file. */ #define HAVE_STDIO_H 1 /* Define to 1 if you have the <stdlib.h> header file. */ #define HAVE_STDLIB_H 1 /* Define to 1 if you have the <strings.h> header file. */ #define HAVE_STRINGS_H 1 /* Define to 1 if you have the <string.h> header file. */ #define HAVE_STRING_H 1 /* Define to 1 if you have the `strtoll' function. */ #define HAVE_STRTOLL 1 /* Define to 1 if you have the <sys/ioctl.h> header file. */ #define HAVE_SYS_IOCTL_H 1 /* Define to 1 if you have the <sys/select.h> header file. */ #undef HAVE_SYS_SELECT_H /* Define to 1 if you have the <sys/socket.h> header file. */ #define HAVE_SYS_SOCKET_H 1 /* Define to 1 if you have the <sys/stat.h> header file. */ #define HAVE_SYS_STAT_H 1 /* Define to 1 if you have the <sys/time.h> header file. */ #define HAVE_SYS_TIME_H 1 /* Define to 1 if you have the <sys/types.h> header file. */ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the <sys/uio.h> header file. */ #define HAVE_SYS_UIO_H 1 /* Define to 1 if you have the <sys/un.h> header file. */ #define HAVE_SYS_UN_H 1 /* Define to 1 if you have the <unistd.h> header file. */ #define HAVE_UNISTD_H 1 /* Define to 1 if you have the <windows.h> header file. */ #undef HAVE_WINDOWS_H /* Define to 1 if you have the <winsock2.h> header file. */ #undef HAVE_WINSOCK2_H /* Define to 1 if you have the <ws2tcpip.h> header file. */ #undef HAVE_WS2TCPIP_H /* to make a symbol visible */ #undef LIBSSH2_API /* Enable clearing of memory before being freed */ #define LIBSSH2_CLEAR_MEMORY 1 /* Enable "none" cipher -- NOT RECOMMENDED */ #undef LIBSSH2_CRYPT_NONE /* Enable newer diffie-hellman-group-exchange-sha1 syntax */ #define LIBSSH2_DH_GEX_NEW 1 /* Compile in zlib support */ /* #undef LIBSSH2_HAVE_ZLIB */ /* Use libgcrypt */ #undef LIBSSH2_LIBGCRYPT /* Enable "none" MAC -- NOT RECOMMENDED */ #undef LIBSSH2_MAC_NONE /* Use OpenSSL */ #undef LIBSSH2_OPENSSL /* Use Windows CNG */ #undef LIBSSH2_WINCNG /* Use OS/400 Qc3 */ #define LIBSSH2_OS400QC3 /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #define LT_OBJDIR ".libs/" /* Define to 1 if _REENTRANT preprocessor symbol must be defined. */ #undef NEED_REENTRANT /* Name of package */ #define PACKAGE "libssh2" /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "libssh2-devel@cool.haxx.se" /* Define to the full name of this package. */ #define PACKAGE_NAME "libssh2" /* Define to the full name and version of this package. */ #define PACKAGE_STRING "libssh2 -" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "libssh2" /* Define to the home page for this package. */ #define PACKAGE_URL "" /* Define to the version of this package. */ #define PACKAGE_VERSION "-" /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at runtime. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ #undef STACK_DIRECTION /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Version number of package */ #define VERSION "-" /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #define WORDS_BIGENDIAN 1 /* Enable large inode numbers on Mac OS X 10.5. */ #ifndef _DARWIN_USE_64_BIT_INODE # define _DARWIN_USE_64_BIT_INODE 1 #endif /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS /* Define for large files, on AIX-style hosts. */ #undef _LARGE_FILES /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #define inline #endif /* Define to `unsigned int' if <sys/types.h> does not define. */ #undef size_t #ifndef LIBSSH2_DISABLE_QADRT_EXT /* Remap zlib procedures to ASCII versions. */ #pragma map(inflateInit_, "_libssh2_os400_inflateInit_") #pragma map(deflateInit_, "_libssh2_os400_deflateInit_") #endif #endif /* vim: set expandtab ts=4 sw=4: */
8,759
C++
.h
217
38.723502
79
0.73747
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
15,242
libssh2_ccsid.h
Studio3T_robomongo/src/third-party/libssh2-1.9.0/sources/os400/libssh2_ccsid.h
/* * Copyright (C) 2015 Patrick Monnerat, D+H <patrick.monnerat@dh.com> * All rights reserved. * * Redistribution and use in source and binary forms, * with or without modification, are permitted provided * that the following conditions are met: * * Redistributions of source code must retain the above * copyright notice, this list of conditions and the * following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the copyright holder nor the names * of any other contributors may be used to endorse or * promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. */ /* CCSID conversion support. */ #ifndef LIBSSH2_CCSID_H_ #define LIBSSH2_CCSID_H_ #include "libssh2.h" typedef struct _libssh2_string_cache libssh2_string_cache; LIBSSH2_API char * libssh2_from_ccsid(LIBSSH2_SESSION *session, libssh2_string_cache **cache, unsigned short ccsid, const char *string, ssize_t inlen, size_t *outlen); LIBSSH2_API char * libssh2_to_ccsid(LIBSSH2_SESSION *session, libssh2_string_cache **cache, unsigned short ccsid, const char *string, ssize_t inlen, size_t *outlen); LIBSSH2_API void libssh2_release_string_cache(LIBSSH2_SESSION *session, libssh2_string_cache **cache); #endif /* vim: set expandtab ts=4 sw=4: */
2,396
C++
.h
55
39.927273
75
0.740677
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,243
stdio.h
Studio3T_robomongo/src/third-party/libssh2-1.9.0/sources/os400/include/stdio.h
/* * Copyright (C) 2015 Patrick Monnerat, D+H <patrick.monnerat@dh.com> * All rights reserved. * * Redistribution and use in source and binary forms, * with or without modification, are permitted provided * that the following conditions are met: * * Redistributions of source code must retain the above * copyright notice, this list of conditions and the * following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the copyright holder nor the names * of any other contributors may be used to endorse or * promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. */ #ifndef LIBSSH2_STDIO_H #define LIBSSH2_STDIO_H /* * <stdio.h> wrapper. * Its goal is to redefine snprintf/vsnprintf which are not supported by QADRT. */ #include <qadrt.h> #if __ILEC400_TGTVRM__ >= 710 # include_next <stdio.h> #elif __ILEC400_TGTVRM__ >= 510 # ifndef __SRCSTMF__ # include <QADRT/h/stdio> # else # include </QIBM/ProdData/qadrt/include/stdio.h> # endif #endif extern int _libssh2_os400_vsnprintf(char *dst, size_t len, const char *fmt, va_list args); extern int _libssh2_os400_snprintf(char *dst, size_t len, const char *fmt, ...); #ifndef LIBSSH2_DISABLE_QADRT_EXT # define vsnprintf(dst, len, fmt, args) \ _libssh2_os400_vsnprintf((dst), (len), (fmt), (args)) # define snprintf _libssh2_os400_snprintf #endif #endif /* vim: set expandtab ts=4 sw=4: */
2,570
C++
.h
64
36.90625
80
0.71297
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,244
alloca.h
Studio3T_robomongo/src/third-party/libssh2-1.9.0/sources/os400/include/alloca.h
/* * Copyright (C) 2015 Patrick Monnerat, D+H <patrick.monnerat@dh.com> * All rights reserved. * * Redistribution and use in source and binary forms, * with or without modification, are permitted provided * that the following conditions are met: * * Redistributions of source code must retain the above * copyright notice, this list of conditions and the * following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the copyright holder nor the names * of any other contributors may be used to endorse or * promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. */ #ifndef LIBSSH2_ALLOCA_H #define LIBSSH2_ALLOCA_H /* alloca() emulation. */ #include <modasa.mih> #define alloca(n) _MODASA(n) #endif /* vim: set expandtab ts=4 sw=4: */
1,824
C++
.h
44
39.5
69
0.764374
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,245
socket.h
Studio3T_robomongo/src/third-party/libssh2-1.9.0/sources/os400/include/sys/socket.h
/* * Copyright (C) 2015 Patrick Monnerat, D+H <patrick.monnerat@dh.com> * All rights reserved. * * Redistribution and use in source and binary forms, * with or without modification, are permitted provided * that the following conditions are met: * * Redistributions of source code must retain the above * copyright notice, this list of conditions and the * following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the copyright holder nor the names * of any other contributors may be used to endorse or * promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. */ #ifndef LIBSSH2_SYS_SOCKET_H #define LIBSSH2_SYS_SOCKET_H /* * <sys/socket.h> wrapper. * Redefines connect(). */ #include <qadrt.h> #ifndef _QADRT_LT # define _QADRT_LT < #endif #ifndef _QADRT_GT # define _QADRT_GT > #endif #ifdef QADRT_SYSINC # include _QADRT_LT QADRT_SYSINC/sys/socket.h _QADRT_GT #elif __ILEC400_TGTVRM__ >= 710 # include_next <sys/socket.h> #elif !defined(__SRCSTMF__) # include <QSYSINC/sys/socket> #else # include </QIBM/include/sys/socket.h> #endif extern int _libssh2_os400_connect(int sd, struct sockaddr * destaddr, int addrlen); #ifndef LIBSSH2_DISABLE_QADRT_EXT #define connect(sd, addr, len) _libssh2_os400_connect((sd), (addr), (len)) #endif #endif /* vim: set expandtab ts=4 sw=4: */
2,409
C++
.h
66
34.242424
76
0.747215
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
15,246
libssh2_config.h
Studio3T_robomongo/src/third-party/libssh2-1.9.0/sources/win32/libssh2_config.h
#ifndef LIBSSH2_CONFIG_H #define LIBSSH2_CONFIG_H #ifndef WIN32 #define WIN32 #endif #ifndef _CRT_SECURE_NO_DEPRECATE #define _CRT_SECURE_NO_DEPRECATE 1 #endif /* _CRT_SECURE_NO_DEPRECATE */ #include <winsock2.h> #include <mswsock.h> #include <ws2tcpip.h> #ifdef __MINGW32__ #define HAVE_UNISTD_H #define HAVE_INTTYPES_H #define HAVE_SYS_TIME_H #define HAVE_GETTIMEOFDAY #endif /* __MINGW32__ */ #define HAVE_LIBCRYPT32 #define HAVE_WINSOCK2_H #define HAVE_IOCTLSOCKET #define HAVE_SELECT #ifdef _MSC_VER #if _MSC_VER < 1900 #define snprintf _snprintf #if _MSC_VER < 1500 #define vsnprintf _vsnprintf #endif #define strdup _strdup #define strncasecmp _strnicmp #define strcasecmp _stricmp #endif #else #ifndef __MINGW32__ #define strncasecmp strnicmp #define strcasecmp stricmp #endif /* __MINGW32__ */ #endif /* _MSC_VER */ /* Enable newer diffie-hellman-group-exchange-sha1 syntax */ #define LIBSSH2_DH_GEX_NEW 1 #endif /* LIBSSH2_CONFIG_H */
952
C++
.h
40
22.625
60
0.774586
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
15,247
session_fixture.h
Studio3T_robomongo/src/third-party/libssh2-1.9.0/sources/tests/session_fixture.h
/* Copyright (C) 2016 Alexander Lamaison * All rights reserved. * * Redistribution and use in source and binary forms, * with or without modification, are permitted provided * that the following conditions are met: * * Redistributions of source code must retain the above * copyright notice, this list of conditions and the * following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the copyright holder nor the names * of any other contributors may be used to endorse or * promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. */ #ifndef LIBSSH2_TESTS_SESSION_FIXTURE_H #define LIBSSH2_TESTS_SESSION_FIXTURE_H #include <libssh2.h> LIBSSH2_SESSION *start_session_fixture(); void stop_session_fixture(); void print_last_session_error(const char *function); #endif
1,846
C++
.h
43
41.023256
64
0.779322
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
15,248
openssh_fixture.h
Studio3T_robomongo/src/third-party/libssh2-1.9.0/sources/tests/openssh_fixture.h
/* Copyright (C) 2016 Alexander Lamaison * All rights reserved. * * Redistribution and use in source and binary forms, * with or without modification, are permitted provided * that the following conditions are met: * * Redistributions of source code must retain the above * copyright notice, this list of conditions and the * following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the copyright holder nor the names * of any other contributors may be used to endorse or * promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. */ #ifndef LIBSSH2_TESTS_OPENSSH_FIXTURE_H #define LIBSSH2_TESTS_OPENSSH_FIXTURE_H int start_openssh_fixture(); void stop_openssh_fixture(); int open_socket_to_openssh_server(); #endif
1,795
C++
.h
42
40.833333
64
0.778286
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,249
blf.h
Studio3T_robomongo/src/third-party/libssh2-1.9.0/sources/src/blf.h
/* $OpenBSD: blf.h,v 1.7 2007/03/14 17:59:41 grunk Exp $ */ /* * Blowfish - a fast block cipher designed by Bruce Schneier * * Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Niels Provos. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _BLF_H_ #define _BLF_H_ #if !defined(HAVE_BCRYPT_PBKDF) && !defined(HAVE_BLH_H) /* Schneier specifies a maximum key length of 56 bytes. * This ensures that every key bit affects every cipher * bit. However, the subkeys can hold up to 72 bytes. * Warning: For normal blowfish encryption only 56 bytes * of the key affect all cipherbits. */ #define BLF_N 16 /* Number of Subkeys */ #define BLF_MAXKEYLEN ((BLF_N-2)*4) /* 448 bits */ #define BLF_MAXUTILIZED ((BLF_N + 2)*4) /* 576 bits */ /* Blowfish context */ typedef struct BlowfishContext { uint32_t S[4][256]; /* S-Boxes */ uint32_t P[BLF_N + 2]; /* Subkeys */ } blf_ctx; /* Raw access to customized Blowfish * blf_key is just: * Blowfish_initstate( state ) * Blowfish_expand0state( state, key, keylen ) */ void Blowfish_encipher(blf_ctx *, uint32_t *, uint32_t *); void Blowfish_decipher(blf_ctx *, uint32_t *, uint32_t *); void Blowfish_initstate(blf_ctx *); void Blowfish_expand0state(blf_ctx *, const uint8_t *, uint16_t); void Blowfish_expandstate (blf_ctx *, const uint8_t *, uint16_t, const uint8_t *, uint16_t); /* Standard Blowfish */ void blf_key(blf_ctx *, const uint8_t *, uint16_t); void blf_enc(blf_ctx *, uint32_t *, uint16_t); void blf_dec(blf_ctx *, uint32_t *, uint16_t); void blf_ecb_encrypt(blf_ctx *, uint8_t *, uint32_t); void blf_ecb_decrypt(blf_ctx *, uint8_t *, uint32_t); void blf_cbc_encrypt(blf_ctx *, uint8_t *, uint8_t *, uint32_t); void blf_cbc_decrypt(blf_ctx *, uint8_t *, uint8_t *, uint32_t); /* Converts uint8_t to uint32_t */ uint32_t Blowfish_stream2word(const uint8_t *, uint16_t, uint16_t *); /* bcrypt with pbkd */ int bcrypt_pbkdf(const char *pass, size_t passlen, const uint8_t *salt, size_t saltlen, uint8_t *key, size_t keylen, unsigned int rounds); #endif /* !defined(HAVE_BCRYPT_PBKDF) && !defined(HAVE_BLH_H) */ #endif /* _BLF_H */
3,775
C++
.h
76
47.315789
76
0.715604
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
15,250
crypto.h
Studio3T_robomongo/src/third-party/libssh2-1.9.0/sources/src/crypto.h
/* Copyright (C) 2009, 2010 Simon Josefsson * Copyright (C) 2006, 2007 The Written Word, Inc. All rights reserved. * Copyright (C) 2010-2019 Daniel Stenberg * * Redistribution and use in source and binary forms, * with or without modification, are permitted provided * that the following conditions are met: * * Redistributions of source code must retain the above * copyright notice, this list of conditions and the * following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the copyright holder nor the names * of any other contributors may be used to endorse or * promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. */ #ifndef LIBSSH2_CRYPTO_H #define LIBSSH2_CRYPTO_H #ifdef LIBSSH2_OPENSSL #include "openssl.h" #endif #ifdef LIBSSH2_LIBGCRYPT #include "libgcrypt.h" #endif #ifdef LIBSSH2_WINCNG #include "wincng.h" #endif #ifdef LIBSSH2_OS400QC3 #include "os400qc3.h" #endif #ifdef LIBSSH2_MBEDTLS #include "mbedtls.h" #endif #define LIBSSH2_ED25519_KEY_LEN 32 #define LIBSSH2_ED25519_PRIVATE_KEY_LEN 64 #define LIBSSH2_ED25519_SIG_LEN 64 #if LIBSSH2_RSA int _libssh2_rsa_new(libssh2_rsa_ctx ** rsa, const unsigned char *edata, unsigned long elen, const unsigned char *ndata, unsigned long nlen, const unsigned char *ddata, unsigned long dlen, const unsigned char *pdata, unsigned long plen, const unsigned char *qdata, unsigned long qlen, const unsigned char *e1data, unsigned long e1len, const unsigned char *e2data, unsigned long e2len, const unsigned char *coeffdata, unsigned long coefflen); int _libssh2_rsa_new_private(libssh2_rsa_ctx ** rsa, LIBSSH2_SESSION * session, const char *filename, unsigned const char *passphrase); int _libssh2_rsa_sha1_verify(libssh2_rsa_ctx * rsa, const unsigned char *sig, unsigned long sig_len, const unsigned char *m, unsigned long m_len); int _libssh2_rsa_sha1_sign(LIBSSH2_SESSION * session, libssh2_rsa_ctx * rsactx, const unsigned char *hash, size_t hash_len, unsigned char **signature, size_t *signature_len); int _libssh2_rsa_new_private_frommemory(libssh2_rsa_ctx ** rsa, LIBSSH2_SESSION * session, const char *filedata, size_t filedata_len, unsigned const char *passphrase); #endif #if LIBSSH2_DSA int _libssh2_dsa_new(libssh2_dsa_ctx ** dsa, const unsigned char *pdata, unsigned long plen, const unsigned char *qdata, unsigned long qlen, const unsigned char *gdata, unsigned long glen, const unsigned char *ydata, unsigned long ylen, const unsigned char *x, unsigned long x_len); int _libssh2_dsa_new_private(libssh2_dsa_ctx ** dsa, LIBSSH2_SESSION * session, const char *filename, unsigned const char *passphrase); int _libssh2_dsa_sha1_verify(libssh2_dsa_ctx * dsactx, const unsigned char *sig, const unsigned char *m, unsigned long m_len); int _libssh2_dsa_sha1_sign(libssh2_dsa_ctx * dsactx, const unsigned char *hash, unsigned long hash_len, unsigned char *sig); int _libssh2_dsa_new_private_frommemory(libssh2_dsa_ctx ** dsa, LIBSSH2_SESSION * session, const char *filedata, size_t filedata_len, unsigned const char *passphrase); #endif #if LIBSSH2_ECDSA int _libssh2_ecdsa_curve_name_with_octal_new(libssh2_ecdsa_ctx ** ecdsactx, const unsigned char *k, size_t k_len, libssh2_curve_type type); int _libssh2_ecdsa_new_private(libssh2_ecdsa_ctx ** ec_ctx, LIBSSH2_SESSION * session, const char *filename, unsigned const char *passphrase); int _libssh2_ecdsa_verify(libssh2_ecdsa_ctx * ctx, const unsigned char *r, size_t r_len, const unsigned char *s, size_t s_len, const unsigned char *m, size_t m_len); int _libssh2_ecdsa_create_key(LIBSSH2_SESSION *session, _libssh2_ec_key **out_private_key, unsigned char **out_public_key_octal, size_t *out_public_key_octal_len, libssh2_curve_type curve_type); int _libssh2_ecdh_gen_k(_libssh2_bn **k, _libssh2_ec_key *private_key, const unsigned char *server_public_key, size_t server_public_key_len); int _libssh2_ecdsa_sign(LIBSSH2_SESSION *session, libssh2_ecdsa_ctx *ec_ctx, const unsigned char *hash, unsigned long hash_len, unsigned char **signature, size_t *signature_len); int _libssh2_ecdsa_new_private_frommemory(libssh2_ecdsa_ctx ** ec_ctx, LIBSSH2_SESSION * session, const char *filedata, size_t filedata_len, unsigned const char *passphrase); libssh2_curve_type _libssh2_ecdsa_key_get_curve_type(_libssh2_ec_key *key); int _libssh2_ecdsa_curve_type_from_name(const char *name, libssh2_curve_type *out_type); #endif /* LIBSSH2_ECDSA */ #if LIBSSH2_ED25519 int _libssh2_curve25519_new(LIBSSH2_SESSION *session, libssh2_ed25519_ctx **ctx, uint8_t **out_public_key, uint8_t **out_private_key); int _libssh2_curve25519_gen_k(_libssh2_bn **k, uint8_t private_key[LIBSSH2_ED25519_KEY_LEN], uint8_t server_public_key[LIBSSH2_ED25519_KEY_LEN]); int _libssh2_ed25519_verify(libssh2_ed25519_ctx *ctx, const uint8_t *s, size_t s_len, const uint8_t *m, size_t m_len); int _libssh2_ed25519_new_private(libssh2_ed25519_ctx **ed_ctx, LIBSSH2_SESSION *session, const char *filename, const uint8_t *passphrase); int _libssh2_ed25519_new_public(libssh2_ed25519_ctx **ed_ctx, LIBSSH2_SESSION *session, const unsigned char *raw_pub_key, const uint8_t key_len); int _libssh2_ed25519_sign(libssh2_ed25519_ctx *ctx, LIBSSH2_SESSION *session, uint8_t **out_sig, size_t *out_sig_len, const uint8_t *message, size_t message_len); int _libssh2_ed25519_new_private_frommemory(libssh2_ed25519_ctx **ed_ctx, LIBSSH2_SESSION *session, const char *filedata, size_t filedata_len, unsigned const char *passphrase); #endif /* LIBSSH2_ED25519 */ int _libssh2_cipher_init(_libssh2_cipher_ctx * h, _libssh2_cipher_type(algo), unsigned char *iv, unsigned char *secret, int encrypt); int _libssh2_cipher_crypt(_libssh2_cipher_ctx * ctx, _libssh2_cipher_type(algo), int encrypt, unsigned char *block, size_t blocksize); int _libssh2_pub_priv_keyfile(LIBSSH2_SESSION *session, unsigned char **method, size_t *method_len, unsigned char **pubkeydata, size_t *pubkeydata_len, const char *privatekey, const char *passphrase); int _libssh2_pub_priv_keyfilememory(LIBSSH2_SESSION *session, unsigned char **method, size_t *method_len, unsigned char **pubkeydata, size_t *pubkeydata_len, const char *privatekeydata, size_t privatekeydata_len, const char *passphrase); #endif
10,244
C++
.h
216
32.25463
79
0.55042
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,251
wincng.h
Studio3T_robomongo/src/third-party/libssh2-1.9.0/sources/src/wincng.h
/* * Copyright (C) 2013-2015 Marc Hoersken <info@marc-hoersken.de> * All rights reserved. * * Redistribution and use in source and binary forms, * with or without modification, are permitted provided * that the following conditions are met: * * Redistributions of source code must retain the above * copyright notice, this list of conditions and the * following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the copyright holder nor the names * of any other contributors may be used to endorse or * promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. */ /* required for cross-compilation against the w64 mingw-runtime package */ #if defined(_WIN32_WINNT) && (_WIN32_WINNT < 0x0600) #undef _WIN32_WINNT #endif #ifndef _WIN32_WINNT #define _WIN32_WINNT 0x0600 #endif #include <windows.h> #include <bcrypt.h> #define LIBSSH2_MD5 1 #define LIBSSH2_HMAC_RIPEMD 0 #define LIBSSH2_HMAC_SHA256 1 #define LIBSSH2_HMAC_SHA512 1 #define LIBSSH2_AES 1 #define LIBSSH2_AES_CTR 1 #define LIBSSH2_BLOWFISH 0 #define LIBSSH2_RC4 1 #define LIBSSH2_CAST 0 #define LIBSSH2_3DES 1 #define LIBSSH2_RSA 1 #define LIBSSH2_DSA 1 #define LIBSSH2_ECDSA 0 #define LIBSSH2_ED25519 0 #define MD5_DIGEST_LENGTH 16 #define SHA_DIGEST_LENGTH 20 #define SHA256_DIGEST_LENGTH 32 #define SHA512_DIGEST_LENGTH 64 #define EC_MAX_POINT_LEN ((528 * 2 / 8) + 1) #if LIBSSH2_ECDSA #else #define _libssh2_ec_key void #endif /*******************************************************************/ /* * Windows CNG backend: Global context handles */ struct _libssh2_wincng_ctx { BCRYPT_ALG_HANDLE hAlgRNG; BCRYPT_ALG_HANDLE hAlgHashMD5; BCRYPT_ALG_HANDLE hAlgHashSHA1; BCRYPT_ALG_HANDLE hAlgHashSHA256; BCRYPT_ALG_HANDLE hAlgHashSHA512; BCRYPT_ALG_HANDLE hAlgHmacMD5; BCRYPT_ALG_HANDLE hAlgHmacSHA1; BCRYPT_ALG_HANDLE hAlgHmacSHA256; BCRYPT_ALG_HANDLE hAlgHmacSHA512; BCRYPT_ALG_HANDLE hAlgRSA; BCRYPT_ALG_HANDLE hAlgDSA; BCRYPT_ALG_HANDLE hAlgAES_CBC; BCRYPT_ALG_HANDLE hAlgAES_ECB; BCRYPT_ALG_HANDLE hAlgRC4_NA; BCRYPT_ALG_HANDLE hAlg3DES_CBC; }; struct _libssh2_wincng_ctx _libssh2_wincng; /*******************************************************************/ /* * Windows CNG backend: Generic functions */ void _libssh2_wincng_init(void); void _libssh2_wincng_free(void); #define libssh2_crypto_init() \ _libssh2_wincng_init() #define libssh2_crypto_exit() \ _libssh2_wincng_free() #define _libssh2_random(buf, len) \ _libssh2_wincng_random(buf, len) #define libssh2_prepare_iovec(vec, len) /* Empty. */ /*******************************************************************/ /* * Windows CNG backend: Hash structure */ typedef struct __libssh2_wincng_hash_ctx { BCRYPT_HASH_HANDLE hHash; unsigned char *pbHashObject; unsigned long dwHashObject; unsigned long cbHash; } _libssh2_wincng_hash_ctx; /* * Windows CNG backend: Hash functions */ #define libssh2_sha1_ctx _libssh2_wincng_hash_ctx #define libssh2_sha1_init(ctx) \ (_libssh2_wincng_hash_init(ctx, _libssh2_wincng.hAlgHashSHA1, \ SHA_DIGEST_LENGTH, NULL, 0) == 0) #define libssh2_sha1_update(ctx, data, datalen) \ _libssh2_wincng_hash_update(&ctx, (unsigned char *) data, datalen) #define libssh2_sha1_final(ctx, hash) \ _libssh2_wincng_hash_final(&ctx, hash) #define libssh2_sha1(data, datalen, hash) \ _libssh2_wincng_hash(data, datalen, _libssh2_wincng.hAlgHashSHA1, \ hash, SHA_DIGEST_LENGTH) #define libssh2_sha256_ctx _libssh2_wincng_hash_ctx #define libssh2_sha256_init(ctx) \ (_libssh2_wincng_hash_init(ctx, _libssh2_wincng.hAlgHashSHA256, \ SHA256_DIGEST_LENGTH, NULL, 0) == 0) #define libssh2_sha256_update(ctx, data, datalen) \ _libssh2_wincng_hash_update(&ctx, (unsigned char *) data, datalen) #define libssh2_sha256_final(ctx, hash) \ _libssh2_wincng_hash_final(&ctx, hash) #define libssh2_sha256(data, datalen, hash) \ _libssh2_wincng_hash(data, datalen, _libssh2_wincng.hAlgHashSHA256, \ hash, SHA256_DIGEST_LENGTH) #define libssh2_sha512_ctx _libssh2_wincng_hash_ctx #define libssh2_sha512_init(ctx) \ (_libssh2_wincng_hash_init(ctx, _libssh2_wincng.hAlgHashSHA512, \ SHA512_DIGEST_LENGTH, NULL, 0) == 0) #define libssh2_sha512_update(ctx, data, datalen) \ _libssh2_wincng_hash_update(&ctx, (unsigned char *) data, datalen) #define libssh2_sha512_final(ctx, hash) \ _libssh2_wincng_hash_final(&ctx, hash) #define libssh2_sha512(data, datalen, hash) \ _libssh2_wincng_hash(data, datalen, _libssh2_wincng.hAlgHashSHA512, \ hash, SHA512_DIGEST_LENGTH) #define libssh2_md5_ctx _libssh2_wincng_hash_ctx #define libssh2_md5_init(ctx) \ (_libssh2_wincng_hash_init(ctx, _libssh2_wincng.hAlgHashMD5, \ MD5_DIGEST_LENGTH, NULL, 0) == 0) #define libssh2_md5_update(ctx, data, datalen) \ _libssh2_wincng_hash_update(&ctx, (unsigned char *) data, datalen) #define libssh2_md5_final(ctx, hash) \ _libssh2_wincng_hash_final(&ctx, hash) #define libssh2_md5(data, datalen, hash) \ _libssh2_wincng_hash(data, datalen, _libssh2_wincng.hAlgHashMD5, \ hash, MD5_DIGEST_LENGTH) /* * Windows CNG backend: HMAC functions */ #define libssh2_hmac_ctx _libssh2_wincng_hash_ctx #define libssh2_hmac_ctx_init(ctx) #define libssh2_hmac_sha1_init(ctx, key, keylen) \ _libssh2_wincng_hash_init(ctx, _libssh2_wincng.hAlgHmacSHA1, \ SHA_DIGEST_LENGTH, key, keylen) #define libssh2_hmac_md5_init(ctx, key, keylen) \ _libssh2_wincng_hash_init(ctx, _libssh2_wincng.hAlgHmacMD5, \ MD5_DIGEST_LENGTH, key, keylen) #define libssh2_hmac_ripemd160_init(ctx, key, keylen) /* not implemented */ #define libssh2_hmac_sha256_init(ctx, key, keylen) \ _libssh2_wincng_hash_init(ctx, _libssh2_wincng.hAlgHmacSHA256, \ SHA256_DIGEST_LENGTH, key, keylen) #define libssh2_hmac_sha512_init(ctx, key, keylen) \ _libssh2_wincng_hash_init(ctx, _libssh2_wincng.hAlgHmacSHA512, \ SHA512_DIGEST_LENGTH, key, keylen) #define libssh2_hmac_update(ctx, data, datalen) \ _libssh2_wincng_hash_update(&ctx, (unsigned char *) data, datalen) #define libssh2_hmac_final(ctx, hash) \ _libssh2_wincng_hmac_final(&ctx, hash) #define libssh2_hmac_cleanup(ctx) \ _libssh2_wincng_hmac_cleanup(ctx) /*******************************************************************/ /* * Windows CNG backend: Key Context structure */ typedef struct __libssh2_wincng_key_ctx { BCRYPT_KEY_HANDLE hKey; unsigned char *pbKeyObject; unsigned long cbKeyObject; } _libssh2_wincng_key_ctx; /* * Windows CNG backend: RSA functions */ #define libssh2_rsa_ctx _libssh2_wincng_key_ctx #define _libssh2_rsa_new(rsactx, e, e_len, n, n_len, \ d, d_len, p, p_len, q, q_len, \ e1, e1_len, e2, e2_len, c, c_len) \ _libssh2_wincng_rsa_new(rsactx, e, e_len, n, n_len, \ d, d_len, p, p_len, q, q_len, \ e1, e1_len, e2, e2_len, c, c_len) #define _libssh2_rsa_new_private(rsactx, s, filename, passphrase) \ _libssh2_wincng_rsa_new_private(rsactx, s, filename, passphrase) #define _libssh2_rsa_new_private_frommemory(rsactx, s, filedata, \ filedata_len, passphrase) \ _libssh2_wincng_rsa_new_private_frommemory(rsactx, s, filedata, \ filedata_len, passphrase) #define _libssh2_rsa_sha1_sign(s, rsactx, hash, hash_len, sig, sig_len) \ _libssh2_wincng_rsa_sha1_sign(s, rsactx, hash, hash_len, sig, sig_len) #define _libssh2_rsa_sha1_verify(rsactx, sig, sig_len, m, m_len) \ _libssh2_wincng_rsa_sha1_verify(rsactx, sig, sig_len, m, m_len) #define _libssh2_rsa_free(rsactx) \ _libssh2_wincng_rsa_free(rsactx) /* * Windows CNG backend: DSA functions */ #define libssh2_dsa_ctx _libssh2_wincng_key_ctx #define _libssh2_dsa_new(dsactx, p, p_len, q, q_len, \ g, g_len, y, y_len, x, x_len) \ _libssh2_wincng_dsa_new(dsactx, p, p_len, q, q_len, \ g, g_len, y, y_len, x, x_len) #define _libssh2_dsa_new_private(dsactx, s, filename, passphrase) \ _libssh2_wincng_dsa_new_private(dsactx, s, filename, passphrase) #define _libssh2_dsa_new_private_frommemory(dsactx, s, filedata, \ filedata_len, passphrase) \ _libssh2_wincng_dsa_new_private_frommemory(dsactx, s, filedata, \ filedata_len, passphrase) #define _libssh2_dsa_sha1_sign(dsactx, hash, hash_len, sig) \ _libssh2_wincng_dsa_sha1_sign(dsactx, hash, hash_len, sig) #define _libssh2_dsa_sha1_verify(dsactx, sig, m, m_len) \ _libssh2_wincng_dsa_sha1_verify(dsactx, sig, m, m_len) #define _libssh2_dsa_free(dsactx) \ _libssh2_wincng_dsa_free(dsactx) /* * Windows CNG backend: Key functions */ #define _libssh2_pub_priv_keyfile(s, m, m_len, p, p_len, pk, pw) \ _libssh2_wincng_pub_priv_keyfile(s, m, m_len, p, p_len, pk, pw) #define _libssh2_pub_priv_keyfilememory(s, m, m_len, p, p_len, \ pk, pk_len, pw) \ _libssh2_wincng_pub_priv_keyfilememory(s, m, m_len, p, p_len, \ pk, pk_len, pw) /*******************************************************************/ /* * Windows CNG backend: Cipher Context structure */ struct _libssh2_wincng_cipher_ctx { BCRYPT_KEY_HANDLE hKey; unsigned char *pbKeyObject; unsigned char *pbIV; unsigned char *pbCtr; unsigned long dwKeyObject; unsigned long dwIV; unsigned long dwBlockLength; unsigned long dwCtrLength; }; #define _libssh2_cipher_ctx struct _libssh2_wincng_cipher_ctx /* * Windows CNG backend: Cipher Type structure */ struct _libssh2_wincng_cipher_type { BCRYPT_ALG_HANDLE *phAlg; unsigned long dwKeyLength; int useIV; /* TODO: Convert to bool when a C89 compatible bool type is defined */ int ctrMode; }; #define _libssh2_cipher_type(type) struct _libssh2_wincng_cipher_type type #define _libssh2_cipher_aes256ctr { &_libssh2_wincng.hAlgAES_ECB, 32, 0, 1 } #define _libssh2_cipher_aes192ctr { &_libssh2_wincng.hAlgAES_ECB, 24, 0, 1 } #define _libssh2_cipher_aes128ctr { &_libssh2_wincng.hAlgAES_ECB, 16, 0, 1 } #define _libssh2_cipher_aes256 { &_libssh2_wincng.hAlgAES_CBC, 32, 1, 0 } #define _libssh2_cipher_aes192 { &_libssh2_wincng.hAlgAES_CBC, 24, 1, 0 } #define _libssh2_cipher_aes128 { &_libssh2_wincng.hAlgAES_CBC, 16, 1, 0 } #define _libssh2_cipher_arcfour { &_libssh2_wincng.hAlgRC4_NA, 16, 0, 0 } #define _libssh2_cipher_3des { &_libssh2_wincng.hAlg3DES_CBC, 24, 1, 0 } /* * Windows CNG backend: Cipher functions */ #define _libssh2_cipher_init(ctx, type, iv, secret, encrypt) \ _libssh2_wincng_cipher_init(ctx, type, iv, secret, encrypt) #define _libssh2_cipher_crypt(ctx, type, encrypt, block, blocklen) \ _libssh2_wincng_cipher_crypt(ctx, type, encrypt, block, blocklen) #define _libssh2_cipher_dtor(ctx) \ _libssh2_wincng_cipher_dtor(ctx) /*******************************************************************/ /* * Windows CNG backend: BigNumber Context */ #define _libssh2_bn_ctx int /* not used */ #define _libssh2_bn_ctx_new() 0 /* not used */ #define _libssh2_bn_ctx_free(bnctx) ((void)0) /* not used */ /*******************************************************************/ /* * Windows CNG backend: BigNumber structure */ struct _libssh2_wincng_bignum { unsigned char *bignum; unsigned long length; }; #define _libssh2_bn struct _libssh2_wincng_bignum /* * Windows CNG backend: BigNumber functions */ _libssh2_bn *_libssh2_wincng_bignum_init(void); #define _libssh2_bn_init() \ _libssh2_wincng_bignum_init() #define _libssh2_bn_init_from_bin() \ _libssh2_bn_init() #define _libssh2_bn_set_word(bn, word) \ _libssh2_wincng_bignum_set_word(bn, word) #define _libssh2_bn_from_bin(bn, len, bin) \ _libssh2_wincng_bignum_from_bin(bn, len, bin) #define _libssh2_bn_to_bin(bn, bin) \ _libssh2_wincng_bignum_to_bin(bn, bin) #define _libssh2_bn_bytes(bn) bn->length #define _libssh2_bn_bits(bn) \ _libssh2_wincng_bignum_bits(bn) #define _libssh2_bn_free(bn) \ _libssh2_wincng_bignum_free(bn) /* * Windows CNG backend: Diffie-Hellman support */ #define _libssh2_dh_ctx struct _libssh2_wincng_bignum * #define libssh2_dh_init(dhctx) _libssh2_dh_init(dhctx) #define libssh2_dh_key_pair(dhctx, public, g, p, group_order, bnctx) \ _libssh2_dh_key_pair(dhctx, public, g, p, group_order) #define libssh2_dh_secret(dhctx, secret, f, p, bnctx) \ _libssh2_dh_secret(dhctx, secret, f, p) #define libssh2_dh_dtor(dhctx) _libssh2_dh_dtor(dhctx) /*******************************************************************/ /* * Windows CNG backend: forward declarations */ void _libssh2_wincng_init(void); void _libssh2_wincng_free(void); int _libssh2_wincng_random(void *buf, int len); int _libssh2_wincng_hash_init(_libssh2_wincng_hash_ctx *ctx, BCRYPT_ALG_HANDLE hAlg, unsigned long hashlen, unsigned char *key, unsigned long keylen); int _libssh2_wincng_hash_update(_libssh2_wincng_hash_ctx *ctx, const unsigned char *data, unsigned long datalen); int _libssh2_wincng_hash_final(_libssh2_wincng_hash_ctx *ctx, unsigned char *hash); int _libssh2_wincng_hash(unsigned char *data, unsigned long datalen, BCRYPT_ALG_HANDLE hAlg, unsigned char *hash, unsigned long hashlen); int _libssh2_wincng_hmac_final(_libssh2_wincng_hash_ctx *ctx, unsigned char *hash); void _libssh2_wincng_hmac_cleanup(_libssh2_wincng_hash_ctx *ctx); int _libssh2_wincng_key_sha1_verify(_libssh2_wincng_key_ctx *ctx, const unsigned char *sig, unsigned long sig_len, const unsigned char *m, unsigned long m_len, unsigned long flags); int _libssh2_wincng_rsa_new(libssh2_rsa_ctx **rsa, const unsigned char *edata, unsigned long elen, const unsigned char *ndata, unsigned long nlen, const unsigned char *ddata, unsigned long dlen, const unsigned char *pdata, unsigned long plen, const unsigned char *qdata, unsigned long qlen, const unsigned char *e1data, unsigned long e1len, const unsigned char *e2data, unsigned long e2len, const unsigned char *coeffdata, unsigned long coefflen); int _libssh2_wincng_rsa_new_private(libssh2_rsa_ctx **rsa, LIBSSH2_SESSION *session, const char *filename, const unsigned char *passphrase); int _libssh2_wincng_rsa_new_private_frommemory(libssh2_rsa_ctx **rsa, LIBSSH2_SESSION *session, const char *filedata, size_t filedata_len, unsigned const char *passphrase); int _libssh2_wincng_rsa_sha1_verify(libssh2_rsa_ctx *rsa, const unsigned char *sig, unsigned long sig_len, const unsigned char *m, unsigned long m_len); int _libssh2_wincng_rsa_sha1_sign(LIBSSH2_SESSION *session, libssh2_rsa_ctx *rsa, const unsigned char *hash, size_t hash_len, unsigned char **signature, size_t *signature_len); void _libssh2_wincng_rsa_free(libssh2_rsa_ctx *rsa); #if LIBSSH2_DSA int _libssh2_wincng_dsa_new(libssh2_dsa_ctx **dsa, const unsigned char *pdata, unsigned long plen, const unsigned char *qdata, unsigned long qlen, const unsigned char *gdata, unsigned long glen, const unsigned char *ydata, unsigned long ylen, const unsigned char *xdata, unsigned long xlen); int _libssh2_wincng_dsa_new_private(libssh2_dsa_ctx **dsa, LIBSSH2_SESSION *session, const char *filename, const unsigned char *passphrase); int _libssh2_wincng_dsa_new_private_frommemory(libssh2_dsa_ctx **dsa, LIBSSH2_SESSION *session, const char *filedata, size_t filedata_len, unsigned const char *passphrase); int _libssh2_wincng_dsa_sha1_verify(libssh2_dsa_ctx *dsa, const unsigned char *sig_fixed, const unsigned char *m, unsigned long m_len); int _libssh2_wincng_dsa_sha1_sign(libssh2_dsa_ctx *dsa, const unsigned char *hash, unsigned long hash_len, unsigned char *sig_fixed); void _libssh2_wincng_dsa_free(libssh2_dsa_ctx *dsa); #endif int _libssh2_wincng_pub_priv_keyfile(LIBSSH2_SESSION *session, unsigned char **method, size_t *method_len, unsigned char **pubkeydata, size_t *pubkeydata_len, const char *privatekey, const char *passphrase); int _libssh2_wincng_pub_priv_keyfilememory(LIBSSH2_SESSION *session, unsigned char **method, size_t *method_len, unsigned char **pubkeydata, size_t *pubkeydata_len, const char *privatekeydata, size_t privatekeydata_len, const char *passphrase); int _libssh2_wincng_cipher_init(_libssh2_cipher_ctx *ctx, _libssh2_cipher_type(type), unsigned char *iv, unsigned char *secret, int encrypt); int _libssh2_wincng_cipher_crypt(_libssh2_cipher_ctx *ctx, _libssh2_cipher_type(type), int encrypt, unsigned char *block, size_t blocklen); void _libssh2_wincng_cipher_dtor(_libssh2_cipher_ctx *ctx); _libssh2_bn * _libssh2_wincng_bignum_init(void); int _libssh2_wincng_bignum_set_word(_libssh2_bn *bn, unsigned long word); unsigned long _libssh2_wincng_bignum_bits(const _libssh2_bn *bn); void _libssh2_wincng_bignum_from_bin(_libssh2_bn *bn, unsigned long len, const unsigned char *bin); void _libssh2_wincng_bignum_to_bin(const _libssh2_bn *bn, unsigned char *bin); void _libssh2_wincng_bignum_free(_libssh2_bn *bn); extern void _libssh2_dh_init(_libssh2_dh_ctx *dhctx); extern int _libssh2_dh_key_pair(_libssh2_dh_ctx *dhctx, _libssh2_bn *public, _libssh2_bn *g, _libssh2_bn *p, int group_order); extern int _libssh2_dh_secret(_libssh2_dh_ctx *dhctx, _libssh2_bn *secret, _libssh2_bn *f, _libssh2_bn *p); extern void _libssh2_dh_dtor(_libssh2_dh_ctx *dhctx);
21,409
C++
.h
502
33.860558
78
0.608408
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
15,252
mbedtls.h
Studio3T_robomongo/src/third-party/libssh2-1.9.0/sources/src/mbedtls.h
/* Copyright (c) 2016, Art <https://github.com/wildart> * All rights reserved. * * Redistribution and use in source and binary forms, * with or without modification, are permitted provided * that the following conditions are met: * * Redistributions of source code must retain the above * copyright notice, this list of conditions and the * following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the copyright holder nor the names * of any other contributors may be used to endorse or * promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. */ #include <stdlib.h> #include <string.h> #include <mbedtls/platform.h> #include <mbedtls/md.h> #include <mbedtls/rsa.h> #include <mbedtls/bignum.h> #include <mbedtls/cipher.h> #include <mbedtls/entropy.h> #include <mbedtls/ctr_drbg.h> #include <mbedtls/pk.h> #include <mbedtls/error.h> /* Define which features are supported. */ #define LIBSSH2_MD5 1 #define LIBSSH2_HMAC_RIPEMD 1 #define LIBSSH2_HMAC_SHA256 1 #define LIBSSH2_HMAC_SHA512 1 #define LIBSSH2_AES 1 #define LIBSSH2_AES_CTR 1 #define LIBSSH2_BLOWFISH 1 #define LIBSSH2_RC4 1 #define LIBSSH2_CAST 0 #define LIBSSH2_3DES 1 #define LIBSSH2_RSA 1 #define LIBSSH2_DSA 0 #define LIBSSH2_ECDSA 0 #define LIBSSH2_ED25519 0 #define MD5_DIGEST_LENGTH 16 #define SHA_DIGEST_LENGTH 20 #define SHA256_DIGEST_LENGTH 32 #define SHA384_DIGEST_LENGTH 48 #define SHA512_DIGEST_LENGTH 64 #define EC_MAX_POINT_LEN ((528 * 2 / 8) + 1) #if LIBSSH2_ECDSA #else #define _libssh2_ec_key void #endif /*******************************************************************/ /* * mbedTLS backend: Generic functions */ #define libssh2_crypto_init() \ _libssh2_mbedtls_init() #define libssh2_crypto_exit() \ _libssh2_mbedtls_free() #define _libssh2_random(buf, len) \ _libssh2_mbedtls_random(buf, len) #define libssh2_prepare_iovec(vec, len) /* Empty. */ /*******************************************************************/ /* * mbedTLS backend: HMAC functions */ #define libssh2_hmac_ctx mbedtls_md_context_t #define libssh2_hmac_ctx_init(ctx) #define libssh2_hmac_cleanup(pctx) \ mbedtls_md_free(pctx) #define libssh2_hmac_update(ctx, data, datalen) \ mbedtls_md_hmac_update(&ctx, (unsigned char *) data, datalen) #define libssh2_hmac_final(ctx, hash) \ mbedtls_md_hmac_finish(&ctx, hash) #define libssh2_hmac_sha1_init(pctx, key, keylen) \ _libssh2_mbedtls_hash_init(pctx, MBEDTLS_MD_SHA1, key, keylen) #define libssh2_hmac_md5_init(pctx, key, keylen) \ _libssh2_mbedtls_hash_init(pctx, MBEDTLS_MD_MD5, key, keylen) #define libssh2_hmac_ripemd160_init(pctx, key, keylen) \ _libssh2_mbedtls_hash_init(pctx, MBEDTLS_MD_RIPEMD160, key, keylen) #define libssh2_hmac_sha256_init(pctx, key, keylen) \ _libssh2_mbedtls_hash_init(pctx, MBEDTLS_MD_SHA256, key, keylen) #define libssh2_hmac_sha384_init(pctx, key, keylen) \ _libssh2_mbedtls_hash_init(pctx, MBEDTLS_MD_SHA384, key, keylen) #define libssh2_hmac_sha512_init(pctx, key, keylen) \ _libssh2_mbedtls_hash_init(pctx, MBEDTLS_MD_SHA512, key, keylen) /*******************************************************************/ /* * mbedTLS backend: SHA1 functions */ #define libssh2_sha1_ctx mbedtls_md_context_t #define libssh2_sha1_init(pctx) \ _libssh2_mbedtls_hash_init(pctx, MBEDTLS_MD_SHA1, NULL, 0) #define libssh2_sha1_update(ctx, data, datalen) \ mbedtls_md_update(&ctx, (unsigned char *) data, datalen) #define libssh2_sha1_final(ctx, hash) \ _libssh2_mbedtls_hash_final(&ctx, hash) #define libssh2_sha1(data, datalen, hash) \ _libssh2_mbedtls_hash(data, datalen, MBEDTLS_MD_SHA1, hash) /*******************************************************************/ /* * mbedTLS backend: SHA256 functions */ #define libssh2_sha256_ctx mbedtls_md_context_t #define libssh2_sha256_init(pctx) \ _libssh2_mbedtls_hash_init(pctx, MBEDTLS_MD_SHA256, NULL, 0) #define libssh2_sha256_update(ctx, data, datalen) \ mbedtls_md_update(&ctx, (unsigned char *) data, datalen) #define libssh2_sha256_final(ctx, hash) \ _libssh2_mbedtls_hash_final(&ctx, hash) #define libssh2_sha256(data, datalen, hash) \ _libssh2_mbedtls_hash(data, datalen, MBEDTLS_MD_SHA256, hash) /*******************************************************************/ /* * mbedTLS backend: SHA384 functions */ #define libssh2_sha384_ctx mbedtls_md_context_t #define libssh2_sha384_init(pctx) \ _libssh2_mbedtls_hash_init(pctx, MBEDTLS_MD_SHA384, NULL, 0) #define libssh2_sha384_update(ctx, data, datalen) \ mbedtls_md_update(&ctx, (unsigned char *) data, datalen) #define libssh2_sha384_final(ctx, hash) \ _libssh2_mbedtls_hash_final(&ctx, hash) #define libssh2_sha384(data, datalen, hash) \ _libssh2_mbedtls_hash(data, datalen, MBEDTLS_MD_SHA384, hash) /*******************************************************************/ /* * mbedTLS backend: SHA512 functions */ #define libssh2_sha512_ctx mbedtls_md_context_t #define libssh2_sha512_init(pctx) \ _libssh2_mbedtls_hash_init(pctx, MBEDTLS_MD_SHA512, NULL, 0) #define libssh2_sha512_update(ctx, data, datalen) \ mbedtls_md_update(&ctx, (unsigned char *) data, datalen) #define libssh2_sha512_final(ctx, hash) \ _libssh2_mbedtls_hash_final(&ctx, hash) #define libssh2_sha512(data, datalen, hash) \ _libssh2_mbedtls_hash(data, datalen, MBEDTLS_MD_SHA512, hash) /*******************************************************************/ /* * mbedTLS backend: MD5 functions */ #define libssh2_md5_ctx mbedtls_md_context_t #define libssh2_md5_init(pctx) \ _libssh2_mbedtls_hash_init(pctx, MBEDTLS_MD_MD5, NULL, 0) #define libssh2_md5_update(ctx, data, datalen) \ mbedtls_md_update(&ctx, (unsigned char *) data, datalen) #define libssh2_md5_final(ctx, hash) \ _libssh2_mbedtls_hash_final(&ctx, hash) #define libssh2_md5(data, datalen, hash) \ _libssh2_mbedtls_hash(data, datalen, MBEDTLS_MD_MD5, hash) /*******************************************************************/ /* * mbedTLS backend: RSA structure */ #define libssh2_rsa_ctx mbedtls_rsa_context #define _libssh2_rsa_new(rsactx, e, e_len, n, n_len, \ d, d_len, p, p_len, q, q_len, \ e1, e1_len, e2, e2_len, c, c_len) \ _libssh2_mbedtls_rsa_new(rsactx, e, e_len, n, n_len, \ d, d_len, p, p_len, q, q_len, \ e1, e1_len, e2, e2_len, c, c_len) #define _libssh2_rsa_new_private(rsactx, s, filename, passphrase) \ _libssh2_mbedtls_rsa_new_private(rsactx, s, filename, passphrase) #define _libssh2_rsa_new_private_frommemory(rsactx, s, filedata, \ filedata_len, passphrase) \ _libssh2_mbedtls_rsa_new_private_frommemory(rsactx, s, filedata, \ filedata_len, passphrase) #define _libssh2_rsa_sha1_sign(s, rsactx, hash, hash_len, sig, sig_len) \ _libssh2_mbedtls_rsa_sha1_sign(s, rsactx, hash, hash_len, sig, sig_len) #define _libssh2_rsa_sha1_verify(rsactx, sig, sig_len, m, m_len) \ _libssh2_mbedtls_rsa_sha1_verify(rsactx, sig, sig_len, m, m_len) #define _libssh2_rsa_free(rsactx) \ _libssh2_mbedtls_rsa_free(rsactx) /* * mbedTLS backend: Key functions */ #define _libssh2_pub_priv_keyfile(s, m, m_len, p, p_len, pk, pw) \ _libssh2_mbedtls_pub_priv_keyfile(s, m, m_len, p, p_len, pk, pw) #define _libssh2_pub_priv_keyfilememory(s, m, m_len, p, p_len, \ pk, pk_len, pw) \ _libssh2_mbedtls_pub_priv_keyfilememory(s, m, m_len, p, p_len, \ pk, pk_len, pw) /*******************************************************************/ /* * mbedTLS backend: Cipher Context structure */ #define _libssh2_cipher_ctx mbedtls_cipher_context_t #define _libssh2_cipher_type(algo) mbedtls_cipher_type_t algo #define _libssh2_cipher_aes256ctr MBEDTLS_CIPHER_AES_256_CTR #define _libssh2_cipher_aes192ctr MBEDTLS_CIPHER_AES_192_CTR #define _libssh2_cipher_aes128ctr MBEDTLS_CIPHER_AES_128_CTR #define _libssh2_cipher_aes256 MBEDTLS_CIPHER_AES_256_CBC #define _libssh2_cipher_aes192 MBEDTLS_CIPHER_AES_192_CBC #define _libssh2_cipher_aes128 MBEDTLS_CIPHER_AES_128_CBC #define _libssh2_cipher_blowfish MBEDTLS_CIPHER_BLOWFISH_CBC #define _libssh2_cipher_arcfour MBEDTLS_CIPHER_ARC4_128 #define _libssh2_cipher_cast5 MBEDTLS_CIPHER_NULL #define _libssh2_cipher_3des MBEDTLS_CIPHER_DES_EDE3_CBC /* * mbedTLS backend: Cipher functions */ #define _libssh2_cipher_init(ctx, type, iv, secret, encrypt) \ _libssh2_mbedtls_cipher_init(ctx, type, iv, secret, encrypt) #define _libssh2_cipher_crypt(ctx, type, encrypt, block, blocklen) \ _libssh2_mbedtls_cipher_crypt(ctx, type, encrypt, block, blocklen) #define _libssh2_cipher_dtor(ctx) \ _libssh2_mbedtls_cipher_dtor(ctx) /*******************************************************************/ /* * mbedTLS backend: BigNumber Support */ #define _libssh2_bn_ctx int /* not used */ #define _libssh2_bn_ctx_new() 0 /* not used */ #define _libssh2_bn_ctx_free(bnctx) ((void)0) /* not used */ #define _libssh2_bn mbedtls_mpi #define _libssh2_bn_init() \ _libssh2_mbedtls_bignum_init() #define _libssh2_bn_init_from_bin() \ _libssh2_mbedtls_bignum_init() #define _libssh2_bn_set_word(bn, word) \ mbedtls_mpi_lset(bn, word) #define _libssh2_bn_from_bin(bn, len, bin) \ mbedtls_mpi_read_binary(bn, bin, len) #define _libssh2_bn_to_bin(bn, bin) \ mbedtls_mpi_write_binary(bn, bin, mbedtls_mpi_size(bn)) #define _libssh2_bn_bytes(bn) \ mbedtls_mpi_size(bn) #define _libssh2_bn_bits(bn) \ mbedtls_mpi_bitlen(bn) #define _libssh2_bn_free(bn) \ _libssh2_mbedtls_bignum_free(bn) /*******************************************************************/ /* * mbedTLS backend: Diffie-Hellman support. */ #define _libssh2_dh_ctx mbedtls_mpi * #define libssh2_dh_init(dhctx) _libssh2_dh_init(dhctx) #define libssh2_dh_key_pair(dhctx, public, g, p, group_order, bnctx) \ _libssh2_dh_key_pair(dhctx, public, g, p, group_order) #define libssh2_dh_secret(dhctx, secret, f, p, bnctx) \ _libssh2_dh_secret(dhctx, secret, f, p) #define libssh2_dh_dtor(dhctx) _libssh2_dh_dtor(dhctx) /*******************************************************************/ /* * mbedTLS backend: forward declarations */ void _libssh2_mbedtls_init(void); void _libssh2_mbedtls_free(void); int _libssh2_mbedtls_random(unsigned char *buf, int len); int _libssh2_mbedtls_cipher_init(_libssh2_cipher_ctx *ctx, _libssh2_cipher_type(type), unsigned char *iv, unsigned char *secret, int encrypt); int _libssh2_mbedtls_cipher_crypt(_libssh2_cipher_ctx *ctx, _libssh2_cipher_type(type), int encrypt, unsigned char *block, size_t blocklen); void _libssh2_mbedtls_cipher_dtor(_libssh2_cipher_ctx *ctx); int _libssh2_mbedtls_hash_init(mbedtls_md_context_t *ctx, mbedtls_md_type_t mdtype, const unsigned char *key, unsigned long keylen); int _libssh2_mbedtls_hash_final(mbedtls_md_context_t *ctx, unsigned char *hash); int _libssh2_mbedtls_hash(const unsigned char *data, unsigned long datalen, mbedtls_md_type_t mdtype, unsigned char *hash); _libssh2_bn * _libssh2_mbedtls_bignum_init(void); void _libssh2_mbedtls_bignum_free(_libssh2_bn *bn); int _libssh2_mbedtls_rsa_new(libssh2_rsa_ctx **rsa, const unsigned char *edata, unsigned long elen, const unsigned char *ndata, unsigned long nlen, const unsigned char *ddata, unsigned long dlen, const unsigned char *pdata, unsigned long plen, const unsigned char *qdata, unsigned long qlen, const unsigned char *e1data, unsigned long e1len, const unsigned char *e2data, unsigned long e2len, const unsigned char *coeffdata, unsigned long coefflen); int _libssh2_mbedtls_rsa_new_private(libssh2_rsa_ctx **rsa, LIBSSH2_SESSION *session, const char *filename, const unsigned char *passphrase); int _libssh2_mbedtls_rsa_new_private_frommemory(libssh2_rsa_ctx **rsa, LIBSSH2_SESSION *session, const char *filedata, size_t filedata_len, unsigned const char *passphrase); int _libssh2_mbedtls_rsa_sha1_verify(libssh2_rsa_ctx *rsa, const unsigned char *sig, unsigned long sig_len, const unsigned char *m, unsigned long m_len); int _libssh2_mbedtls_rsa_sha1_sign(LIBSSH2_SESSION *session, libssh2_rsa_ctx *rsa, const unsigned char *hash, size_t hash_len, unsigned char **signature, size_t *signature_len); void _libssh2_mbedtls_rsa_free(libssh2_rsa_ctx *rsa); int _libssh2_mbedtls_pub_priv_keyfile(LIBSSH2_SESSION *session, unsigned char **method, size_t *method_len, unsigned char **pubkeydata, size_t *pubkeydata_len, const char *privatekey, const char *passphrase); int _libssh2_mbedtls_pub_priv_keyfilememory(LIBSSH2_SESSION *session, unsigned char **method, size_t *method_len, unsigned char **pubkeydata, size_t *pubkeydata_len, const char *privatekeydata, size_t privatekeydata_len, const char *passphrase); extern void _libssh2_dh_init(_libssh2_dh_ctx *dhctx); extern int _libssh2_dh_key_pair(_libssh2_dh_ctx *dhctx, _libssh2_bn *public, _libssh2_bn *g, _libssh2_bn *p, int group_order); extern int _libssh2_dh_secret(_libssh2_dh_ctx *dhctx, _libssh2_bn *secret, _libssh2_bn *f, _libssh2_bn *p); extern void _libssh2_dh_dtor(_libssh2_dh_ctx *dhctx);
16,156
C++
.h
372
36.258065
76
0.610605
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
15,253
os400qc3.h
Studio3T_robomongo/src/third-party/libssh2-1.9.0/sources/src/os400qc3.h
/* * Copyright (C) 2015-2016 Patrick Monnerat, D+H <patrick.monnerat@dh.com> * All rights reserved. * * Redistribution and use in source and binary forms, * with or without modification, are permitted provided * that the following conditions are met: * * Redistributions of source code must retain the above * copyright notice, this list of conditions and the * following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the copyright holder nor the names * of any other contributors may be used to endorse or * promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. */ #ifndef LIBSSH2_OS400QC3_H #define LIBSSH2_OS400QC3_H #include <stdlib.h> #include <string.h> #include <qc3cci.h> /* Redefine character/string literals as always EBCDIC. */ #undef Qc3_Alg_Token #define Qc3_Alg_Token "\xC1\xD3\xC7\xC4\xF0\xF1\xF0\xF0" /* ALGD0100 */ #undef Qc3_Alg_Block_Cipher #define Qc3_Alg_Block_Cipher "\xC1\xD3\xC7\xC4\xF0\xF2\xF0\xF0" /* ALGD0200 */ #undef Qc3_Alg_Block_CipherAuth #define Qc3_Alg_Block_CipherAuth \ "\xC1\xD3\xC7\xC4\xF0\xF2\xF1\xF0" /* ALGD0210 */ #undef Qc3_Alg_Stream_Cipher #define Qc3_Alg_Stream_Cipher \ "\xC1\xD3\xC7\xC4\xF0\xF3\xF0\xF0" /* ALGD0300 */ #undef Qc3_Alg_Public_Key #define Qc3_Alg_Public_Key "\xC1\xD3\xC7\xC4\xF0\xF4\xF0\xF0" /* ALGD0400 */ #undef Qc3_Alg_Hash #define Qc3_Alg_Hash "\xC1\xD3\xC7\xC4\xF0\xF5\xF0\xF0" /* ALGD0500 */ #undef Qc3_Data #define Qc3_Data "\xC4\xC1\xE3\xC1\xF0\xF1\xF0\xF0" /* DATA0100 */ #undef Qc3_Array #define Qc3_Array "\xC4\xC1\xE3\xC1\xF0\xF2\xF0\xF0" /* DATA0200 */ #undef Qc3_Key_Token #define Qc3_Key_Token "\xD2\xC5\xE8\xC4\xF0\xF1\xF0\xF0" /* KEYD0100 */ #undef Qc3_Key_Parms #define Qc3_Key_Parms "\xD2\xC5\xE8\xC4\xF0\xF2\xF0\xF0" /* KEYD0200 */ #undef Qc3_Key_KSLabel #define Qc3_Key_KSLabel "\xD2\xC5\xE8\xC4\xF0\xF4\xF0\xF0" /* KEYD0400 */ #undef Qc3_Key_PKCS5 #define Qc3_Key_PKCS5 "\xD2\xC5\xE8\xC4\xF0\xF5\xF0\xF0" /* KEYD0500 */ #undef Qc3_Key_PEMCert #define Qc3_Key_PEMCert "\xD2\xC5\xE8\xC4\xF0\xF6\xF0\xF0" /* KEYD0600 */ #undef Qc3_Key_CSLabel #define Qc3_Key_CSLabel "\xD2\xC5\xE8\xC4\xF0\xF7\xF0\xF0" /* KEYD0700 */ #undef Qc3_Key_CSDN #define Qc3_Key_CSDN "\xD2\xC5\xE8\xC4\xF0\xF8\xF0\xF0" /* KEYD0800 */ #undef Qc3_Key_AppID #define Qc3_Key_AppID "\xD2\xC5\xE8\xC4\xF0\xF9\xF0\xF0" /* KEYD0900 */ #undef Qc3_ECB #define Qc3_ECB '\xF0' /* '0' */ #undef Qc3_CBC #define Qc3_CBC '\xF1' /* '1' */ #undef Qc3_OFB #define Qc3_OFB '\xF2' /* '2' */ #undef Qc3_CFB1Bit #define Qc3_CFB1Bit '\xF3' /* '3' */ #undef Qc3_CFB8Bit #define Qc3_CFB8Bit '\xF4' /* '4' */ #undef Qc3_CFB64Bit #define Qc3_CFB64Bit '\xF5' /* '5' */ #undef Qc3_CUSP #define Qc3_CUSP '\xF6' /* '6' */ #undef Qc3_CTR #define Qc3_CTR '\xF7' /* '7' */ #undef Qc3_CCM #define Qc3_CCM '\xF8' /* '8' */ #undef Qc3_No_Pad #define Qc3_No_Pad '\xF0' /* '0' */ #undef Qc3_Pad_Char #define Qc3_Pad_Char '\xF1' /* '1' */ #undef Qc3_Pad_Counter #define Qc3_Pad_Counter '\xF2' /* '2' */ #undef Qc3_PKCS1_00 #define Qc3_PKCS1_00 '\xF0' /* '0' */ #undef Qc3_PKCS1_01 #define Qc3_PKCS1_01 '\xF1' /* '1' */ #undef Qc3_PKCS1_02 #define Qc3_PKCS1_02 '\xF2' /* '2' */ #undef Qc3_ISO9796 #define Qc3_ISO9796 '\xF3' /* '3' */ #undef Qc3_Zero_Pad #define Qc3_Zero_Pad '\xF4' /* '4' */ #undef Qc3_ANSI_X931 #define Qc3_ANSI_X931 '\xF5' /* '5' */ #undef Qc3_OAEP #define Qc3_OAEP '\xF6' /* '6' */ #undef Qc3_Bin_String #define Qc3_Bin_String '\xF0' /* '0' */ #undef Qc3_BER_String #define Qc3_BER_String '\xF1' /* '1' */ #undef Qc3_MK_Struct #define Qc3_MK_Struct '\xF3' /* '3' */ #undef Qc3_KSLabel_Struct #define Qc3_KSLabel_Struct '\xF4' /* '4' */ #undef Qc3_PKCS5_Struct #define Qc3_PKCS5_Struct '\xF5' /* '5' */ #undef Qc3_PEMCert_String #define Qc3_PEMCert_String '\xF6' /* '6' */ #undef Qc3_CSLabel_String #define Qc3_CSLabel_String '\xF7' /* '7' */ #undef Qc3_CSDN_String #define Qc3_CSDN_String '\xF8' /* '8' */ #undef Qc3_Clear #define Qc3_Clear '\xF0' /* '0' */ #undef Qc3_Encrypted #define Qc3_Encrypted '\xF1' /* '1' */ #undef Qc3_MK_Encrypted #define Qc3_MK_Encrypted '\xF2' /* '2' */ #undef Qc3_Any_CSP #define Qc3_Any_CSP '\xF0' /* '0' */ #undef Qc3_Sfw_CSP #define Qc3_Sfw_CSP '\xF1' /* '1' */ #undef Qc3_Hdw_CSP #define Qc3_Hdw_CSP '\xF2' /* '2' */ #undef Qc3_Continue #define Qc3_Continue '\xF0' /* '0' */ #undef Qc3_Final #define Qc3_Final '\xF1' /* '1' */ #undef Qc3_MK_New #define Qc3_MK_New '\xF0' /* '0' */ #undef Qc3_MK_Current #define Qc3_MK_Current '\xF1' /* '1' */ #undef Qc3_MK_Old #define Qc3_MK_Old '\xF2' /* '2' */ #undef Qc3_MK_Pending #define Qc3_MK_Pending '\xF3' /* '3' */ /* Define which features are supported. */ #define LIBSSH2_MD5 1 #define LIBSSH2_HMAC_RIPEMD 0 #define LIBSSH2_HMAC_SHA256 1 #define LIBSSH2_HMAC_SHA512 1 #define LIBSSH2_AES 1 #define LIBSSH2_AES_CTR 1 #define LIBSSH2_BLOWFISH 0 #define LIBSSH2_RC4 1 #define LIBSSH2_CAST 0 #define LIBSSH2_3DES 1 #define LIBSSH2_RSA 1 #define LIBSSH2_DSA 0 #define MD5_DIGEST_LENGTH 16 #define SHA_DIGEST_LENGTH 20 #define SHA256_DIGEST_LENGTH 32 #define SHA512_DIGEST_LENGTH 64 /******************************************************************* * * OS/400 QC3 crypto-library backend: global handles structures. * *******************************************************************/ /* HMAC & private key algorithms support structure. */ typedef struct _libssh2_os400qc3_crypto_ctx _libssh2_os400qc3_crypto_ctx; struct _libssh2_os400qc3_crypto_ctx { Qc3_Format_ALGD0100_T hash; /* Hash algorithm. */ Qc3_Format_KEYD0100_T key; /* Key. */ _libssh2_os400qc3_crypto_ctx * kek; /* Key encryption. */ }; typedef struct { /* Big number. */ unsigned char * bignum; /* Number bits, little-endian. */ unsigned int length; /* Length of bignum (# bytes). */ } _libssh2_bn; typedef struct { /* Algorithm description. */ char * fmt; /* Format of Qc3 structure. */ int algo; /* Algorithm identifier. */ unsigned char size; /* Block length. */ unsigned char mode; /* Block mode. */ int keylen; /* Key length. */ } _libssh2_os400qc3_cipher_t; typedef struct { /* Diffie-Hellman context. */ char token[8]; /* Context token. */ } _libssh2_os400qc3_dh_ctx; /******************************************************************* * * OS/400 QC3 crypto-library backend: Define global types/codes. * *******************************************************************/ #define libssh2_crypto_init() #define libssh2_crypto_exit() #define libssh2_sha1_ctx Qc3_Format_ALGD0100_T #define libssh2_sha256_ctx Qc3_Format_ALGD0100_T #define libssh2_md5_ctx Qc3_Format_ALGD0100_T #define libssh2_hmac_ctx _libssh2_os400qc3_crypto_ctx #define _libssh2_cipher_ctx _libssh2_os400qc3_crypto_ctx #define libssh2_sha1_init(x) libssh2_os400qc3_hash_init(x, Qc3_SHA1) #define libssh2_sha1_update(ctx, data, len) \ libssh2_os400qc3_hash_update(&(ctx), data, len) #define libssh2_sha1_final(ctx, out) \ libssh2_os400qc3_hash_final(&(ctx), out) #define libssh2_sha256_init(x) libssh2_os400qc3_hash_init(x, Qc3_SHA256) #define libssh2_sha256_update(ctx, data, len) \ libssh2_os400qc3_hash_update(&(ctx), data, len) #define libssh2_sha256_final(ctx, out) \ libssh2_os400qc3_hash_final(&(ctx), out) #define libssh2_sha256(message, len, out) \ libssh2_os400qc3_hash(message, len, out, \ Qc3_SHA256) #define libssh2_md5_init(x) libssh2_os400qc3_hash_init(x, Qc3_MD5) #define libssh2_md5_update(ctx, data, len) \ libssh2_os400qc3_hash_update(&(ctx), data, len) #define libssh2_md5_final(ctx, out) \ libssh2_os400qc3_hash_final(&(ctx), out) #define libssh2_hmac_ctx_init(ctx) \ memset((char *) &(ctx), 0, \ sizeof(libssh2_hmac_ctx)) #define libssh2_hmac_md5_init(ctx, key, keylen) \ libssh2_os400qc3_hmac_init(ctx, Qc3_MD5, \ MD5_DIGEST_LENGTH, \ key, keylen) #define libssh2_hmac_sha1_init(ctx, key, keylen) \ libssh2_os400qc3_hmac_init(ctx, Qc3_SHA1, \ SHA_DIGEST_LENGTH, \ key, keylen) #define libssh2_hmac_sha256_init(ctx, key, keylen) \ libssh2_os400qc3_hmac_init(ctx, Qc3_SHA256, \ SHA256_DIGEST_LENGTH, \ key, keylen) #define libssh2_hmac_sha512_init(ctx, key, keylen) \ libssh2_os400qc3_hmac_init(ctx, Qc3_SHA512, \ SHA512_DIGEST_LENGTH, \ key, keylen) #define libssh2_hmac_update(ctx, data, datalen) \ libssh2_os400qc3_hmac_update(&(ctx), \ data, datalen) #define libssh2_hmac_final(ctx, data) \ libssh2_os400qc3_hmac_final(&(ctx), data) #define libssh2_hmac_cleanup(ctx) \ _libssh2_os400qc3_crypto_dtor(ctx) #define _libssh2_bn_ctx int /* Not used. */ #define _libssh2_bn_ctx_new() 0 #define _libssh2_bn_ctx_free(bnctx) ((void) 0) #define _libssh2_bn_init_from_bin() _libssh2_bn_init() #define _libssh2_bn_bytes(bn) ((bn)->length) #define _libssh2_cipher_type(name) _libssh2_os400qc3_cipher_t name #define _libssh2_cipher_aes128 {Qc3_Alg_Block_Cipher, Qc3_AES, 16, \ Qc3_CBC, 16} #define _libssh2_cipher_aes192 {Qc3_Alg_Block_Cipher, Qc3_AES, 24, \ Qc3_CBC, 24} #define _libssh2_cipher_aes256 {Qc3_Alg_Block_Cipher, Qc3_AES, 32, \ Qc3_CBC, 32} #define _libssh2_cipher_aes128ctr {Qc3_Alg_Block_Cipher, Qc3_AES, 16, \ Qc3_CTR, 16} #define _libssh2_cipher_aes192ctr {Qc3_Alg_Block_Cipher, Qc3_AES, 24, \ Qc3_CTR, 24} #define _libssh2_cipher_aes256ctr {Qc3_Alg_Block_Cipher, Qc3_AES, 32, \ Qc3_CTR, 32} #define _libssh2_cipher_3des {Qc3_Alg_Block_Cipher, Qc3_TDES, 0, \ Qc3_CBC, 24} #define _libssh2_cipher_arcfour {Qc3_Alg_Stream_Cipher, Qc3_RC4, 0, 0, 16} #define _libssh2_cipher_dtor(ctx) _libssh2_os400qc3_crypto_dtor(ctx) #define libssh2_rsa_ctx _libssh2_os400qc3_crypto_ctx #define _libssh2_rsa_free(ctx) (_libssh2_os400qc3_crypto_dtor(ctx), \ free((char *) ctx)) #define libssh2_prepare_iovec(vec, len) memset((char *) (vec), 0, \ (len) * sizeof(struct iovec)) #define _libssh2_rsa_sha1_signv(session, sig, siglen, count, vector, ctx) \ _libssh2_os400qc3_rsa_sha1_signv(session, sig, siglen, \ count, vector, ctx) #define _libssh2_dh_ctx _libssh2_os400qc3_dh_ctx #define libssh2_dh_init(dhctx) _libssh2_os400qc3_dh_init(dhctx) #define libssh2_dh_key_pair(dhctx, public, g, p, group_order, bnctx) \ _libssh2_os400qc3_dh_key_pair(dhctx, public, g, p, group_order) #define libssh2_dh_secret(dhctx, secret, f, p, bnctx) \ _libssh2_os400qc3_dh_secret(dhctx, secret, f, p) #define libssh2_dh_dtor(dhctx) _libssh2_os400qc3_dh_dtor(dhctx) /******************************************************************* * * OS/400 QC3 crypto-library backend: Support procedure prototypes. * *******************************************************************/ extern _libssh2_bn * _libssh2_bn_init(void); extern void _libssh2_bn_free(_libssh2_bn *bn); extern unsigned long _libssh2_bn_bits(_libssh2_bn *bn); extern int _libssh2_bn_from_bin(_libssh2_bn *bn, int len, const unsigned char *v); extern int _libssh2_bn_set_word(_libssh2_bn *bn, unsigned long val); extern int _libssh2_bn_to_bin(_libssh2_bn *bn, unsigned char *val); extern void _libssh2_random(unsigned char *buf, int len); extern void _libssh2_os400qc3_crypto_dtor(_libssh2_os400qc3_crypto_ctx *x); extern int libssh2_os400qc3_hash_init(Qc3_Format_ALGD0100_T *x, unsigned int algo); extern void libssh2_os400qc3_hash_update(Qc3_Format_ALGD0100_T *ctx, unsigned char *data, int len); extern void libssh2_os400qc3_hash_final(Qc3_Format_ALGD0100_T *ctx, unsigned char *out); extern int libssh2_os400qc3_hash(const unsigned char *message, unsigned long len, unsigned char *out, unsigned int algo); extern void libssh2_os400qc3_hmac_init(_libssh2_os400qc3_crypto_ctx *x, int algo, size_t minkeylen, void *key, int keylen); extern void libssh2_os400qc3_hmac_update(_libssh2_os400qc3_crypto_ctx *ctx, const unsigned char *data, int len); extern void libssh2_os400qc3_hmac_final(_libssh2_os400qc3_crypto_ctx *ctx, unsigned char *out); extern int _libssh2_os400qc3_rsa_sha1_signv(LIBSSH2_SESSION *session, unsigned char **signature, size_t *signature_len, int veccount, const struct iovec vector[], libssh2_rsa_ctx *ctx); extern void _libssh2_os400qc3_dh_init(_libssh2_dh_ctx *dhctx); extern int _libssh2_os400qc3_dh_key_pair(_libssh2_dh_ctx *dhctx, _libssh2_bn *public, _libssh2_bn *g, _libssh2_bn *p, int group_order); extern int _libssh2_os400qc3_dh_secret(_libssh2_dh_ctx *dhctx, _libssh2_bn *secret, _libssh2_bn *f, _libssh2_bn *p); extern void _libssh2_os400qc3_dh_dtor(_libssh2_dh_ctx *dhctx); #endif /* vim: set expandtab ts=4 sw=4: */
17,387
C++
.h
339
43.893805
79
0.538556
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,254
misc.h
Studio3T_robomongo/src/third-party/libssh2-1.9.0/sources/src/misc.h
#ifndef __LIBSSH2_MISC_H #define __LIBSSH2_MISC_H /* Copyright (c) 2009-2019 by Daniel Stenberg * * All rights reserved. * * Redistribution and use in source and binary forms, * with or without modification, are permitted provided * that the following conditions are met: * * Redistributions of source code must retain the above * copyright notice, this list of conditions and the * following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the copyright holder nor the names * of any other contributors may be used to endorse or * promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. */ struct list_head { struct list_node *last; struct list_node *first; }; struct list_node { struct list_node *next; struct list_node *prev; struct list_head *head; }; struct string_buf { unsigned char *data; unsigned char *dataptr; size_t len; }; int _libssh2_error_flags(LIBSSH2_SESSION* session, int errcode, const char *errmsg, int errflags); int _libssh2_error(LIBSSH2_SESSION* session, int errcode, const char *errmsg); void _libssh2_list_init(struct list_head *head); /* add a node last in the list */ void _libssh2_list_add(struct list_head *head, struct list_node *entry); /* return the "first" node in the list this head points to */ void *_libssh2_list_first(struct list_head *head); /* return the next node in the list */ void *_libssh2_list_next(struct list_node *node); /* return the prev node in the list */ void *_libssh2_list_prev(struct list_node *node); /* remove this node from the list */ void _libssh2_list_remove(struct list_node *entry); size_t _libssh2_base64_encode(LIBSSH2_SESSION *session, const char *inp, size_t insize, char **outptr); unsigned int _libssh2_ntohu32(const unsigned char *buf); libssh2_uint64_t _libssh2_ntohu64(const unsigned char *buf); void _libssh2_htonu32(unsigned char *buf, uint32_t val); void _libssh2_store_u32(unsigned char **buf, uint32_t value); void _libssh2_store_str(unsigned char **buf, const char *str, size_t len); void *_libssh2_calloc(LIBSSH2_SESSION *session, size_t size); void _libssh2_explicit_zero(void *buf, size_t size); struct string_buf* _libssh2_string_buf_new(LIBSSH2_SESSION *session); void _libssh2_string_buf_free(LIBSSH2_SESSION *session, struct string_buf *buf); int _libssh2_get_u32(struct string_buf *buf, uint32_t *out); int _libssh2_get_u64(struct string_buf *buf, libssh2_uint64_t *out); int _libssh2_match_string(struct string_buf *buf, const char *match); int _libssh2_get_string(struct string_buf *buf, unsigned char **outbuf, size_t *outlen); int _libssh2_copy_string(LIBSSH2_SESSION* session, struct string_buf *buf, unsigned char **outbuf, size_t *outlen); int _libssh2_get_bignum_bytes(struct string_buf *buf, unsigned char **outbuf, size_t *outlen); int _libssh2_check_length(struct string_buf *buf, size_t requested_len); #if defined(LIBSSH2_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__) /* provide a private one */ #undef HAVE_GETTIMEOFDAY int __cdecl _libssh2_gettimeofday(struct timeval *tp, void *tzp); #define HAVE_LIBSSH2_GETTIMEOFDAY #define LIBSSH2_GETTIMEOFDAY_WIN32 /* enable the win32 implementation */ #else #ifdef HAVE_GETTIMEOFDAY #define _libssh2_gettimeofday(x,y) gettimeofday(x,y) #define HAVE_LIBSSH2_GETTIMEOFDAY #endif #endif void _libssh2_xor_data(unsigned char *output, const unsigned char *input1, const unsigned char *input2, size_t length); void _libssh2_aes_ctr_increment(unsigned char *ctr, size_t length); #endif /* _LIBSSH2_MISC_H */
4,838
C++
.h
108
40.638889
78
0.720348
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
15,255
packet.h
Studio3T_robomongo/src/third-party/libssh2-1.9.0/sources/src/packet.h
#ifndef LIBSSH2_PACKET_H #define LIBSSH2_PACKET_H /* * Copyright (C) 2010 by Daniel Stenberg * Author: Daniel Stenberg <daniel@haxx.se> * * Redistribution and use in source and binary forms, * with or without modification, are permitted provided * that the following conditions are met: * * Redistributions of source code must retain the above * copyright notice, this list of conditions and the * following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the copyright holder nor the names * of any other contributors may be used to endorse or * promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * */ int _libssh2_packet_read(LIBSSH2_SESSION * session); int _libssh2_packet_ask(LIBSSH2_SESSION * session, unsigned char packet_type, unsigned char **data, size_t *data_len, int match_ofs, const unsigned char *match_buf, size_t match_len); int _libssh2_packet_askv(LIBSSH2_SESSION * session, const unsigned char *packet_types, unsigned char **data, size_t *data_len, int match_ofs, const unsigned char *match_buf, size_t match_len); int _libssh2_packet_require(LIBSSH2_SESSION * session, unsigned char packet_type, unsigned char **data, size_t *data_len, int match_ofs, const unsigned char *match_buf, size_t match_len, packet_require_state_t * state); int _libssh2_packet_requirev(LIBSSH2_SESSION *session, const unsigned char *packet_types, unsigned char **data, size_t *data_len, int match_ofs, const unsigned char *match_buf, size_t match_len, packet_requirev_state_t * state); int _libssh2_packet_burn(LIBSSH2_SESSION * session, libssh2_nonblocking_states * state); int _libssh2_packet_write(LIBSSH2_SESSION * session, unsigned char *data, unsigned long data_len); int _libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data, size_t datalen, int macstate); #endif /* LIBSSH2_PACKET_H */
3,500
C++
.h
72
38.569444
77
0.638435
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
15,256
sftp.h
Studio3T_robomongo/src/third-party/libssh2-1.9.0/sources/src/sftp.h
#ifndef _LIBSSH2_SFTP_H #define _LIBSSH2_SFTP_H /* * Copyright (C) 2010 - 2012 by Daniel Stenberg * Author: Daniel Stenberg <daniel@haxx.se> * * Redistribution and use in source and binary forms, * with or without modification, are permitted provided * that the following conditions are met: * * Redistributions of source code must retain the above * copyright notice, this list of conditions and the * following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the copyright holder nor the names * of any other contributors may be used to endorse or * promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * */ /* * MAX_SFTP_OUTGOING_SIZE MUST not be larger than 32500 or so. This is the * amount of data sent in each FXP_WRITE packet */ #define MAX_SFTP_OUTGOING_SIZE 30000 /* MAX_SFTP_READ_SIZE is how much data is asked for at max in each FXP_READ * packets. */ #define MAX_SFTP_READ_SIZE 30000 struct sftp_pipeline_chunk { struct list_node node; libssh2_uint64_t offset; /* READ: offset at which to start reading WRITE: not used */ size_t len; /* WRITE: size of the data to write READ: how many bytes that was asked for */ size_t sent; ssize_t lefttosend; /* if 0, the entire packet has been sent off */ uint32_t request_id; unsigned char packet[1]; /* data */ }; struct sftp_zombie_requests { struct list_node node; uint32_t request_id; }; #ifndef MIN #define MIN(x,y) ((x)<(y)?(x):(y)) #endif struct _LIBSSH2_SFTP_PACKET { struct list_node node; /* linked list header */ uint32_t request_id; unsigned char *data; size_t data_len; /* payload size */ }; typedef struct _LIBSSH2_SFTP_PACKET LIBSSH2_SFTP_PACKET; #define SFTP_HANDLE_MAXLEN 256 /* according to spec! */ struct _LIBSSH2_SFTP_HANDLE { struct list_node node; LIBSSH2_SFTP *sftp; char handle[SFTP_HANDLE_MAXLEN]; size_t handle_len; enum { LIBSSH2_SFTP_HANDLE_FILE, LIBSSH2_SFTP_HANDLE_DIR } handle_type; union _libssh2_sftp_handle_data { struct _libssh2_sftp_handle_file_data { libssh2_uint64_t offset; libssh2_uint64_t offset_sent; size_t acked; /* container for acked data that hasn't been returned to caller yet, used for sftp_write */ /* 'data' is used by sftp_read() and is allocated data that has been received already from the server but wasn't returned to the caller yet. It is of size 'data_len' and 'data_left is the number of bytes not yet returned, counted from the end of the buffer. */ unsigned char *data; size_t data_len; size_t data_left; char eof; /* we have read to the end */ } file; struct _libssh2_sftp_handle_dir_data { uint32_t names_left; void *names_packet; char *next_name; size_t names_packet_len; } dir; } u; /* State variables used in libssh2_sftp_close_handle() */ libssh2_nonblocking_states close_state; uint32_t close_request_id; unsigned char *close_packet; /* list of outstanding packets sent to server */ struct list_head packet_list; }; struct _LIBSSH2_SFTP { LIBSSH2_CHANNEL *channel; uint32_t request_id, version; struct list_head packets; /* List of FXP_READ responses to ignore because EOF already received. */ struct list_head zombie_requests; /* a list of _LIBSSH2_SFTP_HANDLE structs */ struct list_head sftp_handles; uint32_t last_errno; /* Holder for partial packet, use in libssh2_sftp_packet_read() */ unsigned char partial_size[4]; /* buffer for size field */ size_t partial_size_len; /* size field length */ unsigned char *partial_packet; /* The data */ uint32_t partial_len; /* Desired number of bytes */ size_t partial_received; /* Bytes received so far */ /* Time that libssh2_sftp_packet_requirev() started reading */ time_t requirev_start; /* State variables used in libssh2_sftp_open_ex() */ libssh2_nonblocking_states open_state; unsigned char *open_packet; uint32_t open_packet_len; /* 32 bit on the wire */ size_t open_packet_sent; uint32_t open_request_id; /* State variable used in sftp_read() */ libssh2_nonblocking_states read_state; /* State variable used in sftp_packet_read() */ libssh2_nonblocking_states packet_state; /* State variable used in sftp_write() */ libssh2_nonblocking_states write_state; /* State variables used in sftp_fsync() */ libssh2_nonblocking_states fsync_state; unsigned char *fsync_packet; uint32_t fsync_request_id; /* State variables used in libssh2_sftp_readdir() */ libssh2_nonblocking_states readdir_state; unsigned char *readdir_packet; uint32_t readdir_request_id; /* State variables used in libssh2_sftp_fstat_ex() */ libssh2_nonblocking_states fstat_state; unsigned char *fstat_packet; uint32_t fstat_request_id; /* State variables used in libssh2_sftp_unlink_ex() */ libssh2_nonblocking_states unlink_state; unsigned char *unlink_packet; uint32_t unlink_request_id; /* State variables used in libssh2_sftp_rename_ex() */ libssh2_nonblocking_states rename_state; unsigned char *rename_packet; unsigned char *rename_s; uint32_t rename_request_id; /* State variables used in libssh2_sftp_fstatvfs() */ libssh2_nonblocking_states fstatvfs_state; unsigned char *fstatvfs_packet; uint32_t fstatvfs_request_id; /* State variables used in libssh2_sftp_statvfs() */ libssh2_nonblocking_states statvfs_state; unsigned char *statvfs_packet; uint32_t statvfs_request_id; /* State variables used in libssh2_sftp_mkdir() */ libssh2_nonblocking_states mkdir_state; unsigned char *mkdir_packet; uint32_t mkdir_request_id; /* State variables used in libssh2_sftp_rmdir() */ libssh2_nonblocking_states rmdir_state; unsigned char *rmdir_packet; uint32_t rmdir_request_id; /* State variables used in libssh2_sftp_stat() */ libssh2_nonblocking_states stat_state; unsigned char *stat_packet; uint32_t stat_request_id; /* State variables used in libssh2_sftp_symlink() */ libssh2_nonblocking_states symlink_state; unsigned char *symlink_packet; uint32_t symlink_request_id; }; #endif
7,690
C++
.h
196
33.969388
77
0.685856
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
15,257
userauth.h
Studio3T_robomongo/src/third-party/libssh2-1.9.0/sources/src/userauth.h
#ifndef LIBSSH2_USERAUTH_H #define LIBSSH2_USERAUTH_H /* Copyright (c) 2004-2007, Sara Golemon <sarag@libssh2.org> * Copyright (c) 2009-2010 by Daniel Stenberg * All rights reserved. * * Redistribution and use in source and binary forms, * with or without modification, are permitted provided * that the following conditions are met: * * Redistributions of source code must retain the above * copyright notice, this list of conditions and the * following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the copyright holder nor the names * of any other contributors may be used to endorse or * promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. */ int _libssh2_userauth_publickey(LIBSSH2_SESSION *session, const char *username, unsigned int username_len, const unsigned char *pubkeydata, unsigned long pubkeydata_len, LIBSSH2_USERAUTH_PUBLICKEY_SIGN_FUNC ((*sign_callback)), void *abstract); #endif /* LIBSSH2_USERAUTH_H */
2,204
C++
.h
49
39.204082
64
0.708778
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
15,258
libssh2_priv.h
Studio3T_robomongo/src/third-party/libssh2-1.9.0/sources/src/libssh2_priv.h
/* Copyright (c) 2004-2008, 2010, Sara Golemon <sarag@libssh2.org> * Copyright (c) 2009-2014 by Daniel Stenberg * Copyright (c) 2010 Simon Josefsson * All rights reserved. * * Redistribution and use in source and binary forms, * with or without modification, are permitted provided * that the following conditions are met: * * Redistributions of source code must retain the above * copyright notice, this list of conditions and the * following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the copyright holder nor the names * of any other contributors may be used to endorse or * promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. */ #ifndef LIBSSH2_PRIV_H #define LIBSSH2_PRIV_H 1 #define LIBSSH2_LIBRARY #include "libssh2_config.h" #ifdef HAVE_WINDOWS_H #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif #include <windows.h> #undef WIN32_LEAN_AND_MEAN #endif #ifdef HAVE_WS2TCPIP_H #include <ws2tcpip.h> #endif #include <stdio.h> #include <time.h> /* The following CPP block should really only be in session.c and packet.c. However, AIX have #define's for 'events' and 'revents' and we are using those names in libssh2.h, so we need to include the AIX headers first, to make sure all code is compiled with consistent names of these fields. While arguable the best would to change libssh2.h to use other names, that would break backwards compatibility. */ #ifdef HAVE_POLL # include <poll.h> #else # if defined(HAVE_SELECT) && !defined(WIN32) # ifdef HAVE_SYS_SELECT_H # include <sys/select.h> # else # include <sys/time.h> # include <sys/types.h> # endif # endif #endif /* Needed for struct iovec on some platforms */ #ifdef HAVE_SYS_UIO_H #include <sys/uio.h> #endif #ifdef HAVE_SYS_SOCKET_H # include <sys/socket.h> #endif #ifdef HAVE_SYS_IOCTL_H # include <sys/ioctl.h> #endif #ifdef HAVE_INTTYPES_H #include <inttypes.h> #endif #include "libssh2.h" #include "libssh2_publickey.h" #include "libssh2_sftp.h" #include "misc.h" /* for the linked list stuff */ #ifndef FALSE #define FALSE 0 #endif #ifndef TRUE #define TRUE 1 #endif #ifdef _MSC_VER /* "inline" keyword is valid only with C++ engine! */ #define inline __inline #endif /* Provide iovec / writev on WIN32 platform. */ #ifdef WIN32 struct iovec { size_t iov_len; void *iov_base; }; static inline int writev(int sock, struct iovec *iov, int nvecs) { DWORD ret; if(WSASend(sock, (LPWSABUF)iov, nvecs, &ret, 0, NULL, NULL) == 0) { return ret; } return -1; } #endif /* WIN32 */ #ifdef __OS400__ /* Force parameter type. */ #define send(s, b, l, f) send((s), (unsigned char *) (b), (l), (f)) #endif #include "crypto.h" #ifdef HAVE_WINSOCK2_H #include <winsock2.h> #include <ws2tcpip.h> #endif #ifndef SIZE_MAX #if _WIN64 #define SIZE_MAX 0xFFFFFFFFFFFFFFFF #else #define SIZE_MAX 0xFFFFFFFF #endif #endif #ifndef UINT_MAX #define UINT_MAX 0xFFFFFFFF #endif /* RFC4253 section 6.1 Maximum Packet Length says: * * "All implementations MUST be able to process packets with * uncompressed payload length of 32768 bytes or less and * total packet size of 35000 bytes or less (including length, * padding length, payload, padding, and MAC.)." */ #define MAX_SSH_PACKET_LEN 35000 #define MAX_SHA_DIGEST_LEN SHA512_DIGEST_LENGTH #define LIBSSH2_ALLOC(session, count) \ session->alloc((count), &(session)->abstract) #define LIBSSH2_CALLOC(session, count) _libssh2_calloc(session, count) #define LIBSSH2_REALLOC(session, ptr, count) \ ((ptr) ? session->realloc((ptr), (count), &(session)->abstract) : \ session->alloc((count), &(session)->abstract)) #define LIBSSH2_FREE(session, ptr) \ session->free((ptr), &(session)->abstract) #define LIBSSH2_IGNORE(session, data, datalen) \ session->ssh_msg_ignore((session), (data), (datalen), &(session)->abstract) #define LIBSSH2_DEBUG(session, always_display, message, message_len, \ language, language_len) \ session->ssh_msg_debug((session), (always_display), (message), \ (message_len), (language), (language_len), \ &(session)->abstract) #define LIBSSH2_DISCONNECT(session, reason, message, message_len, \ language, language_len) \ session->ssh_msg_disconnect((session), (reason), (message), \ (message_len), (language), (language_len), \ &(session)->abstract) #define LIBSSH2_MACERROR(session, data, datalen) \ session->macerror((session), (data), (datalen), &(session)->abstract) #define LIBSSH2_X11_OPEN(channel, shost, sport) \ channel->session->x11(((channel)->session), (channel), \ (shost), (sport), (&(channel)->session->abstract)) #define LIBSSH2_CHANNEL_CLOSE(session, channel) \ channel->close_cb((session), &(session)->abstract, \ (channel), &(channel)->abstract) #define LIBSSH2_SEND_FD(session, fd, buffer, length, flags) \ (session->send)(fd, buffer, length, flags, &session->abstract) #define LIBSSH2_RECV_FD(session, fd, buffer, length, flags) \ (session->recv)(fd, buffer, length, flags, &session->abstract) #define LIBSSH2_SEND(session, buffer, length, flags) \ LIBSSH2_SEND_FD(session, session->socket_fd, buffer, length, flags) #define LIBSSH2_RECV(session, buffer, length, flags) \ LIBSSH2_RECV_FD(session, session->socket_fd, buffer, length, flags) typedef struct _LIBSSH2_KEX_METHOD LIBSSH2_KEX_METHOD; typedef struct _LIBSSH2_HOSTKEY_METHOD LIBSSH2_HOSTKEY_METHOD; typedef struct _LIBSSH2_CRYPT_METHOD LIBSSH2_CRYPT_METHOD; typedef struct _LIBSSH2_COMP_METHOD LIBSSH2_COMP_METHOD; typedef struct _LIBSSH2_PACKET LIBSSH2_PACKET; typedef enum { libssh2_NB_state_idle = 0, libssh2_NB_state_allocated, libssh2_NB_state_created, libssh2_NB_state_sent, libssh2_NB_state_sent1, libssh2_NB_state_sent2, libssh2_NB_state_sent3, libssh2_NB_state_sent4, libssh2_NB_state_sent5, libssh2_NB_state_sent6, libssh2_NB_state_sent7, libssh2_NB_state_jump1, libssh2_NB_state_jump2, libssh2_NB_state_jump3, libssh2_NB_state_jump4, libssh2_NB_state_jump5, libssh2_NB_state_end } libssh2_nonblocking_states; typedef struct packet_require_state_t { libssh2_nonblocking_states state; time_t start; } packet_require_state_t; typedef struct packet_requirev_state_t { time_t start; } packet_requirev_state_t; typedef struct kmdhgGPshakex_state_t { libssh2_nonblocking_states state; unsigned char *e_packet; unsigned char *s_packet; unsigned char *tmp; unsigned char h_sig_comp[MAX_SHA_DIGEST_LEN]; unsigned char c; size_t e_packet_len; size_t s_packet_len; size_t tmp_len; _libssh2_bn_ctx *ctx; _libssh2_dh_ctx x; _libssh2_bn *e; _libssh2_bn *f; _libssh2_bn *k; unsigned char *f_value; unsigned char *k_value; unsigned char *h_sig; size_t f_value_len; size_t k_value_len; size_t h_sig_len; void *exchange_hash; packet_require_state_t req_state; libssh2_nonblocking_states burn_state; } kmdhgGPshakex_state_t; typedef struct key_exchange_state_low_t { libssh2_nonblocking_states state; packet_require_state_t req_state; kmdhgGPshakex_state_t exchange_state; _libssh2_bn *p; /* SSH2 defined value (p_value) */ _libssh2_bn *g; /* SSH2 defined value (2) */ unsigned char request[256]; /* Must fit EC_MAX_POINT_LEN + data */ unsigned char *data; size_t request_len; size_t data_len; _libssh2_ec_key *private_key; /* SSH2 ecdh private key */ unsigned char *public_key_oct; /* SSH2 ecdh public key octal value */ size_t public_key_oct_len; /* SSH2 ecdh public key octal value length */ unsigned char *curve25519_public_key; /* curve25519 public key, 32 bytes */ unsigned char *curve25519_private_key; /* curve25519 private key, 32 bytes */ } key_exchange_state_low_t; typedef struct key_exchange_state_t { libssh2_nonblocking_states state; packet_require_state_t req_state; key_exchange_state_low_t key_state_low; unsigned char *data; size_t data_len; unsigned char *oldlocal; size_t oldlocal_len; } key_exchange_state_t; #define FwdNotReq "Forward not requested" typedef struct packet_queue_listener_state_t { libssh2_nonblocking_states state; unsigned char packet[17 + (sizeof(FwdNotReq) - 1)]; unsigned char *host; unsigned char *shost; uint32_t sender_channel; uint32_t initial_window_size; uint32_t packet_size; uint32_t port; uint32_t sport; uint32_t host_len; uint32_t shost_len; LIBSSH2_CHANNEL *channel; } packet_queue_listener_state_t; #define X11FwdUnAvil "X11 Forward Unavailable" typedef struct packet_x11_open_state_t { libssh2_nonblocking_states state; unsigned char packet[17 + (sizeof(X11FwdUnAvil) - 1)]; unsigned char *shost; uint32_t sender_channel; uint32_t initial_window_size; uint32_t packet_size; uint32_t sport; uint32_t shost_len; LIBSSH2_CHANNEL *channel; } packet_x11_open_state_t; struct _LIBSSH2_PACKET { struct list_node node; /* linked list header */ /* the raw unencrypted payload */ unsigned char *data; size_t data_len; /* Where to start reading data from, * used for channel data that's been partially consumed */ size_t data_head; }; typedef struct _libssh2_channel_data { /* Identifier */ uint32_t id; /* Limits and restrictions */ uint32_t window_size_initial, window_size, packet_size; /* Set to 1 when CHANNEL_CLOSE / CHANNEL_EOF sent/received */ char close, eof, extended_data_ignore_mode; } libssh2_channel_data; struct _LIBSSH2_CHANNEL { struct list_node node; unsigned char *channel_type; unsigned channel_type_len; /* channel's program exit status */ int exit_status; /* channel's program exit signal (without the SIG prefix) */ char *exit_signal; libssh2_channel_data local, remote; /* Amount of bytes to be refunded to receive window (but not yet sent) */ uint32_t adjust_queue; /* Data immediately available for reading */ uint32_t read_avail; LIBSSH2_SESSION *session; void *abstract; LIBSSH2_CHANNEL_CLOSE_FUNC((*close_cb)); /* State variables used in libssh2_channel_setenv_ex() */ libssh2_nonblocking_states setenv_state; unsigned char *setenv_packet; size_t setenv_packet_len; unsigned char setenv_local_channel[4]; packet_requirev_state_t setenv_packet_requirev_state; /* State variables used in libssh2_channel_request_pty_ex() libssh2_channel_request_pty_size_ex() */ libssh2_nonblocking_states reqPTY_state; unsigned char reqPTY_packet[41 + 256]; size_t reqPTY_packet_len; unsigned char reqPTY_local_channel[4]; packet_requirev_state_t reqPTY_packet_requirev_state; /* State variables used in libssh2_channel_x11_req_ex() */ libssh2_nonblocking_states reqX11_state; unsigned char *reqX11_packet; size_t reqX11_packet_len; unsigned char reqX11_local_channel[4]; packet_requirev_state_t reqX11_packet_requirev_state; /* State variables used in libssh2_channel_process_startup() */ libssh2_nonblocking_states process_state; unsigned char *process_packet; size_t process_packet_len; unsigned char process_local_channel[4]; packet_requirev_state_t process_packet_requirev_state; /* State variables used in libssh2_channel_flush_ex() */ libssh2_nonblocking_states flush_state; size_t flush_refund_bytes; size_t flush_flush_bytes; /* State variables used in libssh2_channel_receive_window_adjust() */ libssh2_nonblocking_states adjust_state; unsigned char adjust_adjust[9]; /* packet_type(1) + channel(4) + adjustment(4) */ /* State variables used in libssh2_channel_read_ex() */ libssh2_nonblocking_states read_state; uint32_t read_local_id; /* State variables used in libssh2_channel_write_ex() */ libssh2_nonblocking_states write_state; unsigned char write_packet[13]; size_t write_packet_len; size_t write_bufwrite; /* State variables used in libssh2_channel_close() */ libssh2_nonblocking_states close_state; unsigned char close_packet[5]; /* State variables used in libssh2_channel_wait_closedeof() */ libssh2_nonblocking_states wait_eof_state; /* State variables used in libssh2_channel_wait_closed() */ libssh2_nonblocking_states wait_closed_state; /* State variables used in libssh2_channel_free() */ libssh2_nonblocking_states free_state; /* State variables used in libssh2_channel_handle_extended_data2() */ libssh2_nonblocking_states extData2_state; }; struct _LIBSSH2_LISTENER { struct list_node node; /* linked list header */ LIBSSH2_SESSION *session; char *host; int port; /* a list of CHANNELs for this listener */ struct list_head queue; int queue_size; int queue_maxsize; /* State variables used in libssh2_channel_forward_cancel() */ libssh2_nonblocking_states chanFwdCncl_state; unsigned char *chanFwdCncl_data; size_t chanFwdCncl_data_len; }; typedef struct _libssh2_endpoint_data { unsigned char *banner; unsigned char *kexinit; size_t kexinit_len; const LIBSSH2_CRYPT_METHOD *crypt; void *crypt_abstract; const struct _LIBSSH2_MAC_METHOD *mac; uint32_t seqno; void *mac_abstract; const LIBSSH2_COMP_METHOD *comp; void *comp_abstract; /* Method Preferences -- NULL yields "load order" */ char *crypt_prefs; char *mac_prefs; char *comp_prefs; char *lang_prefs; } libssh2_endpoint_data; #define PACKETBUFSIZE (1024*16) struct transportpacket { /* ------------- for incoming data --------------- */ unsigned char buf[PACKETBUFSIZE]; unsigned char init[5]; /* first 5 bytes of the incoming data stream, still encrypted */ size_t writeidx; /* at what array index we do the next write into the buffer */ size_t readidx; /* at what array index we do the next read from the buffer */ uint32_t packet_length; /* the most recent packet_length as read from the network data */ uint8_t padding_length; /* the most recent padding_length as read from the network data */ size_t data_num; /* How much of the total package that has been read so far. */ size_t total_num; /* How much a total package is supposed to be, in number of bytes. A full package is packet_length + padding_length + 4 + mac_length. */ unsigned char *payload; /* this is a pointer to a LIBSSH2_ALLOC() area to which we write decrypted data */ unsigned char *wptr; /* write pointer into the payload to where we are currently writing decrypted data */ /* ------------- for outgoing data --------------- */ unsigned char outbuf[MAX_SSH_PACKET_LEN]; /* area for the outgoing data */ int ototal_num; /* size of outbuf in number of bytes */ const unsigned char *odata; /* original pointer to the data */ size_t olen; /* original size of the data we stored in outbuf */ size_t osent; /* number of bytes already sent */ }; struct _LIBSSH2_PUBLICKEY { LIBSSH2_CHANNEL *channel; uint32_t version; /* State variables used in libssh2_publickey_packet_receive() */ libssh2_nonblocking_states receive_state; unsigned char *receive_packet; size_t receive_packet_len; /* State variables used in libssh2_publickey_add_ex() */ libssh2_nonblocking_states add_state; unsigned char *add_packet; unsigned char *add_s; /* State variables used in libssh2_publickey_remove_ex() */ libssh2_nonblocking_states remove_state; unsigned char *remove_packet; unsigned char *remove_s; /* State variables used in libssh2_publickey_list_fetch() */ libssh2_nonblocking_states listFetch_state; unsigned char *listFetch_s; unsigned char listFetch_buffer[12]; unsigned char *listFetch_data; size_t listFetch_data_len; }; #define LIBSSH2_SCP_RESPONSE_BUFLEN 256 struct flags { int sigpipe; /* LIBSSH2_FLAG_SIGPIPE */ int compress; /* LIBSSH2_FLAG_COMPRESS */ }; struct _LIBSSH2_SESSION { /* Memory management callbacks */ void *abstract; LIBSSH2_ALLOC_FUNC((*alloc)); LIBSSH2_REALLOC_FUNC((*realloc)); LIBSSH2_FREE_FUNC((*free)); /* Other callbacks */ LIBSSH2_IGNORE_FUNC((*ssh_msg_ignore)); LIBSSH2_DEBUG_FUNC((*ssh_msg_debug)); LIBSSH2_DISCONNECT_FUNC((*ssh_msg_disconnect)); LIBSSH2_MACERROR_FUNC((*macerror)); LIBSSH2_X11_OPEN_FUNC((*x11)); LIBSSH2_SEND_FUNC((*send)); LIBSSH2_RECV_FUNC((*recv)); /* Method preferences -- NULL yields "load order" */ char *kex_prefs; char *hostkey_prefs; int state; /* Flag options */ struct flags flag; /* Agreed Key Exchange Method */ const LIBSSH2_KEX_METHOD *kex; unsigned int burn_optimistic_kexinit:1; unsigned char *session_id; uint32_t session_id_len; /* this is set to TRUE if a blocking API behavior is requested */ int api_block_mode; /* Timeout used when blocking API behavior is active */ long api_timeout; /* Server's public key */ const LIBSSH2_HOSTKEY_METHOD *hostkey; void *server_hostkey_abstract; /* Either set with libssh2_session_hostkey() (for server mode) * Or read from server in (eg) KEXDH_INIT (for client mode) */ unsigned char *server_hostkey; uint32_t server_hostkey_len; #if LIBSSH2_MD5 unsigned char server_hostkey_md5[MD5_DIGEST_LENGTH]; int server_hostkey_md5_valid; #endif /* ! LIBSSH2_MD5 */ unsigned char server_hostkey_sha1[SHA_DIGEST_LENGTH]; int server_hostkey_sha1_valid; unsigned char server_hostkey_sha256[SHA256_DIGEST_LENGTH]; int server_hostkey_sha256_valid; /* (remote as source of data -- packet_read ) */ libssh2_endpoint_data remote; /* (local as source of data -- packet_write ) */ libssh2_endpoint_data local; /* Inbound Data linked list -- Sometimes the packet that comes in isn't the packet we're ready for */ struct list_head packets; /* Active connection channels */ struct list_head channels; uint32_t next_channel; struct list_head listeners; /* list of LIBSSH2_LISTENER structs */ /* Actual I/O socket */ libssh2_socket_t socket_fd; int socket_state; int socket_block_directions; int socket_prev_blockstate; /* stores the state of the socket blockiness when libssh2_session_startup() is called */ /* Error tracking */ const char *err_msg; int err_code; int err_flags; /* struct members for packet-level reading */ struct transportpacket packet; #ifdef LIBSSH2DEBUG int showmask; /* what debug/trace messages to display */ libssh2_trace_handler_func tracehandler; /* callback to display trace messages */ void *tracehandler_context; /* context for the trace handler */ #endif /* State variables used in libssh2_banner_send() */ libssh2_nonblocking_states banner_TxRx_state; char banner_TxRx_banner[256]; ssize_t banner_TxRx_total_send; /* State variables used in libssh2_kexinit() */ libssh2_nonblocking_states kexinit_state; unsigned char *kexinit_data; size_t kexinit_data_len; /* State variables used in libssh2_session_startup() */ libssh2_nonblocking_states startup_state; unsigned char *startup_data; size_t startup_data_len; unsigned char startup_service[sizeof("ssh-userauth") + 5 - 1]; size_t startup_service_length; packet_require_state_t startup_req_state; key_exchange_state_t startup_key_state; /* State variables used in libssh2_session_free() */ libssh2_nonblocking_states free_state; /* State variables used in libssh2_session_disconnect_ex() */ libssh2_nonblocking_states disconnect_state; unsigned char disconnect_data[256 + 13]; size_t disconnect_data_len; /* State variables used in libssh2_packet_read() */ libssh2_nonblocking_states readPack_state; int readPack_encrypted; /* State variables used in libssh2_userauth_list() */ libssh2_nonblocking_states userauth_list_state; unsigned char *userauth_list_data; size_t userauth_list_data_len; packet_requirev_state_t userauth_list_packet_requirev_state; /* State variables used in libssh2_userauth_password_ex() */ libssh2_nonblocking_states userauth_pswd_state; unsigned char *userauth_pswd_data; unsigned char userauth_pswd_data0; size_t userauth_pswd_data_len; char *userauth_pswd_newpw; int userauth_pswd_newpw_len; packet_requirev_state_t userauth_pswd_packet_requirev_state; /* State variables used in libssh2_userauth_hostbased_fromfile_ex() */ libssh2_nonblocking_states userauth_host_state; unsigned char *userauth_host_data; size_t userauth_host_data_len; unsigned char *userauth_host_packet; size_t userauth_host_packet_len; unsigned char *userauth_host_method; size_t userauth_host_method_len; unsigned char *userauth_host_s; packet_requirev_state_t userauth_host_packet_requirev_state; /* State variables used in libssh2_userauth_publickey_fromfile_ex() */ libssh2_nonblocking_states userauth_pblc_state; unsigned char *userauth_pblc_data; size_t userauth_pblc_data_len; unsigned char *userauth_pblc_packet; size_t userauth_pblc_packet_len; unsigned char *userauth_pblc_method; size_t userauth_pblc_method_len; unsigned char *userauth_pblc_s; unsigned char *userauth_pblc_b; packet_requirev_state_t userauth_pblc_packet_requirev_state; /* State variables used in libssh2_userauth_keyboard_interactive_ex() */ libssh2_nonblocking_states userauth_kybd_state; unsigned char *userauth_kybd_data; size_t userauth_kybd_data_len; unsigned char *userauth_kybd_packet; size_t userauth_kybd_packet_len; unsigned int userauth_kybd_auth_name_len; char *userauth_kybd_auth_name; unsigned userauth_kybd_auth_instruction_len; char *userauth_kybd_auth_instruction; unsigned int userauth_kybd_num_prompts; int userauth_kybd_auth_failure; LIBSSH2_USERAUTH_KBDINT_PROMPT *userauth_kybd_prompts; LIBSSH2_USERAUTH_KBDINT_RESPONSE *userauth_kybd_responses; packet_requirev_state_t userauth_kybd_packet_requirev_state; /* State variables used in libssh2_channel_open_ex() */ libssh2_nonblocking_states open_state; packet_requirev_state_t open_packet_requirev_state; LIBSSH2_CHANNEL *open_channel; unsigned char *open_packet; size_t open_packet_len; unsigned char *open_data; size_t open_data_len; uint32_t open_local_channel; /* State variables used in libssh2_channel_direct_tcpip_ex() */ libssh2_nonblocking_states direct_state; unsigned char *direct_message; size_t direct_host_len; size_t direct_shost_len; size_t direct_message_len; /* State variables used in libssh2_channel_forward_listen_ex() */ libssh2_nonblocking_states fwdLstn_state; unsigned char *fwdLstn_packet; uint32_t fwdLstn_host_len; uint32_t fwdLstn_packet_len; packet_requirev_state_t fwdLstn_packet_requirev_state; /* State variables used in libssh2_publickey_init() */ libssh2_nonblocking_states pkeyInit_state; LIBSSH2_PUBLICKEY *pkeyInit_pkey; LIBSSH2_CHANNEL *pkeyInit_channel; unsigned char *pkeyInit_data; size_t pkeyInit_data_len; /* 19 = packet_len(4) + version_len(4) + "version"(7) + version_num(4) */ unsigned char pkeyInit_buffer[19]; size_t pkeyInit_buffer_sent; /* how much of buffer that has been sent */ /* State variables used in libssh2_packet_add() */ libssh2_nonblocking_states packAdd_state; LIBSSH2_CHANNEL *packAdd_channelp; /* keeper of the channel during EAGAIN states */ packet_queue_listener_state_t packAdd_Qlstn_state; packet_x11_open_state_t packAdd_x11open_state; /* State variables used in fullpacket() */ libssh2_nonblocking_states fullpacket_state; int fullpacket_macstate; size_t fullpacket_payload_len; int fullpacket_packet_type; /* State variables used in libssh2_sftp_init() */ libssh2_nonblocking_states sftpInit_state; LIBSSH2_SFTP *sftpInit_sftp; LIBSSH2_CHANNEL *sftpInit_channel; unsigned char sftpInit_buffer[9]; /* sftp_header(5){excludes request_id} + version_id(4) */ int sftpInit_sent; /* number of bytes from the buffer that have been sent */ /* State variables used in libssh2_scp_recv() / libssh_scp_recv2() */ libssh2_nonblocking_states scpRecv_state; unsigned char *scpRecv_command; size_t scpRecv_command_len; unsigned char scpRecv_response[LIBSSH2_SCP_RESPONSE_BUFLEN]; size_t scpRecv_response_len; long scpRecv_mode; #if defined(HAVE_LONGLONG) && defined(HAVE_STRTOLL) /* we have the type and we can parse such numbers */ long long scpRecv_size; #define scpsize_strtol strtoll #elif defined(HAVE_STRTOI64) __int64 scpRecv_size; #define scpsize_strtol _strtoi64 #else long scpRecv_size; #define scpsize_strtol strtol #endif long scpRecv_mtime; long scpRecv_atime; LIBSSH2_CHANNEL *scpRecv_channel; /* State variables used in libssh2_scp_send_ex() */ libssh2_nonblocking_states scpSend_state; unsigned char *scpSend_command; size_t scpSend_command_len; unsigned char scpSend_response[LIBSSH2_SCP_RESPONSE_BUFLEN]; size_t scpSend_response_len; LIBSSH2_CHANNEL *scpSend_channel; /* Keepalive variables used by keepalive.c. */ int keepalive_interval; int keepalive_want_reply; time_t keepalive_last_sent; }; /* session.state bits */ #define LIBSSH2_STATE_EXCHANGING_KEYS 0x00000001 #define LIBSSH2_STATE_NEWKEYS 0x00000002 #define LIBSSH2_STATE_AUTHENTICATED 0x00000004 #define LIBSSH2_STATE_KEX_ACTIVE 0x00000008 /* session.flag helpers */ #ifdef MSG_NOSIGNAL #define LIBSSH2_SOCKET_SEND_FLAGS(session) \ (((session)->flag.sigpipe) ? 0 : MSG_NOSIGNAL) #define LIBSSH2_SOCKET_RECV_FLAGS(session) \ (((session)->flag.sigpipe) ? 0 : MSG_NOSIGNAL) #else /* If MSG_NOSIGNAL isn't defined we're SOL on blocking SIGPIPE */ #define LIBSSH2_SOCKET_SEND_FLAGS(session) 0 #define LIBSSH2_SOCKET_RECV_FLAGS(session) 0 #endif /* --------- */ /* libssh2 extensible ssh api, ultimately I'd like to allow loading additional methods via .so/.dll */ struct _LIBSSH2_KEX_METHOD { const char *name; /* Key exchange, populates session->* and returns 0 on success, non-0 on error */ int (*exchange_keys) (LIBSSH2_SESSION * session, key_exchange_state_low_t * key_state); long flags; }; struct _LIBSSH2_HOSTKEY_METHOD { const char *name; unsigned long hash_len; int (*init) (LIBSSH2_SESSION * session, const unsigned char *hostkey_data, size_t hostkey_data_len, void **abstract); int (*initPEM) (LIBSSH2_SESSION * session, const char *privkeyfile, unsigned const char *passphrase, void **abstract); int (*initPEMFromMemory) (LIBSSH2_SESSION * session, const char *privkeyfiledata, size_t privkeyfiledata_len, unsigned const char *passphrase, void **abstract); int (*sig_verify) (LIBSSH2_SESSION * session, const unsigned char *sig, size_t sig_len, const unsigned char *m, size_t m_len, void **abstract); int (*signv) (LIBSSH2_SESSION * session, unsigned char **signature, size_t *signature_len, int veccount, const struct iovec datavec[], void **abstract); int (*encrypt) (LIBSSH2_SESSION * session, unsigned char **dst, size_t *dst_len, const unsigned char *src, size_t src_len, void **abstract); int (*dtor) (LIBSSH2_SESSION * session, void **abstract); }; struct _LIBSSH2_CRYPT_METHOD { const char *name; const char *pem_annotation; int blocksize; /* iv and key sizes (-1 for variable length) */ int iv_len; int secret_len; long flags; int (*init) (LIBSSH2_SESSION * session, const LIBSSH2_CRYPT_METHOD * method, unsigned char *iv, int *free_iv, unsigned char *secret, int *free_secret, int encrypt, void **abstract); int (*crypt) (LIBSSH2_SESSION * session, unsigned char *block, size_t blocksize, void **abstract); int (*dtor) (LIBSSH2_SESSION * session, void **abstract); _libssh2_cipher_type(algo); }; struct _LIBSSH2_COMP_METHOD { const char *name; int compress; /* 1 if it does compress, 0 if it doesn't */ int use_in_auth; /* 1 if compression should be used in userauth */ int (*init) (LIBSSH2_SESSION *session, int compress, void **abstract); int (*comp) (LIBSSH2_SESSION *session, unsigned char *dest, size_t *dest_len, const unsigned char *src, size_t src_len, void **abstract); int (*decomp) (LIBSSH2_SESSION *session, unsigned char **dest, size_t *dest_len, size_t payload_limit, const unsigned char *src, size_t src_len, void **abstract); int (*dtor) (LIBSSH2_SESSION * session, int compress, void **abstract); }; #ifdef LIBSSH2DEBUG void _libssh2_debug(LIBSSH2_SESSION * session, int context, const char *format, ...); #else #if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \ defined(__GNUC__) /* C99 supported and also by older GCC */ #define _libssh2_debug(x,y,z,...) do {} while (0) #else /* no gcc and not C99, do static and hopefully inline */ static inline void _libssh2_debug(LIBSSH2_SESSION * session, int context, const char *format, ...) { (void)session; (void)context; (void)format; } #endif #endif #define LIBSSH2_SOCKET_UNKNOWN 1 #define LIBSSH2_SOCKET_CONNECTED 0 #define LIBSSH2_SOCKET_DISCONNECTED -1 /* Initial packet state, prior to MAC check */ #define LIBSSH2_MAC_UNCONFIRMED 1 /* When MAC type is "none" (proto initiation phase) all packets are deemed "confirmed" */ #define LIBSSH2_MAC_CONFIRMED 0 /* Something very bad is going on */ #define LIBSSH2_MAC_INVALID -1 /* Flags for _libssh2_error_flags */ /* Error message is allocated on the heap */ #define LIBSSH2_ERR_FLAG_DUP 1 /* SSH Packet Types -- Defined by internet draft */ /* Transport Layer */ #define SSH_MSG_DISCONNECT 1 #define SSH_MSG_IGNORE 2 #define SSH_MSG_UNIMPLEMENTED 3 #define SSH_MSG_DEBUG 4 #define SSH_MSG_SERVICE_REQUEST 5 #define SSH_MSG_SERVICE_ACCEPT 6 #define SSH_MSG_KEXINIT 20 #define SSH_MSG_NEWKEYS 21 /* diffie-hellman-group1-sha1 */ #define SSH_MSG_KEXDH_INIT 30 #define SSH_MSG_KEXDH_REPLY 31 /* diffie-hellman-group-exchange-sha1 and diffie-hellman-group-exchange-sha256 */ #define SSH_MSG_KEX_DH_GEX_REQUEST_OLD 30 #define SSH_MSG_KEX_DH_GEX_REQUEST 34 #define SSH_MSG_KEX_DH_GEX_GROUP 31 #define SSH_MSG_KEX_DH_GEX_INIT 32 #define SSH_MSG_KEX_DH_GEX_REPLY 33 /* ecdh */ #define SSH2_MSG_KEX_ECDH_INIT 30 #define SSH2_MSG_KEX_ECDH_REPLY 31 /* User Authentication */ #define SSH_MSG_USERAUTH_REQUEST 50 #define SSH_MSG_USERAUTH_FAILURE 51 #define SSH_MSG_USERAUTH_SUCCESS 52 #define SSH_MSG_USERAUTH_BANNER 53 /* "public key" method */ #define SSH_MSG_USERAUTH_PK_OK 60 /* "password" method */ #define SSH_MSG_USERAUTH_PASSWD_CHANGEREQ 60 /* "keyboard-interactive" method */ #define SSH_MSG_USERAUTH_INFO_REQUEST 60 #define SSH_MSG_USERAUTH_INFO_RESPONSE 61 /* Channels */ #define SSH_MSG_GLOBAL_REQUEST 80 #define SSH_MSG_REQUEST_SUCCESS 81 #define SSH_MSG_REQUEST_FAILURE 82 #define SSH_MSG_CHANNEL_OPEN 90 #define SSH_MSG_CHANNEL_OPEN_CONFIRMATION 91 #define SSH_MSG_CHANNEL_OPEN_FAILURE 92 #define SSH_MSG_CHANNEL_WINDOW_ADJUST 93 #define SSH_MSG_CHANNEL_DATA 94 #define SSH_MSG_CHANNEL_EXTENDED_DATA 95 #define SSH_MSG_CHANNEL_EOF 96 #define SSH_MSG_CHANNEL_CLOSE 97 #define SSH_MSG_CHANNEL_REQUEST 98 #define SSH_MSG_CHANNEL_SUCCESS 99 #define SSH_MSG_CHANNEL_FAILURE 100 /* Error codes returned in SSH_MSG_CHANNEL_OPEN_FAILURE message (see RFC4254) */ #define SSH_OPEN_ADMINISTRATIVELY_PROHIBITED 1 #define SSH_OPEN_CONNECT_FAILED 2 #define SSH_OPEN_UNKNOWN_CHANNELTYPE 3 #define SSH_OPEN_RESOURCE_SHORTAGE 4 ssize_t _libssh2_recv(libssh2_socket_t socket, void *buffer, size_t length, int flags, void **abstract); ssize_t _libssh2_send(libssh2_socket_t socket, const void *buffer, size_t length, int flags, void **abstract); #define LIBSSH2_READ_TIMEOUT 60 /* generic timeout in seconds used when waiting for more data to arrive */ int _libssh2_kex_exchange(LIBSSH2_SESSION * session, int reexchange, key_exchange_state_t * state); /* Let crypt.c/hostkey.c expose their method structs */ const LIBSSH2_CRYPT_METHOD **libssh2_crypt_methods(void); const LIBSSH2_HOSTKEY_METHOD **libssh2_hostkey_methods(void); /* misc.c */ int _libssh2_bcrypt_pbkdf(const char *pass, size_t passlen, const uint8_t *salt, size_t saltlen, uint8_t *key, size_t keylen, unsigned int rounds); /* pem.c */ int _libssh2_pem_parse(LIBSSH2_SESSION * session, const char *headerbegin, const char *headerend, const unsigned char *passphrase, FILE * fp, unsigned char **data, unsigned int *datalen); int _libssh2_pem_parse_memory(LIBSSH2_SESSION * session, const char *headerbegin, const char *headerend, const char *filedata, size_t filedata_len, unsigned char **data, unsigned int *datalen); /* OpenSSL keys */ int _libssh2_openssh_pem_parse(LIBSSH2_SESSION * session, const unsigned char *passphrase, FILE * fp, struct string_buf **decrypted_buf); int _libssh2_openssh_pem_parse_memory(LIBSSH2_SESSION * session, const unsigned char *passphrase, const char *filedata, size_t filedata_len, struct string_buf **decrypted_buf); int _libssh2_pem_decode_sequence(unsigned char **data, unsigned int *datalen); int _libssh2_pem_decode_integer(unsigned char **data, unsigned int *datalen, unsigned char **i, unsigned int *ilen); /* global.c */ void _libssh2_init_if_needed(void); #define ARRAY_SIZE(a) (sizeof ((a)) / sizeof ((a)[0])) /* define to output the libssh2_int64_t type in a *printf() */ #if defined(__BORLANDC__) || defined(_MSC_VER) || defined(__MINGW32__) #define LIBSSH2_INT64_T_FORMAT "I64d" #else #define LIBSSH2_INT64_T_FORMAT "lld" #endif /* In Windows the default file mode is text but an application can override it. Therefore we specify it explicitly. https://github.com/curl/curl/pull/258 */ #if defined(WIN32) || defined(MSDOS) #define FOPEN_READTEXT "rt" #define FOPEN_WRITETEXT "wt" #define FOPEN_APPENDTEXT "at" #elif defined(__CYGWIN__) /* Cygwin has specific behavior we need to address when WIN32 is not defined. https://cygwin.com/cygwin-ug-net/using-textbinary.html For write we want our output to have line endings of LF and be compatible with other Cygwin utilities. For read we want to handle input that may have line endings either CRLF or LF so 't' is appropriate. */ #define FOPEN_READTEXT "rt" #define FOPEN_WRITETEXT "w" #define FOPEN_APPENDTEXT "a" #else #define FOPEN_READTEXT "r" #define FOPEN_WRITETEXT "w" #define FOPEN_APPENDTEXT "a" #endif #endif /* LIBSSH2_H */
39,115
C++
.h
966
34.847826
79
0.663858
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
15,259
channel.h
Studio3T_robomongo/src/third-party/libssh2-1.9.0/sources/src/channel.h
#ifndef __LIBSSH2_CHANNEL_H #define __LIBSSH2_CHANNEL_H /* Copyright (c) 2008-2010 by Daniel Stenberg * * All rights reserved. * * Redistribution and use in source and binary forms, * with or without modification, are permitted provided * that the following conditions are met: * * Redistributions of source code must retain the above * copyright notice, this list of conditions and the * following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the copyright holder nor the names * of any other contributors may be used to endorse or * promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. */ /* * _libssh2_channel_receive_window_adjust * * Adjust the receive window for a channel by adjustment bytes. If the amount * to be adjusted is less than LIBSSH2_CHANNEL_MINADJUST and force is 0 the * adjustment amount will be queued for a later packet. * * Always non-blocking. */ int _libssh2_channel_receive_window_adjust(LIBSSH2_CHANNEL * channel, uint32_t adjustment, unsigned char force, unsigned int *store); /* * _libssh2_channel_flush * * Flush data from one (or all) stream * Returns number of bytes flushed, or negative on failure */ int _libssh2_channel_flush(LIBSSH2_CHANNEL *channel, int streamid); /* * _libssh2_channel_free * * Make sure a channel is closed, then remove the channel from the session * and free its resource(s) * * Returns 0 on success, negative on failure */ int _libssh2_channel_free(LIBSSH2_CHANNEL *channel); int _libssh2_channel_extended_data(LIBSSH2_CHANNEL *channel, int ignore_mode); /* * _libssh2_channel_write * * Send data to a channel */ ssize_t _libssh2_channel_write(LIBSSH2_CHANNEL *channel, int stream_id, const unsigned char *buf, size_t buflen); /* * _libssh2_channel_open * * Establish a generic session channel */ LIBSSH2_CHANNEL * _libssh2_channel_open(LIBSSH2_SESSION * session, const char *channel_type, uint32_t channel_type_len, uint32_t window_size, uint32_t packet_size, const unsigned char *message, size_t message_len); /* * _libssh2_channel_process_startup * * Primitive for libssh2_channel_(shell|exec|subsystem) */ int _libssh2_channel_process_startup(LIBSSH2_CHANNEL *channel, const char *request, size_t request_len, const char *message, size_t message_len); /* * _libssh2_channel_read * * Read data from a channel * * It is important to not return 0 until the currently read channel is * complete. If we read stuff from the wire but it was no payload data to fill * in the buffer with, we MUST make sure to return PACKET_EAGAIN. */ ssize_t _libssh2_channel_read(LIBSSH2_CHANNEL *channel, int stream_id, char *buf, size_t buflen); uint32_t _libssh2_channel_nextid(LIBSSH2_SESSION * session); LIBSSH2_CHANNEL *_libssh2_channel_locate(LIBSSH2_SESSION * session, uint32_t channel_id); size_t _libssh2_channel_packet_data_len(LIBSSH2_CHANNEL * channel, int stream_id); int _libssh2_channel_close(LIBSSH2_CHANNEL * channel); /* * _libssh2_channel_forward_cancel * * Stop listening on a remote port and free the listener * Toss out any pending (un-accept()ed) connections * * Return 0 on success, LIBSSH2_ERROR_EAGAIN if would block, -1 on error */ int _libssh2_channel_forward_cancel(LIBSSH2_LISTENER *listener); #endif /* __LIBSSH2_CHANNEL_H */
4,760
C++
.h
125
32.952
78
0.698853
Studio3T/robomongo
9,296
797
724
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false