~ubuntu-branches/ubuntu/trusty/libssh/trusty-security

« back to all changes in this revision

Viewing changes to include/libssh/misc.h

  • Committer: Bazaar Package Importer
  • Author(s): Laurent Bigonville
  • Date: 2009-12-12 14:29:12 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20091212142912-ha5g2iibt6nfnjq8
Tags: 0.4.0-1
* New upstream release.
  - Bump soname
  - Adjust .symbols file
* Readd static library in -dev package
* Let dh_lintian install override file
* debian/README.Debian: Update file
* debian/rules: Add list-missing rule

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * This file is part of the SSH Library
 
3
 *
 
4
 * Copyright (c) 2009 by Aris Adamantiadis
 
5
 *
 
6
 * The SSH Library is free software; you can redistribute it and/or modify
 
7
 * it under the terms of the GNU Lesser General Public License as published by
 
8
 * the Free Software Foundation; either version 2.1 of the License, or (at your
 
9
 * option) any later version.
 
10
 *
 
11
 * The SSH Library is distributed in the hope that it will be useful, but
 
12
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 
13
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
 
14
 * License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU Lesser General Public License
 
17
 * along with the SSH Library; see the file COPYING.  If not, write to
 
18
 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
 
19
 * MA 02111-1307, USA.
 
20
 */
 
21
 
 
22
#ifndef MISC_H_
 
23
#define MISC_H_
 
24
 
 
25
/* in misc.c */
 
26
/* gets the user home dir. */
 
27
char *ssh_get_user_home_dir(void);
 
28
int ssh_file_readaccess_ok(const char *file);
 
29
 
 
30
/* macro for byte ordering */
 
31
uint64_t ntohll(uint64_t);
 
32
#define htonll(x) ntohll(x)
 
33
 
 
34
/* list processing */
 
35
 
 
36
struct ssh_list {
 
37
  struct ssh_iterator *root;
 
38
  struct ssh_iterator *end;
 
39
};
 
40
 
 
41
struct ssh_iterator {
 
42
  struct ssh_iterator *next;
 
43
  const void *data;
 
44
};
 
45
 
 
46
struct ssh_list *ssh_list_new(void);
 
47
void ssh_list_free(struct ssh_list *list);
 
48
struct ssh_iterator *ssh_list_get_iterator(const struct ssh_list *list);
 
49
int ssh_list_add(struct ssh_list *list, const void *data);
 
50
void ssh_list_remove(struct ssh_list *list, struct ssh_iterator *iterator);
 
51
 
 
52
/** @brief fetch the head element of a list and remove it from list
 
53
 * @param list the ssh_list to use
 
54
 * @return the first element of the list
 
55
 */
 
56
const void *_ssh_list_get_head(struct ssh_list *list);
 
57
 
 
58
#define ssh_iterator_value(type, iterator)\
 
59
  ((type)((iterator)->data))
 
60
 
 
61
/** @brief fetch the head element of a list and remove it from list
 
62
 * @param type type of the element to return
 
63
 * @param list the ssh_list to use
 
64
 * @return the first element of the list
 
65
 */
 
66
#define ssh_list_get_head(type, ssh_list)\
 
67
  ((type)_ssh_list_get_head(ssh_list))
 
68
 
 
69
#endif /* MISC_H_ */