Commit cdddb5fb authored by Niels Möller's avatar Niels Möller
Browse files

Add object headers to most structures.

Rev: src/abstract_crypto.h:1.10
Rev: src/abstract_io.h:1.12
Rev: src/alist.c:1.3
Rev: src/alist.h:1.3
Rev: src/client_keyexchange.h:1.6
Rev: src/connection.h:1.16
Rev: src/io.h:1.10
parent f43f748f
......@@ -30,6 +30,7 @@
struct crypto_instance
{
struct lsh_object header;
UINT32 block_size;
/* Length must be a multiple of the block size */
void (*crypt)(struct crypto_instance *self,
......@@ -44,6 +45,7 @@ struct crypto_instance
struct crypto_algorithm
{
struct lsh_object header;
UINT32 block_size;
UINT32 key_size;
......@@ -60,6 +62,7 @@ struct crypto_algorithm
struct hash_instance
{
struct lsh_object header;
UINT32 hash_size;
void (*update)(struct hash_instance *self,
UINT32 length, UINT8 *data);
......@@ -82,6 +85,7 @@ struct hash_instance
struct hash_algorithm
{
struct lsh_object header;
UINT32 block_size;
UINT32 hash_size;
struct hash_instance * (*make_hash)(struct hash_algorithm *self);
......@@ -91,6 +95,7 @@ struct hash_algorithm
struct mac_algorithm
{
struct lsh_object header;
UINT32 hash_size;
UINT32 key_size;
struct mac_instance * (*make_mac)(struct mac_algorithm *self,
......@@ -101,6 +106,7 @@ struct mac_algorithm
struct signer
{
struct lsh_object header;
/* Returns a signature string, *without* the length field */
struct lsh_string * (*sign)(struct signer *closure,
UINT32 length,
......@@ -111,6 +117,7 @@ struct signer
struct verifier
{
struct lsh_object header;
int (*verify)(struct verifier *closure,
UINT32 length,
UINT8 *data,
......@@ -123,6 +130,7 @@ struct verifier
struct signature_algorithm
{
struct lsh_object header;
struct signer * (*make_signer)(struct signature_algorithm *closure,
UINT32 public_length,
UINT8 *public,
......
......@@ -40,6 +40,7 @@
struct abstract_read
{
struct lsh_object header;
int (*read)(struct abstract_read **r,
UINT32 length, UINT8 *buffer);
};
......@@ -49,6 +50,7 @@ struct abstract_read
/* May store a new handler into *h. */
struct read_handler
{
struct lsh_object header;
int (*handler)(struct read_handler **h,
struct abstract_read *read);
};
......@@ -72,6 +74,7 @@ struct read_handler
/* May store a new handler into *w. */
struct abstract_write
{
struct lsh_object header;
int (*write)(struct abstract_write **w,
struct lsh_string *packet);
};
......
......@@ -41,18 +41,26 @@ struct alist_table
static void *do_get(struct alist *c, int atom)
{
struct alist_table *closure = (struct alist_table *) c;
assert(atom >= 0);
assert(atom < NUMBER_OF_ATOMS);
MDEBUG(closure);
return ((struct alist_table *) c)->table[atom];
return closure->table[atom];
}
static void do_set(struct alist *c, int atom, void *value)
{
struct alist_table *closure = (struct alist_table *) c;
assert(atom >= 0);
assert(atom < NUMBER_OF_ATOMS);
((struct alist_table *) c)->table[atom] = value;
MDEBUG(closure);
closure->table[atom] = value;
}
struct alist *make_alist(int n, ...)
......
......@@ -26,10 +26,13 @@
#ifndef LSH_ALIST_H_INCLUDED
#define LSH_ALIST_H_INCLUDED
#include "lsh_types.h"
/* Abstract interface allows for multiple implementations ("real"
* alists, linear tables, hash tables */
struct alist
{
struct lsh_object header;
void * (*get)(struct alist *self, int atom);
void (*set)(struct alist *self, int atom, void *value);
};
......
......@@ -36,6 +36,7 @@
/* FIXME: This function needs the hostname we are connecting to. */
struct lookup_verifier
{
struct lsh_object header;
struct verifier * (*lookup)(struct lookup_verifier *closure,
struct lsh_string *key);
};
......
......@@ -16,6 +16,7 @@ struct ssh_connection;
struct packet_handler
{
struct lsh_object header;
int (*handler)(struct packet_handler *closure,
struct ssh_connection *connection,
struct lsh_string *packet);
......@@ -91,8 +92,7 @@ void connection_init_io(struct ssh_connection *connection,
struct abstract_write *raw,
struct randomness *r);
#if 0
struct abstract_write *make_unimplemented(struct connection *c);
#endif
struct packet_handler *make_fail_handler(void);
struct packet_handler *make_unimplemented_handler(void);
#endif /* LSH_CONNECTION_H_INCLUDED */
......@@ -35,6 +35,8 @@
struct io_fd
{
struct lsh_object header;
struct io_fd *next;
int fd;
......@@ -53,6 +55,8 @@ struct io_fd
struct fd_callback
{
struct lsh_object header;
int (*f)(struct fd_callback **closure, int fd);
};
......@@ -60,6 +64,8 @@ struct fd_callback
struct listen_fd
{
struct lsh_object header;
struct listen_fd *next;
int fd;
struct fd_callback *callback;
......@@ -67,6 +73,8 @@ struct listen_fd
struct connect_fd
{
struct lsh_object header;
struct connect_fd *next;
int fd;
struct fd_callback *callback;
......@@ -75,6 +83,8 @@ struct connect_fd
struct callout
{
struct lsh_object header;
struct callout *next;
struct callback *callout;
time_t when;
......@@ -83,6 +93,8 @@ struct callout
struct io_backend
{
struct lsh_object header;
unsigned nio;
struct io_fd *io;
unsigned nlisten;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment