diff options
author | Aris Adamantiadis <aris@0xbadc0de.be> | 2009-06-18 23:01:05 +0200 |
---|---|---|
committer | Aris Adamantiadis <aris@0xbadc0de.be> | 2009-06-18 23:01:05 +0200 |
commit | 3af55a4f49f32ba73af86c6c47f0ed05044eec13 (patch) | |
tree | f2daa2a17772ed9c3e18c8cb6c423087f5ae9e93 /include/libssh/priv.h | |
parent | cf482ae3bfb8492d996cfc9e036f5086ff69eed4 (diff) | |
download | libssh-3af55a4f49f32ba73af86c6c47f0ed05044eec13.tar.gz libssh-3af55a4f49f32ba73af86c6c47f0ed05044eec13.tar.xz libssh-3af55a4f49f32ba73af86c6c47f0ed05044eec13.zip |
Created general singlelinked list implementation
Diffstat (limited to 'include/libssh/priv.h')
-rw-r--r-- | include/libssh/priv.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/include/libssh/priv.h b/include/libssh/priv.h index f344cedd..d0d0ea2d 100644 --- a/include/libssh/priv.h +++ b/include/libssh/priv.h @@ -705,6 +705,41 @@ int ssh_file_readaccess_ok(const char *file); u64 ntohll(u64); #define htonll(x) ntohll(x) +/* list processing */ + +struct ssh_list { + struct ssh_iterator *root; + struct ssh_iterator *end; +}; + +struct ssh_iterator { + struct ssh_iterator *next; + const void *data; +}; + +struct ssh_list *ssh_list_new(void); +void ssh_list_free(struct ssh_list *list); +struct ssh_iterator *ssh_list_get_iterator(const struct ssh_list *list); +void ssh_list_add(struct ssh_list *list, const void *data); +void ssh_list_remove(struct ssh_list *list, struct ssh_iterator *iterator); + +/** @brief fetch the head element of a list and remove it from list + * @param list the ssh_list to use + * @return the first element of the list + */ +const void *_ssh_list_get_head(struct ssh_list *list); + +#define ssh_iterator_value(type, iterator)\ + ((type)((iterator)->data)) +/** @brief fetch the head element of a list and remove it from list + * @param type type of the element to return + * @param list the ssh_list to use + * @return the first element of the list + */ +#define ssh_list_get_head(type, ssh_list)\ + ((type)_ssh_list_head(ssh_list)) + + /* channels1.c */ int channel_open_session1(CHANNEL *channel); int channel_request_pty_size1(CHANNEL *channel, const char *terminal, |