Annotation of embedaddon/strongswan/src/libcharon/plugins/dhcp/dhcp_transaction.h, revision 1.1.1.1

1.1       misho       1: /*
                      2:  * Copyright (C) 2010 Martin Willi
                      3:  * Copyright (C) 2010 revosec AG
                      4:  *
                      5:  * This program is free software; you can redistribute it and/or modify it
                      6:  * under the terms of the GNU General Public License as published by the
                      7:  * Free Software Foundation; either version 2 of the License, or (at your
                      8:  * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
                      9:  *
                     10:  * This program is distributed in the hope that it will be useful, but
                     11:  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
                     12:  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
                     13:  * for more details.
                     14:  */
                     15: 
                     16: /**
                     17:  * @defgroup dhcp_transaction dhcp_transaction
                     18:  * @{ @ingroup dhcp
                     19:  */
                     20: 
                     21: #ifndef DHCP_TRANSACTION_H_
                     22: #define DHCP_TRANSACTION_H_
                     23: 
                     24: #include <networking/host.h>
                     25: #include <utils/identification.h>
                     26: #include <attributes/attributes.h>
                     27: 
                     28: typedef struct dhcp_transaction_t dhcp_transaction_t;
                     29: 
                     30: /**
                     31:  * DHCP transaction class.
                     32:  */
                     33: struct dhcp_transaction_t {
                     34: 
                     35:        /**
                     36:         * Get the DHCP transaction ID.
                     37:         *
                     38:         * @return                      DHCP transaction identifier
                     39:         */
                     40:        uint32_t (*get_id)(dhcp_transaction_t *this);
                     41: 
                     42:        /**
                     43:         * Get the peer identity this transaction is used for.
                     44:         *
                     45:         * @return                      peer Identity
                     46:         */
                     47:        identification_t* (*get_identity)(dhcp_transaction_t *this);
                     48: 
                     49:        /**
                     50:         * Set the DHCP address received using this transaction.
                     51:         *
                     52:         * @param host          received DHCP address
                     53:         */
                     54:        void (*set_address)(dhcp_transaction_t *this, host_t *address);
                     55: 
                     56:        /**
                     57:         * Get the DHCP address received using this transaction.
                     58:         *
                     59:         * @return                      received DHCP address
                     60:         */
                     61:        host_t* (*get_address)(dhcp_transaction_t *this);
                     62: 
                     63:        /**
                     64:         * Set the DHCP server address discovered.
                     65:         *
                     66:         * @param server        DHCP server address
                     67:         */
                     68:        void (*set_server)(dhcp_transaction_t *this, host_t *server);
                     69: 
                     70:        /**
                     71:         * Get the DHCP server address.
                     72:         *
                     73:         * @return                      DHCP server address
                     74:         */
                     75:        host_t* (*get_server)(dhcp_transaction_t *this);
                     76: 
                     77:        /**
                     78:         * Add an additional attribute to serve to peer.
                     79:         *
                     80:         * @param type          type of attribute
                     81:         * @param data          attribute data
                     82:         */
                     83:        void (*add_attribute)(dhcp_transaction_t *this,
                     84:                                                  configuration_attribute_type_t type, chunk_t data);
                     85: 
                     86:        /**
                     87:         * Create an enumerator over added attributes.
                     88:         *
                     89:         * @return                      enumerator over (configuration_attribute_t, chunk_t)
                     90:         */
                     91:        enumerator_t* (*create_attribute_enumerator)(dhcp_transaction_t *this);
                     92: 
                     93:        /**
                     94:         * Destroy a dhcp_transaction_t.
                     95:         */
                     96:        void (*destroy)(dhcp_transaction_t *this);
                     97: };
                     98: 
                     99: /**
                    100:  * Create a dhcp_transaction instance.
                    101:  *
                    102:  * @param id           DHCP transaction identifier
                    103:  * @param identity     peer identity this transaction is used for
                    104:  * @return                     transaction instance
                    105:  */
                    106: dhcp_transaction_t *dhcp_transaction_create(uint32_t id,
                    107:                                                                                        identification_t *identity);
                    108: 
                    109: #endif /** DHCP_TRANSACTION_H_ @}*/

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>