1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-27 13:21:11 +03:00

move all u32,u16,u8 and u64 declarations in priv.h

And fix all headers which need u32,u8,u64
This commit is contained in:
Aris Adamantiadis
2009-07-24 22:31:39 +02:00
parent e406b81d34
commit 69a01b3657
4 changed files with 47 additions and 47 deletions

View File

@@ -94,13 +94,6 @@ typedef struct ssh_agent_struct* ssh_agent;
typedef struct ssh_session* ssh_session; typedef struct ssh_session* ssh_session;
typedef struct ssh_kbdint* ssh_kbdint; typedef struct ssh_kbdint* ssh_kbdint;
/* integer values */
typedef uint32_t u32;
typedef uint16_t u16;
typedef uint64_t u64;
typedef uint8_t u8;
/* Socket type */ /* Socket type */
#ifdef _WIN32 #ifdef _WIN32
#define socket_t SOCKET #define socket_t SOCKET
@@ -289,16 +282,16 @@ int channel_request_subsystem(ssh_channel channel, const char *system);
int channel_request_env(ssh_channel channel, const char *name, const char *value); int channel_request_env(ssh_channel channel, const char *name, const char *value);
int channel_request_exec(ssh_channel channel, const char *cmd); int channel_request_exec(ssh_channel channel, const char *cmd);
int channel_request_sftp(ssh_channel channel); int channel_request_sftp(ssh_channel channel);
int channel_write(ssh_channel channel, const void *data, u32 len); int channel_write(ssh_channel channel, const void *data, uint32_t len);
int channel_send_eof(ssh_channel channel); int channel_send_eof(ssh_channel channel);
int channel_is_eof(ssh_channel channel); int channel_is_eof(ssh_channel channel);
int channel_read(ssh_channel channel, void *dest, u32 count, int is_stderr); int channel_read(ssh_channel channel, void *dest, uint32_t count, int is_stderr);
int channel_read_buffer(ssh_channel channel, ssh_buffer buffer, u32 count, int channel_read_buffer(ssh_channel channel, ssh_buffer buffer, uint32_t count,
int is_stderr); int is_stderr);
int channel_poll(ssh_channel channel, int is_stderr); int channel_poll(ssh_channel channel, int is_stderr);
int channel_close(ssh_channel channel); int channel_close(ssh_channel channel);
void channel_set_blocking(ssh_channel channel, int blocking); void channel_set_blocking(ssh_channel channel, int blocking);
int channel_read_nonblocking(ssh_channel channel, void *dest, u32 count, int channel_read_nonblocking(ssh_channel channel, void *dest, uint32_t count,
int is_stderr); int is_stderr);
int channel_is_open(ssh_channel channel); int channel_is_open(ssh_channel channel);
int channel_is_closed(ssh_channel channel); int channel_is_closed(ssh_channel channel);
@@ -361,7 +354,8 @@ void buffer_free(ssh_buffer buffer);
/* buffer_get returns a pointer to the begining of the buffer. no position is taken into account */ /* buffer_get returns a pointer to the begining of the buffer. no position is taken into account */
void *buffer_get(ssh_buffer buffer); void *buffer_get(ssh_buffer buffer);
/* same here */ /* same here */
u32 buffer_get_len(ssh_buffer buffer); /* FIXME should be size_t */
uint32_t buffer_get_len(ssh_buffer buffer);
/* in auth.c */ /* in auth.c */

View File

@@ -49,6 +49,12 @@
#define TYPE_RSA 2 #define TYPE_RSA 2
#define TYPE_RSA1 3 #define TYPE_RSA1 3
/* integer values */
typedef uint32_t u32;
typedef uint16_t u16;
typedef uint64_t u64;
typedef uint8_t u8;
/* profiling constants. Don't touch them unless you know what you do */ /* profiling constants. Don't touch them unless you know what you do */
#ifdef HAVE_LIBCRYPTO #ifdef HAVE_LIBCRYPTO
#define OPENSSL_BIGNUMS #define OPENSSL_BIGNUMS

View File

@@ -150,7 +150,7 @@ int ssh_accept(SSH_SESSION *session);
typedef struct ssh_message SSH_MESSAGE; typedef struct ssh_message SSH_MESSAGE;
SSH_MESSAGE *ssh_message_retrieve(SSH_SESSION *session, u32 packettype); SSH_MESSAGE *ssh_message_retrieve(SSH_SESSION *session, uint32_t packettype);
SSH_MESSAGE *ssh_message_get(SSH_SESSION *session); SSH_MESSAGE *ssh_message_get(SSH_SESSION *session);
int ssh_message_type(SSH_MESSAGE *msg); int ssh_message_type(SSH_MESSAGE *msg);
int ssh_message_subtype(SSH_MESSAGE *msg); int ssh_message_subtype(SSH_MESSAGE *msg);

