aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2009-07-24 21:45:41 +0200
committerAris Adamantiadis <aris@0xbadc0de.be>2009-07-24 21:45:41 +0200
commit56ee212641e8f5a008224da103dce78e421eb4b6 (patch)
tree47b76a7dfcafe19303d0f72c2107c8581affa5fe /include
parent8f3891e968bad4b9fb06e92f5a893dd30a343677 (diff)
downloadlibssh-56ee212641e8f5a008224da103dce78e421eb4b6.tar.gz
libssh-56ee212641e8f5a008224da103dce78e421eb4b6.tar.xz
libssh-56ee212641e8f5a008224da103dce78e421eb4b6.zip
Change all occurences of STRING * to ssh_string
Diffstat (limited to 'include')
-rw-r--r--include/libssh/libssh.h45
-rw-r--r--include/libssh/priv.h52
-rw-r--r--include/libssh/sftp.h24
3 files changed, 68 insertions, 53 deletions
diff --git a/include/libssh/libssh.h b/include/libssh/libssh.h
index 70f855dc..70631463 100644
--- a/include/libssh/libssh.h
+++ b/include/libssh/libssh.h
@@ -71,16 +71,31 @@ typedef unsigned long long uint64_t;
extern "C" {
#endif
+#ifdef SSH_SAFE_NAMESPACE
typedef struct ssh_string_struct STRING;
+#endif
typedef struct ssh_buffer_struct BUFFER;
typedef struct ssh_public_key_struct PUBLIC_KEY;
typedef struct ssh_private_key_struct PRIVATE_KEY;
-typedef struct ssh_options_struct SSH_OPTIONS;
typedef struct ssh_channel_struct CHANNEL;
typedef struct ssh_agent_struct AGENT;
+//#endif
+
+typedef struct ssh_options_struct SSH_OPTIONS;
typedef struct ssh_session SSH_SESSION;
typedef struct ssh_kbdint SSH_KBDINT;
+typedef struct ssh_string_struct* ssh_string;
+typedef struct ssh_buffer_struct* ssh_buffer;
+typedef struct ssh_public_key_struct* ssh_public_key;
+typedef struct ssh_private_key_struct* ssh_private_key;
+typedef struct ssh_options_struct* ssh_options;
+typedef struct ssh_channel_struct* ssh_channel;
+typedef struct ssh_agent_struct* ssh_agentT;
+typedef struct ssh_session* ssh_session;
+typedef struct ssh_kbdint* ssh_kbdint;
+
+
/* integer values */
typedef uint32_t u32;
typedef uint16_t u16;
@@ -217,19 +232,19 @@ const char *ssh_copyright(void);
/* You can use these functions, they won't change */
/* string_from_char returns a newly allocated string from a char *ptr */
-STRING *string_from_char(const char *what);
+ssh_string string_from_char(const char *what);
/* it returns the string len in host byte orders. str->size is big endian warning ! */
-size_t string_len(STRING *str);
-STRING *string_new(size_t size);
+size_t string_len(ssh_string str);
+ssh_string string_new(size_t size);
/* string_fill copies the data in the string. */
-int string_fill(STRING *str, const void *data, size_t len);
+int string_fill(ssh_string str, const void *data, size_t len);
/* returns a newly allocated char array with the str string and a final nul caracter */
-char *string_to_char(STRING *str);
-STRING *string_copy(STRING *str);
+char *string_to_char(ssh_string str);
+ssh_string string_copy(ssh_string str);
/* burns the data inside a string */
-void string_burn(STRING *str);
-void *string_data(STRING *str);
-void string_free(STRING *str);
+void string_burn(ssh_string str);
+void *string_data(ssh_string str);
+void string_free(ssh_string str);
/* useful for debug */
char *ssh_get_hexa(const unsigned char *what, size_t len);
@@ -238,7 +253,7 @@ int ssh_get_random(void *where,int len,int strong);
/* this one can be called by the client to see the hash of the public key before accepting it */
int ssh_get_pubkey_hash(SSH_SESSION *session, unsigned char **hash);
-STRING *ssh_get_pubkey(SSH_SESSION *session);
+ssh_string ssh_get_pubkey(SSH_SESSION *session);
/* in connect.c */
int ssh_fd_poll(SSH_SESSION *session,int *write, int *except);
@@ -251,10 +266,10 @@ void publickey_free(PUBLIC_KEY *key);
PRIVATE_KEY *privatekey_from_file(SSH_SESSION *session, const char *filename,
int type, const char *passphrase);
-STRING *publickey_to_string(PUBLIC_KEY *key);
+ssh_string publickey_to_string(PUBLIC_KEY *key);
PUBLIC_KEY *publickey_from_privatekey(PRIVATE_KEY *prv);
void privatekey_free(PRIVATE_KEY *prv);
-STRING *publickey_from_file(SSH_SESSION *session, const char *filename,
+ssh_string publickey_from_file(SSH_SESSION *session, const char *filename,
int *type);
int ssh_is_server_known(SSH_SESSION *session);
int ssh_write_knownhost(SSH_SESSION *session);
@@ -359,8 +374,8 @@ int ssh_auth_list(SSH_SESSION *session);
int ssh_userauth_list(SSH_SESSION *session, const char *username);
int ssh_userauth_none(SSH_SESSION *session, const char *username);
int ssh_userauth_password(SSH_SESSION *session, const char *username, const char *password);
-int ssh_userauth_offer_pubkey(SSH_SESSION *session, const char *username, int type, STRING *publickey);
-int ssh_userauth_pubkey(SSH_SESSION *session, const char *username, STRING *publickey, PRIVATE_KEY *privatekey);
+int ssh_userauth_offer_pubkey(SSH_SESSION *session, const char *username, int type, ssh_string publickey);
+int ssh_userauth_pubkey(SSH_SESSION *session, const char *username, ssh_string publickey, PRIVATE_KEY *privatekey);
int ssh_userauth_agent_pubkey(SSH_SESSION *session, const char *username,
PUBLIC_KEY *publickey);
int ssh_userauth_autopubkey(SSH_SESSION *session, const char *passphrase);
diff --git a/include/libssh/priv.h b/include/libssh/priv.h
index e3c934db..d6964319 100644
--- a/include/libssh/priv.h
+++ b/include/libssh/priv.h
@@ -232,7 +232,7 @@ typedef struct signature_struct {
gcry_sexp_t rsa_sign;
#elif defined HAVE_LIBCRYPTO
DSA_SIG *dsa_sign;
- STRING *rsa_sign;
+ ssh_string rsa_sign;
#endif
} SIGNATURE;
@@ -287,7 +287,7 @@ typedef struct ssh_crypto_struct {
unsigned char decryptMAC[SHA_DIGEST_LEN];
unsigned char hmacbuf[EVP_MAX_MD_SIZE];
struct crypto_struct *in_cipher, *out_cipher; /* the cipher structures/objects */
- STRING *server_pubkey;
+ ssh_string server_pubkey;
const char *server_pubkey_type;
int do_compress_out; /* idem */
int do_compress_in; /* don't set them, set the option instead */
@@ -355,7 +355,7 @@ struct ssh_session {
/* socket status */
int blocking; // functions should block
- STRING *banner; /* that's the issue banner from
+ ssh_string banner; /* that's the issue banner from
the server */
char *remotebanner; /* that's the SSH- banner from
remote host. */
@@ -369,7 +369,7 @@ struct ssh_session {
/* where it was before being interrupted */
int packet_state;
int dh_handshake_state;
- STRING *dh_server_signature; //information used by dh_handshake.
+ ssh_string dh_server_signature; //information used by dh_handshake.
KEX server_kex;
KEX client_kex;
@@ -449,7 +449,7 @@ struct ssh_channel_request {
u32 height;
u32 pxwidth;
u32 pxheight;
- STRING *modes;
+ ssh_string modes;
/* env type request */
char *var_name;
@@ -504,7 +504,7 @@ struct ssh_public_key_struct *agent_get_next_ident(struct ssh_session *session,
struct ssh_public_key_struct *agent_get_first_ident(struct ssh_session *session,
char **comment);
-STRING *agent_sign_data(struct ssh_session *session,
+ssh_string agent_sign_data(struct ssh_session *session,
struct ssh_buffer_struct *data,
struct ssh_public_key_struct *pubkey);
#endif
@@ -597,11 +597,11 @@ int dh_generate_y(SSH_SESSION *session);
int ssh_crypto_init(void);
void ssh_crypto_finalize(void);
-STRING *dh_get_e(SSH_SESSION *session);
-STRING *dh_get_f(SSH_SESSION *session);
-int dh_import_f(SSH_SESSION *session,STRING *f_string);
-int dh_import_e(SSH_SESSION *session, STRING *e_string);
-void dh_import_pubkey(SSH_SESSION *session,STRING *pubkey_string);
+ssh_string dh_get_e(SSH_SESSION *session);
+ssh_string dh_get_f(SSH_SESSION *session);
+int dh_import_f(SSH_SESSION *session,ssh_string f_string);
+int dh_import_e(SSH_SESSION *session, ssh_string e_string);
+void dh_import_pubkey(SSH_SESSION *session,ssh_string pubkey_string);
int dh_build_k(SSH_SESSION *session);
int make_sessionid(SSH_SESSION *session);
/* add data for the final cookie */
@@ -609,9 +609,9 @@ int hashbufin_add_cookie(SSH_SESSION *session, unsigned char *cookie);
int hashbufout_add_cookie(SSH_SESSION *session);
int generate_session_keys(SSH_SESSION *session);
/* returns 1 if server signature ok, 0 otherwise. The NEXT crypto is checked, not the current one */
-int signature_verify(SSH_SESSION *session,STRING *signature);
-bignum make_string_bn(STRING *string);
-STRING *make_bignum_string(bignum num);
+int signature_verify(SSH_SESSION *session,ssh_string signature);
+bignum make_string_bn(ssh_string string);
+ssh_string make_bignum_string(bignum num);
/* in crypt.c */
u32 packet_decrypt_len(SSH_SESSION *session,char *crypted);
@@ -652,7 +652,7 @@ char *ssh_find_matching(const char *in_d, const char *what_d);
PRIVATE_KEY *_privatekey_from_file(void *session, const char *filename,
int type);
-STRING *try_publickey_from_file(SSH_SESSION *session,
+ssh_string try_publickey_from_file(SSH_SESSION *session,
struct ssh_keys_struct keytab,
char **privkeyfile, int *type);
@@ -663,19 +663,19 @@ int ssh_type_from_name(const char *name);
PRIVATE_KEY *privatekey_make_dss(SSH_SESSION *session, BUFFER *buffer);
PRIVATE_KEY *privatekey_make_rsa(SSH_SESSION *session, BUFFER *buffer,
const char *type);
-PRIVATE_KEY *privatekey_from_string(SSH_SESSION *session, STRING *privkey_s);
+PRIVATE_KEY *privatekey_from_string(SSH_SESSION *session, ssh_string privkey_s);
PUBLIC_KEY *publickey_make_dss(SSH_SESSION *session, BUFFER *buffer);
PUBLIC_KEY *publickey_make_rsa(SSH_SESSION *session, BUFFER *buffer, int type);
-PUBLIC_KEY *publickey_from_string(SSH_SESSION *session, STRING *pubkey_s);
-SIGNATURE *signature_from_string(SSH_SESSION *session, STRING *signature,PUBLIC_KEY *pubkey,int needed_type);
+PUBLIC_KEY *publickey_from_string(SSH_SESSION *session, ssh_string pubkey_s);
+SIGNATURE *signature_from_string(SSH_SESSION *session, ssh_string signature,PUBLIC_KEY *pubkey,int needed_type);
void signature_free(SIGNATURE *sign);
-STRING *ssh_do_sign_with_agent(struct ssh_session *session,
+ssh_string ssh_do_sign_with_agent(struct ssh_session *session,
struct ssh_buffer_struct *buf, struct ssh_public_key_struct *publickey);
-STRING *ssh_do_sign(SSH_SESSION *session,BUFFER *sigbuf,
+ssh_string ssh_do_sign(SSH_SESSION *session,BUFFER *sigbuf,
PRIVATE_KEY *privatekey);
-STRING *ssh_sign_session_id(SSH_SESSION *session, PRIVATE_KEY *privatekey);
-STRING *ssh_encrypt_rsa1(SSH_SESSION *session, STRING *data, PUBLIC_KEY *key);
+ssh_string ssh_sign_session_id(SSH_SESSION *session, PRIVATE_KEY *privatekey);
+ssh_string ssh_encrypt_rsa1(SSH_SESSION *session, ssh_string data, PUBLIC_KEY *key);
/* channel.c */
void channel_handle(SSH_SESSION *session, int type);
CHANNEL *channel_new(SSH_SESSION *session);
@@ -692,7 +692,7 @@ int ssh_options_default_ssh_dir(SSH_OPTIONS *opt);
int ssh_options_default_known_hosts_file(SSH_OPTIONS *opt);
/* buffer.c */
-int buffer_add_ssh_string(BUFFER *buffer, STRING *string);
+int buffer_add_ssh_string(BUFFER *buffer, ssh_string string);
int buffer_add_u8(BUFFER *buffer, u8 data);
int buffer_add_u32(BUFFER *buffer, u32 data);
int buffer_add_u64(BUFFER *buffer, u64 data);
@@ -713,9 +713,9 @@ int buffer_get_u64(BUFFER *buffer, u64 *data);
u32 buffer_get_data(BUFFER *buffer, void *data, u32 requestedlen);
/* buffer_get_ssh_string() is an exception. if the String read is too large or invalid, it will answer NULL. */
-STRING *buffer_get_ssh_string(BUFFER *buffer);
+ssh_string buffer_get_ssh_string(BUFFER *buffer);
/* gets a string out of a SSH-1 mpint */
-STRING *buffer_get_mpint(BUFFER *buffer);
+ssh_string buffer_get_mpint(BUFFER *buffer);
/* buffer_pass_bytes acts as if len bytes have been read (used for padding) */
u32 buffer_pass_bytes_end(BUFFER *buffer, u32 len);
u32 buffer_pass_bytes(BUFFER *buffer, u32 len);
@@ -740,7 +740,7 @@ u32 ssh_crc32(const char *buf, u32 len);
/* auth1.c */
int ssh_userauth1_none(SSH_SESSION *session, const char *username);
int ssh_userauth1_offer_pubkey(SSH_SESSION *session, const char *username,
- int type, STRING *pubkey);
+ int type, ssh_string pubkey);
int ssh_userauth1_password(SSH_SESSION *session, const char *username,
const char *password);
/* in misc.c */
diff --git a/include/libssh/sftp.h b/include/libssh/sftp.h
index 83c6f1de..446a72d1 100644
--- a/include/libssh/sftp.h
+++ b/include/libssh/sftp.h
@@ -81,7 +81,7 @@ typedef struct sftp_file{
SFTP_SESSION *sftp;
char *name;
u64 offset;
- STRING *handle;
+ ssh_string handle;
int eof;
int nonblocking;
} SFTP_FILE ;
@@ -89,7 +89,7 @@ typedef struct sftp_file{
typedef struct sftp_dir {
SFTP_SESSION *sftp;
char *name;
- STRING *handle; /* handle to directory */
+ ssh_string handle; /* handle to directory */
BUFFER *buffer; /* contains raw attributes from server which haven't been parsed */
u32 count; /* counts the number of following attributes structures into buffer */
int eof; /* end of directory listing */
@@ -110,12 +110,12 @@ typedef struct sftp_client_message{
char *filename; /* can be "path" */
u32 flags;
struct sftp_attributes *attr;
- STRING *handle;
+ ssh_string handle;
u64 offset;
u32 len;
int attr_num;
BUFFER *attrbuf; /* used by sftp_reply_attrs */
- STRING *data; /* can be newpath of rename() */
+ ssh_string data; /* can be newpath of rename() */
} SFTP_CLIENT_MESSAGE;
typedef struct request_queue{
@@ -127,8 +127,8 @@ typedef struct request_queue{
typedef struct {
u32 id;
u32 status;
- STRING *error;
- STRING *lang;
+ ssh_string error;
+ ssh_string lang;
char *errormsg;
char *langmsg;
} STATUS_MESSAGE;
@@ -153,10 +153,10 @@ typedef struct sftp_attributes{
u64 mtime64;
u32 mtime;
u32 mtime_nseconds;
- STRING *acl;
+ ssh_string acl;
u32 extended_count;
- STRING *extended_type;
- STRING *extended_data;
+ ssh_string extended_type;
+ ssh_string extended_data;
} SFTP_ATTRIBUTES;
#define LIBSFTP_VERSION 3
@@ -647,10 +647,10 @@ SFTP_CLIENT_MESSAGE *sftp_get_client_message(SFTP_SESSION *sftp);
void sftp_client_message_free(SFTP_CLIENT_MESSAGE *msg);
int sftp_reply_name(SFTP_CLIENT_MESSAGE *msg, const char *name,
SFTP_ATTRIBUTES *attr);
-int sftp_reply_handle(SFTP_CLIENT_MESSAGE *msg, STRING *handle);
-STRING *sftp_handle_alloc(SFTP_SESSION *sftp, void *info);
+int sftp_reply_handle(SFTP_CLIENT_MESSAGE *msg, ssh_string handle);
+ssh_string sftp_handle_alloc(SFTP_SESSION *sftp, void *info);
int sftp_reply_attr(SFTP_CLIENT_MESSAGE *msg, SFTP_ATTRIBUTES *attr);
-void *sftp_handle(SFTP_SESSION *sftp, STRING *handle);
+void *sftp_handle(SFTP_SESSION *sftp, ssh_string handle);
int sftp_reply_status(SFTP_CLIENT_MESSAGE *msg, u32 status, const char *message);
int sftp_reply_names_add(SFTP_CLIENT_MESSAGE *msg, const char *file,
const char *longname, SFTP_ATTRIBUTES *attr);