2 * include/contex.h - type representing the context execution of a command.
\r
4 * Copyright 2008,2009 Martin Quinson, Malek Cherier All right reserved.
\r
6 * This program is free software; you can redistribute it and/or modify it
\r
7 * under the terms of the license (GNU LGPL) which comes with this package.
\r
10 * This file contains all the declarations of the functions related with
\r
11 * the tesh context type.
\r
24 /*! \brief create_new - create a new context.
\r
26 * \return If successful the function returns the newly created
\r
27 * command. Otherwise the function returns NULL and sets the
\r
28 * global variable errno with the appropiate error code.
\r
29 * [ENOMEM] if the system has not enough space to allocate
\r
35 /*! \brief context_free - destroy a context object.
\r
37 * \param ptr A pointer to the context object to destroy.
\r
39 * \return If successful the function returns the 0. Otherwise
\r
40 * the function returns -1 and sets the global variable
\r
41 * errno with the appropiate error code.
\r
44 * [EINVAL] if the context object pointed to by the ptr parameter is invalid.
\r
48 context_free(context_t* ptr);
\r
50 /*! \brief context_dup - duplicate a context object.
\r
52 * \param context The context to duplicate.
\r
54 * \return If successful the function returns the duplicate. Otherwise
\r
55 * the function returns NULL and sets the global variable
\r
56 * errno with the appropiate error code.
\r
59 * [EINVAL] if the parameter is invalid.
\r
60 * [ENOMEM] if there is not enough memory to allocate the duplicate.
\r
64 context_dup(context_t context);
\r
67 /*! \brief context_reset - reset a context object.
\r
69 * \param context The context to reset.
\r
71 * \return If successful the function returns 0. Otherwise
\r
72 * the function returns -1 and sets the global variable
\r
73 * errno with the appropiate error code.
\r
76 * [EINVAL] if the parameter is invalid.
\r
80 context_reset(context_t context);
\r
83 context_clear(context_t context);
\r
86 context_input_write(context_t context, const char* buffer);
\r
89 context_ouput_read(context_t context, const char* buffer);
\r
97 #endif /* !_CONTEXT_H */
\r