View File

@@ -65,14 +65,14 @@ typedef struct sftp_session_struct {
int client_version; int client_version;
int version; int version;
struct request_queue *queue; struct request_queue *queue;
u32 id_counter; uint32_t id_counter;
int errnum; int errnum;
void **handles; void **handles;
} SFTP_SESSION ; } SFTP_SESSION ;
typedef struct { typedef struct {
SFTP_SESSION *sftp; SFTP_SESSION *sftp;
u8 type; uint8_t type;
ssh_buffer payload; ssh_buffer payload;
} SFTP_PACKET; } SFTP_PACKET;
@@ -80,7 +80,7 @@ typedef struct {
typedef struct sftp_file{ typedef struct sftp_file{
SFTP_SESSION *sftp; SFTP_SESSION *sftp;
char *name; char *name;
u64 offset; uint64_t offset;
ssh_string handle; ssh_string handle;
int eof; int eof;
int nonblocking; int nonblocking;
@@ -91,28 +91,28 @@ typedef struct sftp_dir {
char *name; char *name;
ssh_string handle; /* handle to directory */ ssh_string handle; /* handle to directory */
ssh_buffer buffer; /* contains raw attributes from server which haven't been parsed */ ssh_buffer buffer; /* contains raw attributes from server which haven't been parsed */
u32 count; /* counts the number of following attributes structures into buffer */ uint32_t count; /* counts the number of following attributes structures into buffer */
int eof; /* end of directory listing */ int eof; /* end of directory listing */
} SFTP_DIR; } SFTP_DIR;
typedef struct { typedef struct {
SFTP_SESSION *sftp; SFTP_SESSION *sftp;
u8 packet_type; uint8_t packet_type;
ssh_buffer payload; ssh_buffer payload;
u32 id; uint32_t id;
} SFTP_MESSAGE; } SFTP_MESSAGE;
/* this is a bunch of all data that could be into a message */ /* this is a bunch of all data that could be into a message */
typedef struct sftp_client_message{ typedef struct sftp_client_message{
SFTP_SESSION *sftp; SFTP_SESSION *sftp;
u8 type; uint8_t type;
u32 id; uint32_t id;
char *filename; /* can be "path" */ char *filename; /* can be "path" */
u32 flags; uint32_t flags;
struct sftp_attributes *attr; struct sftp_attributes *attr;
ssh_string handle; ssh_string handle;
u64 offset; uint64_t offset;
u32 len; uint32_t len;
int attr_num; int attr_num;
ssh_buffer attrbuf; /* used by sftp_reply_attrs */ ssh_buffer attrbuf; /* used by sftp_reply_attrs */
ssh_string data; /* can be newpath of rename() */ ssh_string data; /* can be newpath of rename() */
@@ -125,8 +125,8 @@ typedef struct request_queue{
/* SSH_FXP_MESSAGE described into .7 page 26 */ /* SSH_FXP_MESSAGE described into .7 page 26 */
typedef struct { typedef struct {
u32 id; uint32_t id;
u32 status; uint32_t status;
ssh_string error; ssh_string error;
ssh_string lang; ssh_string lang;
char *errormsg; char *errormsg;
@@ -137,24 +137,24 @@ typedef struct {
typedef struct sftp_attributes{ typedef struct sftp_attributes{
char *name; char *name;
char *longname; /* some weird stuff */ char *longname; /* some weird stuff */
u32 flags; uint32_t flags;
u8 type; uint8_t type;
u64 size; uint64_t size;
u32 uid; uint32_t uid;
u32 gid; uint32_t gid;
char *owner; char *owner;
char *group; char *group;
u32 permissions; uint32_t permissions;
u64 atime64; uint64_t atime64;
u32 atime; uint32_t atime;
u32 atime_nseconds; uint32_t atime_nseconds;
u64 createtime; uint64_t createtime;
u32 createtime_nseconds; uint32_t createtime_nseconds;
u64 mtime64; uint64_t mtime64;
u32 mtime; uint32_t mtime;
u32 mtime_nseconds; uint32_t mtime_nseconds;
ssh_string acl; ssh_string acl;
u32 extended_count; uint32_t extended_count;
ssh_string extended_type; ssh_string extended_type;
ssh_string extended_data; ssh_string extended_data;
} SFTP_ATTRIBUTES; } SFTP_ATTRIBUTES;
@@ -390,7 +390,7 @@ ssize_t sftp_read(SFTP_FILE *file, void *buf, size_t count);
* @see sftp_async_read() * @see sftp_async_read()
* @see sftp_open() * @see sftp_open()
*/ */
int sftp_async_read_begin(SFTP_FILE *file, u32 len); int sftp_async_read_begin(SFTP_FILE *file, uint32_t len);
/** /**
* @brief Wait for an asynchronous read to complete and save the data. * @brief Wait for an asynchronous read to complete and save the data.
@@ -415,7 +415,7 @@ int sftp_async_read_begin(SFTP_FILE *file, u32 len);
* *
* @see sftp_async_read_begin() * @see sftp_async_read_begin()
*/ */
int sftp_async_read(SFTP_FILE *file, void *data, u32 len, u32 id); int sftp_async_read(SFTP_FILE *file, void *data, uint32_t len, uint32_t id);
/** /**
* @brief Write to a file using an opened sftp file handle. * @brief Write to a file using an opened sftp file handle.
@@ -444,7 +444,7 @@ ssize_t sftp_write(SFTP_FILE *file, const void *buf, size_t count);
* *
* @return 0 on success, < 0 on error. * @return 0 on success, < 0 on error.
*/ */
int sftp_seek(SFTP_FILE *file, u32 new_offset); int sftp_seek(SFTP_FILE *file, uint32_t new_offset);
/** /**
* @brief Seek to a specific location in a file. This is the * @brief Seek to a specific location in a file. This is the
@@ -456,7 +456,7 @@ int sftp_seek(SFTP_FILE *file, u32 new_offset);
* *
* @return 0 on success, < 0 on error. * @return 0 on success, < 0 on error.
*/ */
int sftp_seek64(SFTP_FILE *file, u64 new_offset); int sftp_seek64(SFTP_FILE *file, uint64_t new_offset);
/** /**
* @brief Report current byte position in file. * @brief Report current byte position in file.
@@ -637,7 +637,7 @@ int sftp_server_init(SFTP_SESSION *sftp);
/* this is not a public interface */ /* this is not a public interface */
#define SFTP_HANDLES 256 #define SFTP_HANDLES 256
SFTP_PACKET *sftp_packet_read(SFTP_SESSION *sftp); SFTP_PACKET *sftp_packet_read(SFTP_SESSION *sftp);
int sftp_packet_write(SFTP_SESSION *sftp,u8 type, ssh_buffer payload); int sftp_packet_write(SFTP_SESSION *sftp,uint8_t type, ssh_buffer payload);
void sftp_packet_free(SFTP_PACKET *packet); void sftp_packet_free(SFTP_PACKET *packet);
int buffer_add_attributes(ssh_buffer buffer, SFTP_ATTRIBUTES *attr); int buffer_add_attributes(ssh_buffer buffer, SFTP_ATTRIBUTES *attr);
SFTP_ATTRIBUTES *sftp_parse_attr(SFTP_SESSION *session, ssh_buffer buf,int expectname); SFTP_ATTRIBUTES *sftp_parse_attr(SFTP_SESSION *session, ssh_buffer buf,int expectname);
@@ -651,7 +651,7 @@ int sftp_reply_handle(SFTP_CLIENT_MESSAGE *msg, ssh_string handle);
ssh_string sftp_handle_alloc(SFTP_SESSION *sftp, void *info); ssh_string sftp_handle_alloc(SFTP_SESSION *sftp, void *info);
int sftp_reply_attr(SFTP_CLIENT_MESSAGE *msg, SFTP_ATTRIBUTES *attr); int sftp_reply_attr(SFTP_CLIENT_MESSAGE *msg, SFTP_ATTRIBUTES *attr);
void *sftp_handle(SFTP_SESSION *sftp, ssh_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_status(SFTP_CLIENT_MESSAGE *msg, uint32_t status, const char *message);
int sftp_reply_names_add(SFTP_CLIENT_MESSAGE *msg, const char *file, int sftp_reply_names_add(SFTP_CLIENT_MESSAGE *msg, const char *file,
const char *longname, SFTP_ATTRIBUTES *attr); const char *longname, SFTP_ATTRIBUTES *attr);
int sftp_reply_names(SFTP_CLIENT_MESSAGE *msg); int sftp_reply_names(SFTP_CLIENT_MESSAGE *msg);