diff options
210 files changed, 12096 insertions, 7237 deletions
diff --git a/INSTALL-WIN32.md b/INSTALL-WIN32.md index 1e5e1f45fa..93b7e3a1e1 100644 --- a/INSTALL-WIN32.md +++ b/INSTALL-WIN32.md @@ -600,32 +600,36 @@ OpenSSL. Well' here's the list: Windows command prompt (it should be on the same drive as where you are going to install it if everything is to work smothly). - `C:\> cd <some dir>` + C:\> cd <some dir> Add ActiveState (or some other windows perl, not cygwins) to your PATH: - `C:\...\> set PATH=C:\Perl\bin;%PATH%` + C:\...\> set PATH=C:\Perl\bin;%PATH% + + Or if you installed the 64bit perl: + + C:\...\> set PATH=C:\Perl64\bin;%PATH% Configure OpenSSL for 32 bit: - `C:\...\> perl Configure VC-WIN32 --prefix=/OpenSSL` + C:\...\> perl Configure VC-WIN32 --prefix=/OpenSSL Or for 64 bit: - `C:\...\> perl Configure VC-WIN64A --prefix=/OpenSSL-Win64` + C:\...\> perl Configure VC-WIN64A --prefix=/OpenSSL-Win64 Do some setup (for 32 bit): - `C:\...\> ms\do_win32` + C:\...\> ms\do_ms The same for 64 bit: - `C:\...\> ms\do_win64a` + C:\...\> ms\do_win64a Then build static libraries and install: - `C:\...\> nmake -f ms\nt.mak` - `C:\...\> nmake -f ms\nt.mak install` + C:\...\> nmake -f ms\nt.mak + C:\...\> nmake -f ms\nt.mak install That's it - you now have your perfectly consistent static build of openssl. If you want to get rid of any possibly patented @@ -644,19 +648,21 @@ OpenSSL. Well' here's the list: edit: `C:\cygwin\opt\local\pgm\wxMSW-2.8.11\include\wx\msw\setup.h` enable `wxUSE_GLCANVAS`, `wxUSE_POSTSCRIPT` and `wxUSE_GRAPHICS_CONTEXT` - build: From a command prompt with the VC tools available (usually started from a - shortcut installed by the SDK/Visual Studio): + build: From a command prompt with the VC tools available (See the + instructions for OpenSSL build above for help on starting the + proper command prompt in RELEASE mode): - `cd C:\cygwin\opt\local\pgm\wxMSW-2.8.11\build\msw` - `nmake BUILD=release SHARED=0 UNICODE=1 USE_OPENGL=1 USE_GDIPLUS=1 DIR_SUFFIX_CPU= -f makefile.vc` - `cd C:\cygwin\opt\local\pgm\wxMSW-2.8.11\contrib\build\stc` - `nmake BUILD=release SHARED=0 UNICODE=1 USE_OPENGL=1 USE_GDIPLUS=1 DIR_SUFFIX_CPU= -f makefile.vc` + C:\...\> cd C:\cygwin\opt\local\pgm\wxMSW-2.8.11\build\msw + C:\...\> nmake BUILD=release SHARED=0 UNICODE=1 USE_OPENGL=1 USE_GDIPLUS=1 DIR_SUFFIX_CPU= -f makefile.vc + C:\...\> cd C:\cygwin\opt\local\pgm\wxMSW-2.8.11\contrib\build\stc + C:\...\> nmake BUILD=release SHARED=0 UNICODE=1 USE_OPENGL=1 USE_GDIPLUS=1 DIR_SUFFIX_CPU= -f makefile.vc Or - if building a 64bit version: - `cd C:\cygwin\opt\local\pgm\wxMSW-2.8.11\build\msw` - `nmake TARGET_CPU=amd64 BUILD=release SHARED=0 UNICODE=1 USE_OPENGL=1 USE_GDIPLUS=1 DIR_SUFFIX_CPU= -f makefile.vc` - `cd C:\cygwin\opt\local\pgm\wxMSW-2.8.11\contrib\build\stc` - `nmake TARGET_CPU=amd64 BUILD=release SHARED=0 UNICODE=1 USE_OPENGL=1 USE_GDIPLUS=1 DIR_SUFFIX_CPU= -f makefile.vc` + + C:\...\> cd C:\cygwin\opt\local\pgm\wxMSW-2.8.11\build\msw + C:\...\> nmake TARGET_CPU=amd64 BUILD=release SHARED=0 UNICODE=1 USE_OPENGL=1 USE_GDIPLUS=1 DIR_SUFFIX_CPU= -f makefile.vc + C:\...\> cd C:\cygwin\opt\local\pgm\wxMSW-2.8.11\contrib\build\stc + C:\...\> nmake TARGET_CPU=amd64 BUILD=release SHARED=0 UNICODE=1 USE_OPENGL=1 USE_GDIPLUS=1 DIR_SUFFIX_CPU= -f makefile.vc * The Erlang source distribution (from <http://www.erlang.org/download.html>). The same as for Unix platforms. Preferably use tar from within Cygwin to diff --git a/erts/emulator/beam/io.c b/erts/emulator/beam/io.c index b23b1f628d..fe1a7ba345 100644 --- a/erts/emulator/beam/io.c +++ b/erts/emulator/beam/io.c @@ -743,7 +743,7 @@ driver_create_port(ErlDrvPort creator_port_ix, /* Creating port */ return (ErlDrvTermData) -1; /* pid does not exist */ } if ((port_num = get_free_port()) < 0) { - errno = ENFILE; + errno = SYSTEM_LIMIT; erts_smp_proc_unlock(rp, ERTS_PROC_LOCK_LINK); erts_smp_mtx_unlock(&erts_driver_list_lock); return (ErlDrvTermData) -1; diff --git a/erts/emulator/drivers/common/efile_drv.c b/erts/emulator/drivers/common/efile_drv.c index 36ed108b76..a251b064da 100644 --- a/erts/emulator/drivers/common/efile_drv.c +++ b/erts/emulator/drivers/common/efile_drv.c @@ -156,11 +156,11 @@ static ErlDrvSysInfo sys_info; * DARWIN. The testcase t_sendfile_crashduring reproduces * this error when using +A 10. */ -#if !defined(DARWIN) -#define USE_THRDS_FOR_SENDFILE (sys_info.async_threads > 0) -#else +#if defined(__APPLE__) && defined(__MACH__) #define USE_THRDS_FOR_SENDFILE 0 -#endif /* !DARWIN */ +#else +#define USE_THRDS_FOR_SENDFILE (sys_info.async_threads > 0) +#endif /* defined(__APPLE__) && defined(__MACH__) */ @@ -259,6 +259,7 @@ static void file_stop_select(ErlDrvEvent event, void* _); enum e_timer {timer_idle, timer_again, timer_write}; #ifdef HAVE_SENDFILE enum e_sendfile {sending, not_sending}; +static void free_sendfile(void *data); #endif /* HAVE_SENDFILE */ struct t_data; @@ -445,6 +446,8 @@ struct t_data } fadvise; #ifdef HAVE_SENDFILE struct { + ErlDrvPort port; + ErlDrvPDL q_mtx; int out_fd; off_t offset; Uint64 nbytes; @@ -752,15 +755,6 @@ file_stop(ErlDrvData e) TRACE_C('p'); -#ifdef HAVE_SENDFILE - if (desc->sendfile_state == sending && !USE_THRDS_FOR_SENDFILE) { - driver_select(desc->port,(ErlDrvEvent)(long)desc->d->c.sendfile.out_fd, - ERL_DRV_WRITE|ERL_DRV_USE,0); - } else if (desc->sendfile_state == sending) { - SET_NONBLOCKING(desc->d->c.sendfile.out_fd); - } -#endif /* HAVE_SENDFILE */ - if (desc->fd != FILE_FD_INVALID) { do_close(desc->flags, desc->fd); desc->fd = FILE_FD_INVALID; @@ -1783,26 +1777,31 @@ static void invoke_sendfile(void *data) d->c.sendfile.written += nbytes; - if (result == 1) { - if (USE_THRDS_FOR_SENDFILE) { - d->result_ok = 0; - } else if (d->c.sendfile.nbytes == 0 && nbytes != 0) { - d->result_ok = 1; - } else if ((d->c.sendfile.nbytes - nbytes) != 0) { - d->result_ok = 1; - d->c.sendfile.nbytes -= nbytes; - } else { - d->result_ok = 0; - } + if (result == 1 || (result == 0 && USE_THRDS_FOR_SENDFILE)) { + d->result_ok = 0; } else if (result == 0 && (d->errInfo.posix_errno == EAGAIN || d->errInfo.posix_errno == EINTR)) { + if ((d->c.sendfile.nbytes - nbytes) != 0) { d->result_ok = 1; + if (d->c.sendfile.nbytes != 0) + d->c.sendfile.nbytes -= nbytes; + } else + d->result_ok = 0; } else { d->result_ok = -1; } } static void free_sendfile(void *data) { + struct t_data *d = (struct t_data *)data; + if (USE_THRDS_FOR_SENDFILE) { + SET_NONBLOCKING(d->c.sendfile.out_fd); + } else { + MUTEX_LOCK(d->c.sendfile.q_mtx); + driver_deq(d->c.sendfile.port,1); + MUTEX_UNLOCK(d->c.sendfile.q_mtx); + driver_select(d->c.sendfile.port, (ErlDrvEvent)(long)d->c.sendfile.out_fd, ERL_DRV_USE_NO_CALLBACK|ERL_DRV_WRITE, 0); + } EF_FREE(data); } @@ -1812,7 +1811,7 @@ static void file_ready_output(ErlDrvData data, ErlDrvEvent event) switch (fd->d->command) { case FILE_SENDFILE: - driver_select(fd->port, event, + driver_select(fd->d->c.sendfile.port, event, (int)ERL_DRV_WRITE,(int) 0); invoke_sendfile((void *)fd->d); file_async_ready(data, (ErlDrvThreadData)fd->d); @@ -1826,6 +1825,15 @@ static void file_stop_select(ErlDrvEvent event, void* _) { } + +static int flush_sendfile(file_descriptor *desc,void *_) { + if (desc->sendfile_state == sending) { + desc->d->result_ok = -1; + desc->d->errInfo.posix_errno = ECONNABORTED; + file_async_ready((ErlDrvData)desc,(ErlDrvThreadData)desc->d); + } + return 1; +} #endif /* HAVE_SENDFILE */ @@ -2248,36 +2256,23 @@ file_async_ready(ErlDrvData e, ErlDrvThreadData data) #ifdef HAVE_SENDFILE case FILE_SENDFILE: if (d->result_ok == -1) { - desc->sendfile_state = not_sending; if (d->errInfo.posix_errno == ECONNRESET || d->errInfo.posix_errno == ENOTCONN || d->errInfo.posix_errno == EPIPE) reply_string_error(desc,"closed"); else reply_error(desc, &d->errInfo); - if (USE_THRDS_FOR_SENDFILE) { - SET_NONBLOCKING(d->c.sendfile.out_fd); - free_sendfile(data); - } else { - driver_select(desc->port, (ErlDrvEvent)(long)d->c.sendfile.out_fd, - ERL_DRV_USE, 0); - free_sendfile(data); - } - } else if (d->result_ok == 0) { desc->sendfile_state = not_sending; + free_sendfile(data); + } else if (d->result_ok == 0) { reply_Sint64(desc, d->c.sendfile.written); - if (USE_THRDS_FOR_SENDFILE) { - SET_NONBLOCKING(d->c.sendfile.out_fd); - free_sendfile(data); - } else { - driver_select(desc->port, (ErlDrvEvent)(long)d->c.sendfile.out_fd, ERL_DRV_USE, 0); - free_sendfile(data); - } + desc->sendfile_state = not_sending; + free_sendfile(data); } else if (d->result_ok == 1) { // If we are using select to send the rest of the data desc->sendfile_state = sending; desc->d = d; driver_select(desc->port, (ErlDrvEvent)(long)d->c.sendfile.out_fd, - ERL_DRV_USE|ERL_DRV_WRITE, 1); + ERL_DRV_USE_NO_CALLBACK|ERL_DRV_WRITE, 1); } break; #endif @@ -2655,6 +2650,10 @@ file_flush(ErlDrvData e) { TRACE_C('f'); +#ifdef HAVE_SENDFILE + flush_sendfile(desc, NULL); +#endif + #ifdef DEBUG r = #endif @@ -3454,11 +3453,13 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) { d->fd = desc->fd; d->command = command; d->invoke = invoke_sendfile; - d->free = NULL; + d->free = free_sendfile; d->level = 2; d->c.sendfile.out_fd = (int) out_fd; d->c.sendfile.written = 0; + d->c.sendfile.port = desc->port; + d->c.sendfile.q_mtx = desc->q_mtx; #if SIZEOF_OFF_T == 4 if (offsetH != 0) { @@ -3474,6 +3475,19 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) { if (USE_THRDS_FOR_SENDFILE) { SET_BLOCKING(d->c.sendfile.out_fd); + } else { + /** + * Write a place holder to queue in order to force file_flush + * to be called before the driver is closed. + */ + char tmp[1] = ""; + MUTEX_LOCK(d->c.sendfile.q_mtx); + if (driver_enq(d->c.sendfile.port, tmp, 1)) { + MUTEX_UNLOCK(d->c.sendfile.q_mtx); + reply_posix_error(desc, ENOMEM); + goto done; + } + MUTEX_UNLOCK(d->c.sendfile.q_mtx); } cq_enq(desc, d); diff --git a/erts/emulator/drivers/common/inet_drv.c b/erts/emulator/drivers/common/inet_drv.c index 47a99fdbe6..d1c2dbf94c 100644 --- a/erts/emulator/drivers/common/inet_drv.c +++ b/erts/emulator/drivers/common/inet_drv.c @@ -553,6 +553,12 @@ static int my_strncasecmp(const char *s1, const char *s2, size_t n) # define VALGRIND_MAKE_MEM_DEFINED(ptr,size) #endif +/* + Magic errno value used locally for return of {error, system_limit} + - the emulator definition of SYSTEM_LIMIT is not available here. +*/ +#define INET_ERRNO_SYSTEM_LIMIT (15 << 8) + /*---------------------------------------------------------------------------- ** Interface constants. ** @@ -1645,6 +1651,17 @@ static struct erl_drv_entry dummy_sctp_driver_entry = #endif +/* return lowercase string form of errno value */ +static char *errno_str(int err) +{ + switch (err) { + case INET_ERRNO_SYSTEM_LIMIT: + return "system_limit"; + default: + return erl_errno_id(err); + } +} + /* general control reply function */ static ErlDrvSSizeT ctl_reply(int rep, char* buf, ErlDrvSizeT len, char** rbuf, ErlDrvSizeT rsize) @@ -1665,13 +1682,9 @@ static ErlDrvSSizeT ctl_reply(int rep, char* buf, ErlDrvSizeT len, /* general control error reply function */ static ErlDrvSSizeT ctl_error(int err, char** rbuf, ErlDrvSizeT rsize) { - char response[256]; /* Response buffer. */ - char* s; - char* t; + char* s = errno_str(err); - for (s = erl_errno_id(err), t = response; *s; s++, t++) - *t = tolower(*s); - return ctl_reply(INET_REP_ERROR, response, t-response, rbuf, rsize); + return ctl_reply(INET_REP_ERROR, s, strlen(s), rbuf, rsize); } static ErlDrvSSizeT ctl_xerror(char* xerr, char** rbuf, ErlDrvSizeT rsize) @@ -1683,14 +1696,7 @@ static ErlDrvSSizeT ctl_xerror(char* xerr, char** rbuf, ErlDrvSizeT rsize) static ErlDrvTermData error_atom(int err) { - char errstr[256]; - char* s; - char* t; - - for (s = erl_errno_id(err), t = errstr; *s; s++, t++) - *t = tolower(*s); - *t = '\0'; - return driver_mk_atom(errstr); + return driver_mk_atom(errno_str(err)); } @@ -4089,6 +4095,7 @@ static char* buf_to_sockaddr(char* ptr, char* end, struct sockaddr* addr) addr->sa_family = AF_INET; return ptr + sizeof(struct in_addr); } +#if defined(HAVE_IN6) && defined(AF_INET6) case INET_AF_INET6: { struct in6_addr *p = &((struct sockaddr_in6*)addr)->sin6_addr; buf_check(ptr,end,sizeof(struct in6_addr)); @@ -4096,6 +4103,7 @@ static char* buf_to_sockaddr(char* ptr, char* end, struct sockaddr* addr) addr->sa_family = AF_INET6; return ptr + sizeof(struct in6_addr); } +#endif } error: return NULL; @@ -8051,7 +8059,7 @@ static ErlDrvData tcp_inet_start(ErlDrvPort port, char* args) /* Copy a descriptor, by creating a new port with same settings * as the descriptor desc. - * return NULL on error (ENFILE no ports avail) + * return NULL on error (SYSTEM_LIMIT no ports avail) */ static tcp_descriptor* tcp_inet_copy(tcp_descriptor* desc,SOCKET s, ErlDrvTermData owner, int* err) @@ -8090,7 +8098,7 @@ static tcp_descriptor* tcp_inet_copy(tcp_descriptor* desc,SOCKET s, /* The new port will be linked and connected to the original caller */ port = driver_create_port(port, owner, "tcp_inet", (ErlDrvData) copy_desc); if ((long)port == -1) { - *err = ENFILE; + *err = INET_ERRNO_SYSTEM_LIMIT; FREE(copy_desc); return NULL; } diff --git a/erts/emulator/drivers/common/zlib_drv.c b/erts/emulator/drivers/common/zlib_drv.c index da4a17db1a..a4b02b845e 100644 --- a/erts/emulator/drivers/common/zlib_drv.c +++ b/erts/emulator/drivers/common/zlib_drv.c @@ -64,6 +64,7 @@ static int zlib_init(void); static ErlDrvData zlib_start(ErlDrvPort port, char* buf); static void zlib_stop(ErlDrvData e); +static void zlib_flush(ErlDrvData e); static ErlDrvSSizeT zlib_ctl(ErlDrvData drv_data, unsigned int command, char *buf, ErlDrvSizeT len, char **rbuf, ErlDrvSizeT rlen); static void zlib_outputv(ErlDrvData drv_data, ErlIOVec *ev); @@ -82,7 +83,7 @@ ErlDrvEntry zlib_driver_entry = { NULL, /* timeout */ zlib_outputv, NULL, /* read_async */ - NULL, /* flush */ + zlib_flush, NULL, /* call */ NULL, /* event */ ERL_DRV_EXTENDED_MARKER, @@ -410,6 +411,13 @@ static void zlib_stop(ErlDrvData e) driver_free(d); } +static void zlib_flush(ErlDrvData drv_data) +{ + ZLibData* d = (ZLibData*) drv_data; + + driver_deq(d->port, driver_sizeq(d->port)); +} + static ErlDrvSSizeT zlib_ctl(ErlDrvData drv_data, unsigned int command, char *buf, ErlDrvSizeT len, char **rbuf, ErlDrvSizeT rlen) { diff --git a/erts/emulator/drivers/unix/unix_efile.c b/erts/emulator/drivers/unix/unix_efile.c index 796843a735..dfb6cece14 100644 --- a/erts/emulator/drivers/unix/unix_efile.c +++ b/erts/emulator/drivers/unix/unix_efile.c @@ -1426,6 +1426,14 @@ efile_fadvise(Efile_error* errInfo, int fd, Sint64 offset, * you would have to emulate it in linux and on BSD/Darwin some complex * calculations have to be made when using a non blocking socket to figure * out how much of the header/file/trailer was sent in each command. + * + * The semantics of the API is this: + * Return value: 1 if all data was sent and the function does not need to + * be called again. 0 if an error occures OR if there is more data which + * has to be sent (EAGAIN or EINTR will be set appropriately) + * + * The amount of data written in a call is returned through nbytes. + * */ int @@ -1446,8 +1454,11 @@ efile_sendfile(Efile_error* errInfo, int in_fd, int out_fd, *nbytes -= retval; } } while (retval == SENDFILE_CHUNK_SIZE); - *nbytes = written; - return check_error(retval == -1 ? -1 : 0, errInfo); + if (written != 0) { + // -1 is not returned by the linux API so we have to simulate it + retval = -1; + errno = EAGAIN; + } #elif defined(__sun) && defined(__SVR4) && defined(HAVE_SENDFILEV) ssize_t retval; size_t len; @@ -1469,8 +1480,6 @@ efile_sendfile(Efile_error* errInfo, int in_fd, int out_fd, written += len; } } while (len == SENDFILE_CHUNK_SIZE); - *nbytes = written; - return check_error(retval == -1 ? -1 : 0, errInfo); #elif defined(DARWIN) int retval; off_t len; @@ -1487,8 +1496,6 @@ efile_sendfile(Efile_error* errInfo, int in_fd, int out_fd, written += len; } } while (len == SENDFILE_CHUNK_SIZE); - *nbytes = written; - return check_error(retval, errInfo); #elif defined(__FreeBSD__) || defined(__DragonFly__) off_t len; int retval; @@ -1504,8 +1511,8 @@ efile_sendfile(Efile_error* errInfo, int in_fd, int out_fd, written += len; } } while(len == SENDFILE_CHUNK_SIZE); +#endif *nbytes = written; return check_error(retval, errInfo); -#endif } #endif /* HAVE_SENDFILE */ diff --git a/erts/emulator/test/erts_debug_SUITE.erl b/erts/emulator/test/erts_debug_SUITE.erl index 4dc2fbaae2..76667772c7 100644 --- a/erts/emulator/test/erts_debug_SUITE.erl +++ b/erts/emulator/test/erts_debug_SUITE.erl @@ -23,13 +23,13 @@ -export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, init_per_group/2,end_per_group/2, init_per_testcase/2,end_per_testcase/2, - flat_size/1,flat_size_big/1,df/1, + test_size/1,flat_size_big/1,df/1, instructions/1]). suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> - [flat_size, flat_size_big, df, instructions]. + [test_size, flat_size_big, df, instructions]. groups() -> []. @@ -55,16 +55,58 @@ end_per_testcase(_Func, Config) -> Dog=?config(watchdog, Config), ?t:timetrap_cancel(Dog). -flat_size(Config) when is_list(Config) -> - 0 = erts_debug:flat_size([]), - 0 = erts_debug:flat_size(42), - 2 = erts_debug:flat_size([a|b]), - 1 = erts_debug:flat_size({}), - 2 = erts_debug:flat_size({[]}), - 3 = erts_debug:flat_size({a,b}), - 7 = erts_debug:flat_size({a,[b,c]}), +test_size(Config) when is_list(Config) -> + ConsCell1 = id([a|b]), + ConsCell2 = id(ConsCell1), + ConsCellSz = 2, + + 0 = do_test_size([]), + 0 = do_test_size(42), + ConsCellSz = do_test_size(ConsCell1), + 1 = do_test_size({}), + 2 = do_test_size({[]}), + 3 = do_test_size({a,b}), + 7 = do_test_size({a,[b,c]}), + + %% Test internal consistency of sizes, but without testing + %% exact sizes. + Const = id(42), + AnotherConst = id(7), + + %% Fun environment size = 0 (the smallest fun possible) + SimplestFun = fun() -> ok end, + FunSz0 = do_test_size(SimplestFun), + + %% Fun environment size = 1 + FunSz1 = do_test_size(fun() -> Const end), + FunSz1 = FunSz0 + 1, + + %% Fun environment size = 2 + FunSz2 = do_test_size(fun() -> Const+AnotherConst end), + FunSz2 = FunSz1 + 1, + + FunSz1 = do_test_size(fun() -> ConsCell1 end) - do_test_size(ConsCell1), + + %% Test shared data structures. + do_test_size([ConsCell1|ConsCell1], + 3*ConsCellSz, + 2*ConsCellSz), + do_test_size(fun() -> {ConsCell1,ConsCell2} end, + FunSz2 + 2*ConsCellSz, + FunSz2 + ConsCellSz), + do_test_size({SimplestFun,SimplestFun}, + 2*FunSz0+do_test_size({a,b}), + FunSz0+do_test_size({a,b})), ok. +do_test_size(Term) -> + Sz = erts_debug:flat_size(Term), + Sz = erts_debug:size(Term). + +do_test_size(Term, FlatSz, Sz) -> + FlatSz = erts_debug:flat_size(Term), + Sz = erts_debug:size(Term). + flat_size_big(Config) when is_list(Config) -> %% Build a term whose external size only fits in a big num (on 32-bit CPU). flat_size_big_1(16#11111111111111117777777777777777888889999, 0, 16#FFFFFFF). @@ -96,3 +138,6 @@ instructions(Config) when is_list(Config) -> ?line Is = erts_debug:instructions(), ?line _ = [list_to_atom(I) || I <- Is], ok. + +id(I) -> + I. diff --git a/erts/etc/common/escript.c b/erts/etc/common/escript.c index 6ed79c91e3..e70c95b67c 100644 --- a/erts/etc/common/escript.c +++ b/erts/etc/common/escript.c @@ -377,7 +377,8 @@ main(int argc, char** argv) last_opt = argv; #ifdef __WIN32__ - if (_stricmp(basename, "escript.exe") == 0) { + if ( (_stricmp(basename, "escript.exe") == 0) + ||(_stricmp(basename, "escript") == 0)) { #else if (strcmp(basename, "escript") == 0) { #endif diff --git a/erts/lib_src/common/erl_misc_utils.c b/erts/lib_src/common/erl_misc_utils.c index 4806311dfe..162c908285 100644 --- a/erts/lib_src/common/erl_misc_utils.c +++ b/erts/lib_src/common/erl_misc_utils.c @@ -727,7 +727,7 @@ adjust_processor_nodes(erts_cpu_info_t *cpuinfo, int no_nodes) prev = NULL; this = &cpuinfo->topology[0]; - last = &cpuinfo->topology[cpuinfo->configured-1]; + last = &cpuinfo->topology[cpuinfo->topology_size-1]; while (1) { if (processor == this->processor) { if (node != this->node) @@ -939,7 +939,7 @@ read_topology(erts_cpu_info_t *cpuinfo) if (res > 1) { prev = this++; - last = &cpuinfo->topology[cpuinfo->configured-1]; + last = &cpuinfo->topology[cpuinfo->topology_size-1]; while (1) { this->thread = ((this->node == prev->node @@ -1094,7 +1094,7 @@ read_topology(erts_cpu_info_t *cpuinfo) if (res > 1) { prev = this++; - last = &cpuinfo->topology[cpuinfo->configured-1]; + last = &cpuinfo->topology[cpuinfo->topology_size-1]; while (1) { this->thread = ((this->node == prev->node diff --git a/erts/preloaded/ebin/prim_inet.beam b/erts/preloaded/ebin/prim_inet.beam Binary files differindex f382236af7..b2f3ab6c5b 100644 --- a/erts/preloaded/ebin/prim_inet.beam +++ b/erts/preloaded/ebin/prim_inet.beam diff --git a/erts/preloaded/ebin/zlib.beam b/erts/preloaded/ebin/zlib.beam Binary files differindex bf88a51502..7a1f896d36 100644 --- a/erts/preloaded/ebin/zlib.beam +++ b/erts/preloaded/ebin/zlib.beam diff --git a/erts/preloaded/src/prim_inet.erl b/erts/preloaded/src/prim_inet.erl index 0cedd284db..14bf3b6c69 100644 --- a/erts/preloaded/src/prim_inet.erl +++ b/erts/preloaded/src/prim_inet.erl @@ -83,8 +83,10 @@ open(Protocol, Family, Type, Req, Data) -> end catch %% The only (?) way to get here is to try to open - %% the sctp driver when it does not exist - error:badarg -> {error,eprotonosupport} + %% the sctp driver when it does not exist (badarg) + error:badarg -> {error, eprotonosupport}; + %% system_limit if out of port slots + error:system_limit -> {error, system_limit} end. enc_family(inet) -> ?INET_AF_INET; diff --git a/erts/preloaded/src/zlib.erl b/erts/preloaded/src/zlib.erl index 210532edac..71b730016d 100644 --- a/erts/preloaded/src/zlib.erl +++ b/erts/preloaded/src/zlib.erl @@ -349,10 +349,14 @@ getQSize(Z) -> Compressed :: binary(). compress(Data) -> Z = open(), - deflateInit(Z, default), - Bs = deflate(Z, Data, finish), - deflateEnd(Z), - close(Z), + Bs = try + deflateInit(Z, default), + B = deflate(Z, Data, finish), + deflateEnd(Z), + B + after + close(Z) + end, iolist_to_binary(Bs). -spec uncompress(Data) -> Decompressed when @@ -364,10 +368,14 @@ uncompress(Data) -> if Size >= 8 -> Z = open(), - inflateInit(Z), - Bs = inflate(Z, Data), - inflateEnd(Z), - close(Z), + Bs = try + inflateInit(Z), + B = inflate(Z, Data), + inflateEnd(Z), + B + after + close(Z) + end, iolist_to_binary(Bs); true -> erlang:error(data_error) @@ -383,10 +391,14 @@ uncompress(Data) -> Compressed :: binary(). zip(Data) -> Z = open(), - deflateInit(Z, default, deflated, -?MAX_WBITS, 8, default), - Bs = deflate(Z, Data, finish), - deflateEnd(Z), - close(Z), + Bs = try + deflateInit(Z, default, deflated, -?MAX_WBITS, 8, default), + B = deflate(Z, Data, finish), + deflateEnd(Z), + B + after + close(Z) + end, iolist_to_binary(Bs). -spec unzip(Data) -> Decompressed when @@ -394,10 +406,14 @@ zip(Data) -> Decompressed :: binary(). unzip(Data) -> Z = open(), - inflateInit(Z, -?MAX_WBITS), - Bs = inflate(Z, Data), - inflateEnd(Z), - close(Z), + Bs = try + inflateInit(Z, -?MAX_WBITS), + B = inflate(Z, Data), + inflateEnd(Z), + B + after + close(Z) + end, iolist_to_binary(Bs). -spec gzip(Data) -> Compressed when @@ -405,10 +421,14 @@ unzip(Data) -> Compressed :: binary(). gzip(Data) -> Z = open(), - deflateInit(Z, default, deflated, 16+?MAX_WBITS, 8, default), - Bs = deflate(Z, Data, finish), - deflateEnd(Z), - close(Z), + Bs = try + deflateInit(Z, default, deflated, 16+?MAX_WBITS, 8, default), + B = deflate(Z, Data, finish), + deflateEnd(Z), + B + after + close(Z) + end, iolist_to_binary(Bs). -spec gunzip(Data) -> Decompressed when @@ -416,10 +436,14 @@ gzip(Data) -> Decompressed :: binary(). gunzip(Data) -> Z = open(), - inflateInit(Z, 16+?MAX_WBITS), - Bs = inflate(Z, Data), - inflateEnd(Z), - close(Z), + Bs = try + inflateInit(Z, 16+?MAX_WBITS), + B = inflate(Z, Data), + inflateEnd(Z), + B + after + close(Z) + end, iolist_to_binary(Bs). -spec collect(zstream()) -> iolist(). diff --git a/lib/common_test/doc/src/ct_hooks_chapter.xml b/lib/common_test/doc/src/ct_hooks_chapter.xml index 8505ee8469..c5b4fd0073 100644 --- a/lib/common_test/doc/src/ct_hooks_chapter.xml +++ b/lib/common_test/doc/src/ct_hooks_chapter.xml @@ -429,6 +429,16 @@ terminate(State) -> <seealso marker="sasl:sasl_app">SASL</seealso> events report using the normal SASL mechanisms. </cell> </row> + <row> + <cell>cth_surefire</cell> + <cell>no</cell> + <cell>Captures all test results and outputs them as surefire XML into + a file. The file which is created is by default called junit_report.xml. + The name can be by setting the path option for this hook. e.g. + <code>-ct_hooks cth_surefix [{path,"/tmp/report.xml"}]</code> + Surefire XML can forinstance be used by Jenkins to display test + results.</cell> + </row> </table> </section> diff --git a/lib/common_test/src/Makefile b/lib/common_test/src/Makefile index 125aa828fb..e9555de35a 100644 --- a/lib/common_test/src/Makefile +++ b/lib/common_test/src/Makefile @@ -69,7 +69,8 @@ MODULES= \ ct_slave \ ct_hooks\ ct_hooks_lock\ - cth_log_redirect + cth_log_redirect\ + cth_surefire TARGET_MODULES= $(MODULES:%=$(EBIN)/%) BEAM_FILES= $(MODULES:%=$(EBIN)/%.$(EMULATOR)) diff --git a/lib/common_test/src/common_test.app.src b/lib/common_test/src/common_test.app.src index 7fba484b18..bdd48fbc6b 100644 --- a/lib/common_test/src/common_test.app.src +++ b/lib/common_test/src/common_test.app.src @@ -25,6 +25,8 @@ ct_framework, ct_ftp, ct_gen_conn, + ct_hooks, + ct_hooks_lock, ct_logs, ct_make, ct_master, @@ -45,7 +47,9 @@ ct_config, ct_config_plain, ct_config_xml, - ct_slave + ct_slave, + cth_log_redirect, + cth_surefire ]}, {registered, [ct_logs, ct_util_server, diff --git a/lib/common_test/src/ct_framework.erl b/lib/common_test/src/ct_framework.erl index cdd8a6a596..187794e78b 100644 --- a/lib/common_test/src/ct_framework.erl +++ b/lib/common_test/src/ct_framework.erl @@ -29,7 +29,8 @@ -export([get_logopts/0, format_comment/1, get_html_wrapper/3]). --export([error_in_suite/1, ct_init_per_group/2, ct_end_per_group/2]). +-export([error_in_suite/1, init_per_suite/1, end_per_suite/1, + init_per_group/2, end_per_group/2]). -export([make_all_conf/3, make_conf/5]). @@ -54,6 +55,7 @@ init_tc(Mod,Func,Config) -> %% in case Mod == ct_framework, lookup the suite name Suite = get_suite_name(Mod, Config), + %% check if previous testcase was interpreted and has left %% a "dead" trace window behind - if so, kill it case ct_util:get_testdata(interpret) of @@ -63,27 +65,17 @@ init_tc(Mod,Func,Config) -> _ -> ok end, - %% check if we need to add defaults explicitly because - %% there's no init_per_suite exported from Mod - {InitFailed,DoInit} = - case ct_util:get_testdata(curr_tc) of - {Suite,{suite0_failed,_}=Failure} -> - {Failure,false}; - {?MODULE,_} -> % should not really happen - {false,false}; - {Suite,_} -> % Func is not 1st case in suite - {false,false}; - _ when Func == init_per_suite -> % defaults will be added anyway - {false,false}; - _ -> % first case in suite - {false,true} - end, - case InitFailed of - false -> + + case ct_util:get_testdata(curr_tc) of + {Suite,{suite0_failed,{require,Reason}}} -> + {skip,{require_failed_in_suite0,Reason}}; + {Suite,{suite0_failed,_}=Failure} -> + {skip,Failure}; + _ -> ct_util:set_testdata({curr_tc,{Suite,Func}}), case ct_util:read_suite_data({seq,Suite,Func}) of undefined -> - init_tc1(Mod,Func,Config,DoInit); + init_tc1(Mod,Suite,Func,Config); Seq when is_atom(Seq) -> case ct_util:read_suite_data({seq,Suite,Seq}) of [Func|TCs] -> % this is the 1st case in Seq @@ -96,17 +88,13 @@ init_tc(Mod,Func,Config) -> _ -> ok end, - init_tc1(Mod,Func,Config,DoInit); + init_tc1(Mod,Suite,Func,Config); {failed,Seq,BadFunc} -> {skip,{sequence_failed,Seq,BadFunc}} - end; - {_,{require,Reason}} -> - {skip,{require_failed_in_suite0,Reason}}; - _ -> - {skip,InitFailed} + end end. -init_tc1(?MODULE,error_in_suite,[Config0],_) when is_list(Config0) -> +init_tc1(?MODULE,_,error_in_suite,[Config0]) when is_list(Config0) -> ct_logs:init_tc(false), ct_event:notify(#event{name=tc_start, node=node(), @@ -117,14 +105,16 @@ init_tc1(?MODULE,error_in_suite,[Config0],_) when is_list(Config0) -> Reason -> {skip,Reason} end; -init_tc1(Mod,Func,[Config0],DoInit) when is_list(Config0) -> + +init_tc1(Mod,Suite,Func,[Config0]) when is_list(Config0) -> Config1 = case ct_util:read_suite_data(last_saved_config) of - {{Mod,LastFunc},SavedConfig} -> % last testcase + {{Suite,LastFunc},SavedConfig} -> % last testcase [{saved_config,{LastFunc,SavedConfig}} | lists:keydelete(saved_config,1,Config0)]; - {{LastSuite,InitOrEnd},SavedConfig} when InitOrEnd == init_per_suite ; - InitOrEnd == end_per_suite -> + {{LastSuite,InitOrEnd}, + SavedConfig} when InitOrEnd == init_per_suite ; + InitOrEnd == end_per_suite -> %% last suite [{saved_config,{LastSuite,SavedConfig}} | lists:keydelete(saved_config,1,Config0)]; @@ -133,13 +123,14 @@ init_tc1(Mod,Func,[Config0],DoInit) when is_list(Config0) -> end, ct_util:delete_suite_data(last_saved_config), Config = lists:keydelete(watchdog,1,Config1), - if Func /= init_per_suite, DoInit /= true -> - ok; - true -> + + if Func == init_per_suite -> %% delete all default values used in previous suite ct_config:delete_default_config(suite), %% release all name -> key bindings (once per suite) - ct_config:release_allocated() + ct_config:release_allocated(); + Func /= init_per_suite -> + ok end, GroupPath = ?val(tc_group_path, Config, []), @@ -154,9 +145,7 @@ init_tc1(Mod,Func,[Config0],DoInit) when is_list(Config0) -> true -> ct_config:delete_default_config(testcase) end, - %% in case Mod == ct_framework, lookup the suite name - Suite = get_suite_name(Mod, Config), - case add_defaults(Mod,Func,AllGroups,DoInit) of + case add_defaults(Mod,Func,AllGroups) of Error = {suite0_failed,_} -> ct_logs:init_tc(false), ct_event:notify(#event{name=tc_start, @@ -166,35 +155,25 @@ init_tc1(Mod,Func,[Config0],DoInit) when is_list(Config0) -> {error,Error}; {SuiteInfo,MergeResult} -> case MergeResult of - {error,Reason} when DoInit == false -> + {error,Reason} -> ct_logs:init_tc(false), ct_event:notify(#event{name=tc_start, node=node(), data={Mod,FuncSpec}}), {skip,Reason}; _ -> - init_tc2(Mod,Func,SuiteInfo,MergeResult, - Config,DoInit) + init_tc2(Mod,Suite,Func,SuiteInfo,MergeResult,Config) end end; -init_tc1(_Mod,_Func,Args,_DoInit) -> - {ok,Args}. -init_tc2(Mod,Func,SuiteInfo,MergeResult,Config,DoInit) -> - %% if first testcase fails when there's no init_per_suite - %% we must do suite/0 configurations before skipping test - MergedInfo = - case MergeResult of - {error,_} when DoInit == true -> - SuiteInfo; - _ -> - MergeResult - end, +init_tc1(_Mod,_Suite,_Func,Args) -> + {ok,Args}. +init_tc2(Mod,Suite,Func,SuiteInfo,MergeResult,Config) -> %% timetrap must be handled before require - MergedInfo1 = timetrap_first(MergedInfo, [], []), + MergedInfo = timetrap_first(MergeResult, [], []), %% tell logger to use specified style sheet - case lists:keysearch(stylesheet,1,MergedInfo++Config) of + case lists:keysearch(stylesheet,1,MergeResult++Config) of {value,{stylesheet,SSFile}} -> ct_logs:set_stylesheet(Func,add_data_dir(SSFile,Config)); _ -> @@ -209,7 +188,7 @@ init_tc2(Mod,Func,SuiteInfo,MergeResult,Config,DoInit) -> %% list of {Type,Bool} tuples, e.g. {telnet,true}), case ct_util:get_overridden_silenced_connections() of undefined -> - case lists:keysearch(silent_connections,1,MergedInfo++Config) of + case lists:keysearch(silent_connections,1,MergeResult++Config) of {value,{silent_connections,Conns}} -> ct_util:silence_connections(Conns); _ -> @@ -218,18 +197,14 @@ init_tc2(Mod,Func,SuiteInfo,MergeResult,Config,DoInit) -> Conns -> ct_util:silence_connections(Conns) end, - if Func /= init_per_suite, DoInit /= true -> - ct_logs:init_tc(false); - true -> - ct_logs:init_tc(true) - end, + ct_logs:init_tc(Func == init_per_suite), FuncSpec = group_or_func(Func,Config), ct_event:notify(#event{name=tc_start, node=node(), data={Mod,FuncSpec}}), - case catch configure(MergedInfo1,MergedInfo1,SuiteInfo, - {FuncSpec,DoInit},Config) of + case catch configure(MergedInfo,MergedInfo,SuiteInfo, + FuncSpec,Config) of {suite0_failed,Reason} -> ct_util:set_testdata({curr_tc,{Mod,{suite0_failed,{require,Reason}}}}), {skip,{require_failed_in_suite0,Reason}}; @@ -246,7 +221,7 @@ init_tc2(Mod,Func,SuiteInfo,MergeResult,Config,DoInit) -> _ -> case get('$test_server_framework_test') of undefined -> - ct_suite_init(Mod, FuncSpec, FinalConfig); + ct_suite_init(Suite, FuncSpec, FinalConfig); Fun -> case Fun(init_tc, FinalConfig) of NewConfig when is_list(NewConfig) -> @@ -258,21 +233,21 @@ init_tc2(Mod,Func,SuiteInfo,MergeResult,Config,DoInit) -> end end. -ct_suite_init(Mod, Func, [Config]) when is_list(Config) -> - case ct_hooks:init_tc( Mod, Func, Config) of +ct_suite_init(Suite, Func, [Config]) when is_list(Config) -> + case ct_hooks:init_tc(Suite, Func, Config) of NewConfig when is_list(NewConfig) -> {ok, [NewConfig]}; Else -> Else end. -add_defaults(Mod,Func, GroupPath, DoInit) -> +add_defaults(Mod,Func, GroupPath) -> Suite = get_suite_name(Mod, GroupPath), case (catch Suite:suite()) of {'EXIT',{undef,_}} -> SuiteInfo = merge_with_suite_defaults(Suite,[]), SuiteInfoNoCTH = [I || I <- SuiteInfo, element(1,I) =/= ct_hooks], - case add_defaults1(Mod,Func, GroupPath, SuiteInfoNoCTH, DoInit) of + case add_defaults1(Mod,Func, GroupPath, SuiteInfoNoCTH) of Error = {error,_} -> {SuiteInfo,Error}; MergedInfo -> {SuiteInfo,MergedInfo} end; @@ -292,7 +267,7 @@ add_defaults(Mod,Func, GroupPath, DoInit) -> SuiteInfoNoCTH = [I || I <- SuiteInfo1, element(1,I) =/= ct_hooks], case add_defaults1(Mod,Func, GroupPath, - SuiteInfoNoCTH, DoInit) of + SuiteInfoNoCTH) of Error = {error,_} -> {SuiteInfo1,Error}; MergedInfo -> {SuiteInfo1,MergedInfo} end; @@ -313,7 +288,7 @@ add_defaults(Mod,Func, GroupPath, DoInit) -> {suite0_failed,bad_return_value} end. -add_defaults1(Mod,Func, GroupPath, SuiteInfo, DoInit) -> +add_defaults1(Mod,Func, GroupPath, SuiteInfo) -> Suite = get_suite_name(Mod, GroupPath), %% GroupPathInfo (for subgroup on level X) = %% [LevelXGroupInfo, LevelX-1GroupInfo, ..., TopLevelGroupInfo] @@ -325,8 +300,7 @@ add_defaults1(Mod,Func, GroupPath, SuiteInfo, DoInit) -> _ -> [] end end, GroupPath), - Args = if Func == init_per_group; Func == ct_init_per_group; - Func == end_per_group; Func == ct_end_per_group -> + Args = if Func == init_per_group ; Func == end_per_group -> [?val(name, hd(GroupPath))]; true -> [] @@ -347,7 +321,7 @@ add_defaults1(Mod,Func, GroupPath, SuiteInfo, DoInit) -> (default_config == element(1,SDDef)))], case check_for_clashes(TestCaseInfo, GroupPathInfo, SuiteReqs) of [] -> - add_defaults2(Mod,Func, TCAndGroupInfo,SuiteInfo,SuiteReqs, DoInit); + add_defaults2(Mod,Func, TCAndGroupInfo,SuiteInfo,SuiteReqs); Clashes -> {error,{config_name_already_in_use,Clashes}} end. @@ -421,34 +395,25 @@ keysmember([Key,Pos|Next], List) -> keysmember([], _) -> true. -add_defaults2(Mod,init_per_suite, IPSInfo, SuiteInfo,SuiteReqs, false) -> - add_defaults2(Mod,init_per_suite, IPSInfo, SuiteInfo,SuiteReqs, true); +add_defaults2(_Mod,init_per_suite, IPSInfo, SuiteInfo,SuiteReqs) -> + Info = lists:flatten([IPSInfo, SuiteReqs]), + lists:flatten([Info,remove_info_in_prev(Info, [SuiteInfo])]); -add_defaults2(_Mod,IPG, IPGAndGroupInfo, SuiteInfo,SuiteReqs, DoInit) when - IPG == init_per_group ; IPG == ct_init_per_group -> - %% If DoInit == true, we have to process the suite() list, otherwise - %% it has already been handled (see clause for init_per_suite) - case DoInit of - true -> - %% note: we know for sure this is a top level group - Info = lists:flatten([IPGAndGroupInfo, SuiteReqs]), - Info ++ remove_info_in_prev(Info, [SuiteInfo]); - false -> - SuiteInfo1 = - remove_info_in_prev(lists:flatten([IPGAndGroupInfo, - SuiteReqs]), [SuiteInfo]), - %% don't require terms in prev groups (already processed) - case IPGAndGroupInfo of - [IPGInfo] -> - lists:flatten([IPGInfo,SuiteInfo1]); - [IPGInfo | [CurrGroupInfo | PrevGroupInfo]] -> - PrevGroupInfo1 = delete_require_terms(PrevGroupInfo), - lists:flatten([IPGInfo,CurrGroupInfo,PrevGroupInfo1, - SuiteInfo1]) - end +add_defaults2(_Mod,init_per_group, IPGAndGroupInfo, SuiteInfo,SuiteReqs) -> + SuiteInfo1 = + remove_info_in_prev(lists:flatten([IPGAndGroupInfo, + SuiteReqs]), [SuiteInfo]), + %% don't require terms in prev groups (already processed) + case IPGAndGroupInfo of + [IPGInfo] -> + lists:flatten([IPGInfo,SuiteInfo1]); + [IPGInfo | [CurrGroupInfo | PrevGroupInfo]] -> + PrevGroupInfo1 = delete_require_terms(PrevGroupInfo), + lists:flatten([IPGInfo,CurrGroupInfo,PrevGroupInfo1, + SuiteInfo1]) end; -add_defaults2(_Mod,_Func, TCAndGroupInfo, SuiteInfo,SuiteReqs, false) -> +add_defaults2(_Mod,_Func, TCAndGroupInfo, SuiteInfo,SuiteReqs) -> %% Include require elements from test case info and current group, %% but not from previous groups or suite/0 (since we've already required %% those vars). Let test case info elements override group and suite @@ -463,14 +428,7 @@ add_defaults2(_Mod,_Func, TCAndGroupInfo, SuiteInfo,SuiteReqs, false) -> PrevGroupInfo1 = delete_require_terms(PrevGroupInfo), lists:flatten([TCInfo,CurrGroupInfo,PrevGroupInfo1, SuiteInfo1]) - end; - -add_defaults2(_Mod,_Func, TCInfo, SuiteInfo,SuiteReqs, true) -> - %% Here we have to process the suite info list also (no call to - %% init_per_suite before this first test case). This TC can't belong - %% to a group, or the clause for (ct_)init_per_group would've caught this. - Info = lists:flatten([TCInfo, SuiteReqs]), - lists:flatten([Info,remove_info_in_prev(Info, [SuiteInfo])]). + end. delete_require_terms([Info | Prev]) -> Info1 = [T || T <- Info, @@ -558,18 +516,9 @@ configure([],_,_,_,Config) -> %% function and be scoped 'group', or come from the testcase %% info function and then be scoped 'testcase' -required_default(Name,Key,Info,SuiteInfo,{FuncSpec,true}) -> - case try_set_default(Name,Key,SuiteInfo,suite) of - ok -> - ok; - _ -> - required_default(Name,Key,Info,[],{FuncSpec,false}) - end; -required_default(Name,Key,Info,_,{init_per_suite,_}) -> +required_default(Name,Key,Info,_,init_per_suite) -> try_set_default(Name,Key,Info,suite); -required_default(Name,Key,Info,_,{{init_per_group,GrName,_},_}) -> - try_set_default(Name,Key,Info,{group,GrName}); -required_default(Name,Key,Info,_,{{ct_init_per_group,GrName,_},_}) -> +required_default(Name,Key,Info,_,{init_per_group,GrName,_}) -> try_set_default(Name,Key,Info,{group,GrName}); required_default(Name,Key,Info,_,_FuncSpec) -> try_set_default(Name,Key,Info,testcase). @@ -621,6 +570,9 @@ end_tc(Mod,Func,{Result,[Args]}, Return) -> end_tc(Mod,Func,self(),Result,Args,Return). end_tc(Mod,Func,TCPid,Result,Args,Return) -> + %% in case Mod == ct_framework, lookup the suite name + Suite = get_suite_name(Mod, Args), + case lists:keysearch(watchdog,1,Args) of {value,{watchdog,Dog}} -> test_server:timetrap_cancel(Dog); false -> ok @@ -636,60 +588,62 @@ end_tc(Mod,Func,TCPid,Result,Args,Return) -> end, ct_util:delete_testdata(comment), ct_util:delete_suite_data(last_saved_config), - FuncSpec = - case group_or_func(Func,Args) of - {_,GroupName,_Props} = Group -> - if Func == end_per_group; Func == ct_end_per_group -> - ct_config:delete_default_config({group,GroupName}); - true -> ok - end, - case lists:keysearch(save_config,1,Args) of - {value,{save_config,SaveConfig}} -> - ct_util:save_suite_data( - last_saved_config, - {Mod,{group,GroupName}}, - SaveConfig), - Group; - false -> - Group - end; - _ -> - case lists:keysearch(save_config,1,Args) of - {value,{save_config,SaveConfig}} -> - ct_util:save_suite_data(last_saved_config, - {Mod,Func},SaveConfig), - Func; - false -> - Func - end - end, - ct_util:reset_silent_connections(), + + FuncSpec = case group_or_func(Func,Args) of + {_,_GroupName,_} = Group -> Group; + _ -> Func + end, case get('$test_server_framework_test') of undefined -> {FinalResult,FinalNotify} = case ct_hooks:end_tc( - Mod, FuncSpec, Args, Result, Return) of + Suite, FuncSpec, Args, Result, Return) of '$ct_no_change' -> {ok,Result}; FinalResult1 -> {FinalResult1,FinalResult1} end, - % send sync notification so that event handlers may print - % in the log file before it gets closed + %% send sync notification so that event handlers may print + %% in the log file before it gets closed ct_event:sync_notify(#event{name=tc_done, node=node(), data={Mod,FuncSpec, tag_cth(FinalNotify)}}); Fun -> - % send sync notification so that event handlers may print - % in the log file before it gets closed + %% send sync notification so that event handlers may print + %% in the log file before it gets closed ct_event:sync_notify(#event{name=tc_done, node=node(), data={Mod,FuncSpec,tag(Result)}}), FinalResult = Fun(end_tc, Return) + end, + + case FuncSpec of + {_,GroupName,_Props} -> + if Func == end_per_group -> + ct_config:delete_default_config({group,GroupName}); + true -> ok + end, + case lists:keysearch(save_config,1,Args) of + {value,{save_config,SaveConfig}} -> + ct_util:save_suite_data(last_saved_config, + {Suite,{group,GroupName}}, + SaveConfig); + false -> + ok + end; + _ -> + case lists:keysearch(save_config,1,Args) of + {value,{save_config,SaveConfig}} -> + ct_util:save_suite_data(last_saved_config, + {Suite,Func},SaveConfig); + false -> + ok + end end, + ct_util:reset_silent_connections(), case FinalResult of {skip,{sequence_failed,_,_}} -> @@ -706,7 +660,7 @@ end_tc(Mod,Func,TCPid,Result,Args,Return) -> end, case Func of end_per_suite -> - ct_util:match_delete_suite_data({seq,Mod,'_'}); + ct_util:match_delete_suite_data({seq,Suite,'_'}); _ -> ok end, @@ -864,9 +818,7 @@ mark_as_failed1(_,_,_,[]) -> ok. group_or_func(Func, Config) when Func == init_per_group; - Func == end_per_group; - Func == ct_init_per_group; - Func == ct_end_per_group -> + Func == end_per_group -> case ?val(tc_group_properties, Config) of undefined -> {Func,unknown,[]}; @@ -1209,8 +1161,8 @@ make_conf(Mod, Name, Props, TestSpec) -> "end_per_group/2 missing for group " "~p in ~p, using default.", [Name,Mod]), - {{?MODULE,ct_init_per_group}, - {?MODULE,ct_end_per_group}, + {{?MODULE,init_per_group}, + {?MODULE,end_per_group}, [{suite,Mod}]} end, {conf,[{name,Name}|Props++ExtraProps],InitConf,TestSpec,EndConf}. @@ -1470,22 +1422,31 @@ error_in_suite(Config) -> Reason = test_server:lookup_config(error,Config), exit(Reason). +%% if init_per_suite and end_per_suite are missing in the suite, +%% these will be called instead (without any trace of them in the +%% log files), only so that it's possible to call hook functions +%% for configuration +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + %% if the group config functions are missing in the suite, %% use these instead -ct_init_per_group(GroupName, Config) -> +init_per_group(GroupName, Config) -> ct:comment(io_lib:format("start of ~p", [GroupName])), ct_logs:log("TEST INFO", "init_per_group/2 for ~w missing " "in suite, using default.", [GroupName]), Config. -ct_end_per_group(GroupName, _) -> +end_per_group(GroupName, _) -> ct:comment(io_lib:format("end of ~p", [GroupName])), ct_logs:log("TEST INFO", "end_per_group/2 for ~w missing " "in suite, using default.", [GroupName]), ok. - %%%----------------------------------------------------------------- %%% @spec report(What,Data) -> ok @@ -1562,10 +1523,6 @@ report(What,Data) -> ok; {end_per_group,_} -> ok; - {ct_init_per_group,_} -> - ok; - {ct_end_per_group,_} -> - ok; {_,ok} -> add_to_stats(ok); {_,{skipped,{failed,{_,init_per_testcase,_}}}} -> @@ -1602,8 +1559,7 @@ report(What,Data) -> data=Data}), ct_hooks:on_tc_skip(What, Data), if Case /= end_per_suite, - Case /= end_per_group, - Case /= ct_end_per_group -> + Case /= end_per_group -> add_to_stats(auto_skipped); true -> ok diff --git a/lib/common_test/src/ct_hooks.erl b/lib/common_test/src/ct_hooks.erl index c42adbbdd9..2a23cd992b 100644 --- a/lib/common_test/src/ct_hooks.erl +++ b/lib/common_test/src/ct_hooks.erl @@ -70,8 +70,7 @@ terminate(Hooks) -> {skip, Reason :: term()} | {auto_skip, Reason :: term()} | {fail, Reason :: term()}. -init_tc(ct_framework, _Func, Args) -> - Args; + init_tc(Mod, init_per_suite, Config) -> Info = try proplists:get_value(ct_hooks, Mod:suite(),[]) of List when is_list(List) -> @@ -104,27 +103,21 @@ init_tc(_Mod, TC, Config) -> {auto_skip, Reason :: term()} | {fail, Reason :: term()} | ok | '$ct_no_change'. -end_tc(ct_framework, _Func, _Args, Result, _Return) -> - Result; end_tc(Mod, init_per_suite, Config, _Result, Return) -> call(fun call_generic/3, Return, [post_init_per_suite, Mod, Config], '$ct_no_change'); - end_tc(Mod, end_per_suite, Config, Result, _Return) -> call(fun call_generic/3, Result, [post_end_per_suite, Mod, Config], '$ct_no_change'); - end_tc(_Mod, {init_per_group, GroupName, _}, Config, _Result, Return) -> call(fun call_generic/3, Return, [post_init_per_group, GroupName, Config], '$ct_no_change'); - end_tc(Mod, {end_per_group, GroupName, Opts}, Config, Result, _Return) -> Res = call(fun call_generic/3, Result, [post_end_per_group, GroupName, Config], '$ct_no_change'), maybe_stop_locker(Mod, GroupName,Opts), Res; - end_tc(_Mod, TC, Config, Result, _Return) -> call(fun call_generic/3, Result, [post_end_per_testcase, TC, Config], '$ct_no_change'). diff --git a/lib/common_test/src/ct_run.erl b/lib/common_test/src/ct_run.erl index 666eb3c988..72124f6f21 100644 --- a/lib/common_test/src/ct_run.erl +++ b/lib/common_test/src/ct_run.erl @@ -1413,7 +1413,8 @@ do_run(Tests, Skip, Opts, Args) when is_record(Opts, opts) -> %% which framework it runs under. case os:getenv("TEST_SERVER_FRAMEWORK") of false -> - os:putenv("TEST_SERVER_FRAMEWORK", "ct_framework"); + os:putenv("TEST_SERVER_FRAMEWORK", "ct_framework"), + os:putenv("TEST_SERVER_FRAMEWORK_NAME", "common_test"); "ct_framework" -> ok; Other -> @@ -2328,7 +2329,7 @@ ct_hooks_args2opts(Args) -> Acc end,[],Args). -ct_hooks_args2opts([CTH,Arg,Prio,"and"| Rest],Acc) -> +ct_hooks_args2opts([CTH,Arg,Prio,"and"| Rest],Acc) when Arg /= "and" -> ct_hooks_args2opts(Rest,[{list_to_atom(CTH), parse_cth_args(Arg), parse_cth_args(Prio)}|Acc]); diff --git a/lib/common_test/src/cth_surefire.erl b/lib/common_test/src/cth_surefire.erl new file mode 100644 index 0000000000..c42f956b3a --- /dev/null +++ b/lib/common_test/src/cth_surefire.erl @@ -0,0 +1,199 @@ +%%% @doc Common Test Framework functions handling test specifications. +%%% +%%% <p>This module creates a junit report of the test run if plugged in +%%% as a suite_callback.</p> + +-module(cth_surefire). + +%% Suite Callbacks +-export([id/1, init/2]). + +-export([pre_init_per_suite/3]). +-export([post_init_per_suite/4]). +-export([pre_end_per_suite/3]). +-export([post_end_per_suite/4]). + +-export([pre_init_per_group/3]). +-export([post_init_per_group/4]). +-export([pre_end_per_group/3]). +-export([post_end_per_group/4]). + +-export([pre_init_per_testcase/3]). +-export([post_end_per_testcase/4]). + +-export([on_tc_fail/3]). +-export([on_tc_skip/3]). + +-export([terminate/1]). + +-record(state, { filepath, axis, properties, package, hostname, + curr_suite, curr_suite_ts, curr_group = [], curr_tc, + curr_log_dir, timer, tc_log, + test_cases = [], + test_suites = [] }). + +-record(testcase, { log, group, classname, name, time, failure, timestamp }). +-record(testsuite, { errors, failures, hostname, name, tests, + time, timestamp, id, package, + properties, testcases }). + +id(Opts) -> + filename:absname(proplists:get_value(path, Opts, "junit_report.xml")). + +init(Path, Opts) -> + {ok, Host} = inet:gethostname(), + #state{ filepath = Path, + hostname = proplists:get_value(hostname,Opts,Host), + package = proplists:get_value(package,Opts), + axis = proplists:get_value(axis,Opts,[]), + properties = proplists:get_value(properties,Opts,[]), + timer = now() }. + +pre_init_per_suite(Suite,Config,State) -> + {Config, init_tc(State#state{ curr_suite = Suite, curr_suite_ts = now() }, + Config) }. + +post_init_per_suite(_Suite,Config, Result, State) -> + {Result, end_tc(init_per_suite,Config,Result,State)}. + +pre_end_per_suite(_Suite,Config,State) -> {Config, init_tc(State, Config)}. + +post_end_per_suite(_Suite,Config,Result,State) -> + NewState = end_tc(end_per_suite,Config,Result,State), + TCs = NewState#state.test_cases, + Suite = get_suite(NewState, TCs), + {Result, State#state{ test_cases = [], + test_suites = [Suite | State#state.test_suites]}}. + +pre_init_per_group(Group,Config,State) -> + {Config, init_tc(State#state{ curr_group = [Group|State#state.curr_group]}, + Config)}. + +post_init_per_group(_Group,Config,Result,State) -> + {Result, end_tc(init_per_group,Config,Result,State)}. + +pre_end_per_group(_Group,Config,State) -> {Config, init_tc(State, Config)}. + +post_end_per_group(_Group,Config,Result,State) -> + NewState = end_tc(end_per_group, Config, Result, State), + {Result, NewState#state{ curr_group = tl(NewState#state.curr_group)}}. + +pre_init_per_testcase(_TC,Config,State) -> {Config, init_tc(State, Config)}. + +post_end_per_testcase(TC,Config,Result,State) -> + {Result, end_tc(TC,Config, Result,State)}. + +on_tc_fail(_TC, Res, State) -> + TCs = State#state.test_cases, + TC = hd(State#state.test_cases), + NewTC = TC#testcase{ failure = + {fail,lists:flatten(io_lib:format("~p",[Res]))} }, + State#state{ test_cases = [NewTC | tl(TCs)]}. + +on_tc_skip(_Tc, Res, State) -> + TCs = State#state.test_cases, + TC = hd(State#state.test_cases), + NewTC = TC#testcase{ + failure = + {skipped,lists:flatten(io_lib:format("~p",[Res]))} }, + State#state{ test_cases = [NewTC | tl(TCs)]}. + +init_tc(State, Config) -> + State#state{ timer = now(), + tc_log = proplists:get_value(tc_logfile, Config)}. + +end_tc(Func, Config, Res, State) when is_atom(Func) -> + end_tc(atom_to_list(Func), Config, Res, State); +end_tc(Name, _Config, _Res, State = #state{ curr_suite = Suite, + curr_group = Groups, + timer = TS, tc_log = Log } ) -> + ClassName = atom_to_list(Suite), + PGroup = string:join([ atom_to_list(Group)|| + Group <- lists:reverse(Groups)],"."), + TimeTakes = io_lib:format("~f",[timer:now_diff(now(),TS) / 1000000]), + State#state{ test_cases = [#testcase{ log = Log, + timestamp = now_to_string(TS), + classname = ClassName, + group = PGroup, + name = Name, + time = TimeTakes, + failure = passed }| State#state.test_cases]}. + +get_suite(State, TCs) -> + Total = length(TCs), + Succ = length(lists:filter(fun(#testcase{ failure = F }) -> + F == passed + end,TCs)), + Fail = Total - Succ, + TimeTaken = timer:now_diff(now(),State#state.curr_suite_ts) / 1000000, + #testsuite{ name = atom_to_list(State#state.curr_suite), + package = State#state.package, + time = io_lib:format("~f",[TimeTaken]), + timestamp = now_to_string(State#state.curr_suite_ts), + errors = Fail, tests = Total, testcases = lists:reverse(TCs) }. + +terminate(State) -> + {ok,D} = file:open(State#state.filepath,[write]), + io:format(D, "<?xml version=\"1.0\" encoding= \"UTF-8\" ?>", []), + io:format(D, to_xml(State), []), + catch file:sync(D), + catch file:close(D). + +to_xml(#testcase{ group = Group, classname = CL, log = L, name = N, time = T, timestamp = TS, failure = F}) -> + ["<testcase ", + [["group=\"",Group,"\""]||Group /= ""]," " + "name=\"",N,"\" " + "time=\"",T,"\" " + "timestamp=\"",TS,"\" " + "log=\"",L,"\">", + case F of + passed -> + []; + {skipped,Reason} -> + ["<skipped type=\"skip\" message=\"Test ",N," in ",CL, + " skipped!\">", sanitize(Reason),"</skipped>"]; + {fail,Reason} -> + ["<failure message=\"Test ",N," in ",CL," failed!\" type=\"crash\">", + sanitize(Reason),"</failure>"] + end,"</testcase>"]; +to_xml(#testsuite{ package = P, hostname = H, errors = E, time = Time, + timestamp = TS, tests = T, name = N, testcases = Cases }) -> + ["<testsuite ", + [["package=\"",P,"\" "]||P /= undefined], + [["hostname=\"",P,"\" "]||H /= undefined], + [["name=\"",N,"\" "]||N /= undefined], + [["time=\"",Time,"\" "]||Time /= undefined], + [["timestamp=\"",TS,"\" "]||TS /= undefined], + "errors=\"",integer_to_list(E),"\" " + "tests=\"",integer_to_list(T),"\">", + [to_xml(Case) || Case <- Cases], + "</testsuite>"]; +to_xml(#state{ test_suites = TestSuites, axis = Axis, properties = Props }) -> + ["<testsuites>",properties_to_xml(Axis,Props), + [to_xml(TestSuite) || TestSuite <- TestSuites],"</testsuites>"]. + +properties_to_xml(Axis,Props) -> + ["<properties>", + [["<property name=\"",Name,"\" axis=\"yes\" value=\"",Value,"\" />"] || {Name,Value} <- Axis], + [["<property name=\"",Name,"\" value=\"",Value,"\" />"] || {Name,Value} <- Props], + "</properties>" + ]. + +sanitize([$>|T]) -> + ">" ++ sanitize(T); +sanitize([$<|T]) -> + "<" ++ sanitize(T); +sanitize([$"|T]) -> + """ ++ sanitize(T); +sanitize([$'|T]) -> + "'" ++ sanitize(T); +sanitize([$&|T]) -> + "&" ++ sanitize(T); +sanitize([H|T]) -> + [H|sanitize(T)]; +sanitize([]) -> + []. + +now_to_string(Now) -> + {{YY,MM,DD},{HH,Mi,SS}} = calendar:now_to_local_time(Now), + io_lib:format("~p-~2..0B-~2..0BT~2..0B:~2..0B:~2..0B",[YY,MM,DD,HH,Mi,SS]). diff --git a/lib/common_test/src/vts.erl b/lib/common_test/src/vts.erl index cc8a932887..9dfb0bd6b8 100644 --- a/lib/common_test/src/vts.erl +++ b/lib/common_test/src/vts.erl @@ -766,10 +766,6 @@ report1(tc_done,{_Suite,init_per_group,_},State) -> State; report1(tc_done,{_Suite,end_per_group,_},State) -> State; -report1(tc_done,{_Suite,ct_init_per_group,_},State) -> - State; -report1(tc_done,{_Suite,ct_end_per_group,_},State) -> - State; report1(tc_done,{_Suite,_Case,ok},State) -> State#state{ok=State#state.ok+1}; report1(tc_done,{_Suite,_Case,{failed,_Reason}},State) -> diff --git a/lib/common_test/test/ct_group_info_SUITE.erl b/lib/common_test/test/ct_group_info_SUITE.erl index 2da8219196..18016c4979 100644 --- a/lib/common_test/test/ct_group_info_SUITE.erl +++ b/lib/common_test/test/ct_group_info_SUITE.erl @@ -440,72 +440,72 @@ test_events(timetrap_all_no_ipg) -> {?eh,tc_done,{group_timetrap_3_SUITE,t1,{failed,{timetrap_timeout,1000}}}}, - [{?eh,tc_start,{ct_framework,{ct_init_per_group,g1,[{suite,group_timetrap_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_init_per_group,g1,[{suite,group_timetrap_3_SUITE}]},ok}}, + [{?eh,tc_start,{ct_framework,{init_per_group,g1,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{init_per_group,g1,[{suite,group_timetrap_3_SUITE}]},ok}}, {?eh,tc_done,{group_timetrap_3_SUITE,t11,{failed,{timetrap_timeout,500}}}}, - {?eh,tc_start,{ct_framework,{ct_end_per_group,g1,[{suite,group_timetrap_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_end_per_group,g1,[{suite,group_timetrap_3_SUITE}]},ok}}], + {?eh,tc_start,{ct_framework,{end_per_group,g1,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{end_per_group,g1,[{suite,group_timetrap_3_SUITE}]},ok}}], - [{?eh,tc_start,{ct_framework,{ct_init_per_group,g2,[{suite,group_timetrap_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_init_per_group,g2,[{suite,group_timetrap_3_SUITE}]},ok}}, + [{?eh,tc_start,{ct_framework,{init_per_group,g2,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{init_per_group,g2,[{suite,group_timetrap_3_SUITE}]},ok}}, {?eh,tc_done,{group_timetrap_3_SUITE,t21,{failed,{timetrap_timeout,1500}}}}, - {?eh,tc_start,{ct_framework,{ct_end_per_group,g2,[{suite,group_timetrap_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_end_per_group,g2,[{suite,group_timetrap_3_SUITE}]},ok}}], + {?eh,tc_start,{ct_framework,{end_per_group,g2,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{end_per_group,g2,[{suite,group_timetrap_3_SUITE}]},ok}}], {?eh,tc_done,{group_timetrap_3_SUITE,t2,{failed,{timetrap_timeout,1000}}}}, - [{?eh,tc_start,{ct_framework,{ct_init_per_group,g3,[{suite,group_timetrap_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_init_per_group,g3,[{suite,group_timetrap_3_SUITE}]},ok}}, - [{?eh,tc_start,{ct_framework,{ct_init_per_group,g4,[{suite,group_timetrap_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_init_per_group,g4,[{suite,group_timetrap_3_SUITE}]},ok}}, + [{?eh,tc_start,{ct_framework,{init_per_group,g3,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{init_per_group,g3,[{suite,group_timetrap_3_SUITE}]},ok}}, + [{?eh,tc_start,{ct_framework,{init_per_group,g4,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{init_per_group,g4,[{suite,group_timetrap_3_SUITE}]},ok}}, {?eh,tc_done,{group_timetrap_3_SUITE,t41,{failed,{timetrap_timeout,250}}}}, - {?eh,tc_start,{ct_framework,{ct_end_per_group,g4,[{suite,group_timetrap_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_end_per_group,g4,[{suite,group_timetrap_3_SUITE}]},ok}}], + {?eh,tc_start,{ct_framework,{end_per_group,g4,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{end_per_group,g4,[{suite,group_timetrap_3_SUITE}]},ok}}], {?eh,tc_done,{group_timetrap_3_SUITE,t31,{failed,{timetrap_timeout,500}}}}, - [{?eh,tc_start,{ct_framework,{ct_init_per_group,g5,[{suite,group_timetrap_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_init_per_group,g5,[{suite,group_timetrap_3_SUITE}]},ok}}, + [{?eh,tc_start,{ct_framework,{init_per_group,g5,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{init_per_group,g5,[{suite,group_timetrap_3_SUITE}]},ok}}, {?eh,tc_done,{group_timetrap_3_SUITE,t51,{failed,{timetrap_timeout,1500}}}}, - {?eh,tc_start,{ct_framework,{ct_end_per_group,g5,[{suite,group_timetrap_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_end_per_group,g5,[{suite,group_timetrap_3_SUITE}]},ok}}], - {?eh,tc_start,{ct_framework,{ct_end_per_group,g3,[{suite,group_timetrap_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_end_per_group,g3,[{suite,group_timetrap_3_SUITE}]},ok}}], + {?eh,tc_start,{ct_framework,{end_per_group,g5,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{end_per_group,g5,[{suite,group_timetrap_3_SUITE}]},ok}}], + {?eh,tc_start,{ct_framework,{end_per_group,g3,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{end_per_group,g3,[{suite,group_timetrap_3_SUITE}]},ok}}], {?eh,tc_done,{group_timetrap_3_SUITE,t3,{failed,{timetrap_timeout,250}}}}, - [{?eh,tc_start,{ct_framework,{ct_init_per_group,g6,[{suite,group_timetrap_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_init_per_group,g6,[{suite,group_timetrap_3_SUITE}]},ok}}, + [{?eh,tc_start,{ct_framework,{init_per_group,g6,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{init_per_group,g6,[{suite,group_timetrap_3_SUITE}]},ok}}, {?eh,tc_done,{group_timetrap_3_SUITE,t61,{failed,{timetrap_timeout,500}}}}, - {?eh,tc_start,{ct_framework,{ct_end_per_group,g6,[{suite,group_timetrap_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_end_per_group,g6,[{suite,group_timetrap_3_SUITE}]},ok}}], + {?eh,tc_start,{ct_framework,{end_per_group,g6,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{end_per_group,g6,[{suite,group_timetrap_3_SUITE}]},ok}}], - [{?eh,tc_start,{ct_framework,{ct_init_per_group,g7,[{suite,group_timetrap_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_init_per_group,g7,[{suite,group_timetrap_3_SUITE}]},ok}}, - [{?eh,tc_start,{ct_framework,{ct_init_per_group,g8,[{suite,group_timetrap_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_init_per_group,g8,[{suite,group_timetrap_3_SUITE}]},ok}}, + [{?eh,tc_start,{ct_framework,{init_per_group,g7,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{init_per_group,g7,[{suite,group_timetrap_3_SUITE}]},ok}}, + [{?eh,tc_start,{ct_framework,{init_per_group,g8,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{init_per_group,g8,[{suite,group_timetrap_3_SUITE}]},ok}}, {?eh,tc_done,{group_timetrap_3_SUITE,t81,{failed,{timetrap_timeout,750}}}}, - {?eh,tc_start,{ct_framework,{ct_end_per_group,g8,[{suite,group_timetrap_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_end_per_group,g8,[{suite,group_timetrap_3_SUITE}]},ok}}], + {?eh,tc_start,{ct_framework,{end_per_group,g8,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{end_per_group,g8,[{suite,group_timetrap_3_SUITE}]},ok}}], {?eh,tc_done,{group_timetrap_3_SUITE,t71,{failed,{timetrap_timeout,500}}}}, - [{?eh,tc_start,{ct_framework,{ct_init_per_group,g9,[{suite,group_timetrap_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_init_per_group,g9,[{suite,group_timetrap_3_SUITE}]},ok}}, + [{?eh,tc_start,{ct_framework,{init_per_group,g9,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{init_per_group,g9,[{suite,group_timetrap_3_SUITE}]},ok}}, {?eh,tc_done,{group_timetrap_3_SUITE,t91,{failed,{timetrap_timeout,250}}}}, - {?eh,tc_start,{ct_framework,{ct_end_per_group,g9,[{suite,group_timetrap_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_end_per_group,g9,[{suite,group_timetrap_3_SUITE}]},ok}}], - {?eh,tc_start,{ct_framework,{ct_end_per_group,g7,[{suite,group_timetrap_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_end_per_group,g7,[{suite,group_timetrap_3_SUITE}]},ok}}], + {?eh,tc_start,{ct_framework,{end_per_group,g9,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{end_per_group,g9,[{suite,group_timetrap_3_SUITE}]},ok}}], + {?eh,tc_start,{ct_framework,{end_per_group,g7,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{end_per_group,g7,[{suite,group_timetrap_3_SUITE}]},ok}}], - [{?eh,tc_start,{ct_framework,{ct_init_per_group,g10,[{suite,group_timetrap_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_init_per_group,g10,[{suite,group_timetrap_3_SUITE}]},ok}}, + [{?eh,tc_start,{ct_framework,{init_per_group,g10,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{init_per_group,g10,[{suite,group_timetrap_3_SUITE}]},ok}}, {?eh,tc_done,{group_timetrap_3_SUITE,t101,{failed,{timetrap_timeout,1000}}}}, - {?eh,tc_start,{ct_framework,{ct_end_per_group,g10,[{suite,group_timetrap_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_end_per_group,g10,[{suite,group_timetrap_3_SUITE}]},ok}}], + {?eh,tc_start,{ct_framework,{end_per_group,g10,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{end_per_group,g10,[{suite,group_timetrap_3_SUITE}]},ok}}], - [{?eh,tc_start,{ct_framework,{ct_init_per_group,g11,[{suite,group_timetrap_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_init_per_group,g11,[{suite,group_timetrap_3_SUITE}]},ok}}, + [{?eh,tc_start,{ct_framework,{init_per_group,g11,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{init_per_group,g11,[{suite,group_timetrap_3_SUITE}]},ok}}, {?eh,tc_done,{group_timetrap_3_SUITE,t111,{failed,{timetrap_timeout,1000}}}}, {?eh,test_stats,{0,14,{0,0}}}, - {?eh,tc_start,{ct_framework,{ct_end_per_group,g11,[{suite,group_timetrap_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_end_per_group,g11,[{suite,group_timetrap_3_SUITE}]},ok}}], + {?eh,tc_start,{ct_framework,{end_per_group,g11,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{end_per_group,g11,[{suite,group_timetrap_3_SUITE}]},ok}}], {?eh,test_done,{'DEF','STOP_TIME'}}, {?eh,stop_logging,[]} @@ -779,78 +779,78 @@ test_events(require_no_ipg) -> {?eh,start_info,{1,1,13}}, {?eh,tc_done,{group_require_3_SUITE,t1,ok}}, - [{?eh,tc_start,{ct_framework,{ct_init_per_group,g1,[{suite,group_require_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_init_per_group,g1,[{suite,group_require_3_SUITE}]},ok}}, + [{?eh,tc_start,{ct_framework,{init_per_group,g1,[{suite,group_require_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{init_per_group,g1,[{suite,group_require_3_SUITE}]},ok}}, {?eh,tc_done,{group_require_3_SUITE,t11,ok}}, - {?eh,tc_start,{ct_framework,{ct_end_per_group,g1,[{suite,group_require_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_end_per_group,g1,[{suite,group_require_3_SUITE}]},ok}}], + {?eh,tc_start,{ct_framework,{end_per_group,g1,[{suite,group_require_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{end_per_group,g1,[{suite,group_require_3_SUITE}]},ok}}], - [{?eh,tc_start,{ct_framework,{ct_init_per_group,g2,[{suite,group_require_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_init_per_group,g2,[{suite,group_require_3_SUITE}]},ok}}, + [{?eh,tc_start,{ct_framework,{init_per_group,g2,[{suite,group_require_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{init_per_group,g2,[{suite,group_require_3_SUITE}]},ok}}, {?eh,tc_done,{group_require_3_SUITE,t21,ok}}, - {?eh,tc_start,{ct_framework,{ct_end_per_group,g2,[{suite,group_require_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_end_per_group,g2,[{suite,group_require_3_SUITE}]},ok}}], + {?eh,tc_start,{ct_framework,{end_per_group,g2,[{suite,group_require_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{end_per_group,g2,[{suite,group_require_3_SUITE}]},ok}}], - [{?eh,tc_start,{ct_framework,{ct_init_per_group,g3,[{suite,group_require_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_init_per_group,g3,[{suite,group_require_3_SUITE}]},ok}}, + [{?eh,tc_start,{ct_framework,{init_per_group,g3,[{suite,group_require_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{init_per_group,g3,[{suite,group_require_3_SUITE}]},ok}}, {?eh,tc_done,{group_require_3_SUITE,t31,ok}}, - {?eh,tc_start,{ct_framework,{ct_end_per_group,g3,[{suite,group_require_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_end_per_group,g3,[{suite,group_require_3_SUITE}]},ok}}], + {?eh,tc_start,{ct_framework,{end_per_group,g3,[{suite,group_require_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{end_per_group,g3,[{suite,group_require_3_SUITE}]},ok}}], - [{?eh,tc_start,{ct_framework,{ct_init_per_group,g4,[{suite,group_require_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_init_per_group,g4,[{suite,group_require_3_SUITE}]}, + [{?eh,tc_start,{ct_framework,{init_per_group,g4,[{suite,group_require_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{init_per_group,g4,[{suite,group_require_3_SUITE}]}, {skipped,{require_failed,{name_in_use,common2_alias,common2}}}}}, {?eh,tc_auto_skip,{group_require_3_SUITE,t41, {require_failed,{name_in_use,common2_alias,common2}}}}, {?eh,test_stats,{4,0,{0,1}}}, - {?eh,tc_auto_skip,{ct_framework,ct_end_per_group, + {?eh,tc_auto_skip,{ct_framework,end_per_group, {require_failed,{name_in_use,common2_alias,common2}}}}], - [{?eh,tc_start,{ct_framework,{ct_init_per_group,g5,[{suite,group_require_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_init_per_group,g5,[{suite,group_require_3_SUITE}]},ok}}, - [{?eh,tc_start,{ct_framework,{ct_init_per_group,g6,[{suite,group_require_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_init_per_group,g6,[{suite,group_require_3_SUITE}]},ok}}, + [{?eh,tc_start,{ct_framework,{init_per_group,g5,[{suite,group_require_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{init_per_group,g5,[{suite,group_require_3_SUITE}]},ok}}, + [{?eh,tc_start,{ct_framework,{init_per_group,g6,[{suite,group_require_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{init_per_group,g6,[{suite,group_require_3_SUITE}]},ok}}, {?eh,tc_done,{group_require_3_SUITE,t61,ok}}, - {?eh,tc_start,{ct_framework,{ct_end_per_group,g6,[{suite,group_require_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_end_per_group,g6,[{suite,group_require_3_SUITE}]},ok}}], + {?eh,tc_start,{ct_framework,{end_per_group,g6,[{suite,group_require_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{end_per_group,g6,[{suite,group_require_3_SUITE}]},ok}}], {?eh,tc_done,{group_require_3_SUITE,t51,ok}}, - [{?eh,tc_start,{ct_framework,{ct_init_per_group,g7,[{suite,group_require_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_init_per_group,g7,[{suite,group_require_3_SUITE}]},ok}}, + [{?eh,tc_start,{ct_framework,{init_per_group,g7,[{suite,group_require_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{init_per_group,g7,[{suite,group_require_3_SUITE}]},ok}}, {?eh,tc_done,{group_require_3_SUITE,t71,ok}}, {?eh,tc_done,{group_require_3_SUITE,t72,ok}}, - {?eh,tc_start,{ct_framework,{ct_end_per_group,g7,[{suite,group_require_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_end_per_group,g7,[{suite,group_require_3_SUITE}]},ok}}], - {?eh,tc_start,{ct_framework,{ct_end_per_group,g5,[{suite,group_require_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_end_per_group,g5,[{suite,group_require_3_SUITE}]},ok}}], + {?eh,tc_start,{ct_framework,{end_per_group,g7,[{suite,group_require_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{end_per_group,g7,[{suite,group_require_3_SUITE}]},ok}}], + {?eh,tc_start,{ct_framework,{end_per_group,g5,[{suite,group_require_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{end_per_group,g5,[{suite,group_require_3_SUITE}]},ok}}], - [{?eh,tc_start,{ct_framework,{ct_init_per_group,g8,[{suite,group_require_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_init_per_group,g8,[{suite,group_require_3_SUITE}]}, + [{?eh,tc_start,{ct_framework,{init_per_group,g8,[{suite,group_require_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{init_per_group,g8,[{suite,group_require_3_SUITE}]}, {skipped,{require_failed,{not_available,non_existing}}}}}, {?eh,tc_auto_skip,{group_require_3_SUITE,t81, {require_failed,{not_available,non_existing}}}}, {?eh,test_stats,{8,0,{0,2}}}, - {?eh,tc_auto_skip,{ct_framework,ct_end_per_group, + {?eh,tc_auto_skip,{ct_framework,end_per_group, {require_failed,{not_available,non_existing}}}}], - [{?eh,tc_start,{ct_framework,{ct_init_per_group,g9,[{suite,group_require_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_init_per_group,g9,[{suite,group_require_3_SUITE}]},ok}}, + [{?eh,tc_start,{ct_framework,{init_per_group,g9,[{suite,group_require_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{init_per_group,g9,[{suite,group_require_3_SUITE}]},ok}}, {?eh,tc_done,{group_require_3_SUITE,t91, {skipped,{require_failed,{not_available,non_existing}}}}}, {?eh,test_stats,{8,0,{0,3}}}, - {?eh,tc_start,{ct_framework,{ct_end_per_group,g9,[{suite,group_require_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_end_per_group,g9,[{suite,group_require_3_SUITE}]},ok}}], + {?eh,tc_start,{ct_framework,{end_per_group,g9,[{suite,group_require_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{end_per_group,g9,[{suite,group_require_3_SUITE}]},ok}}], - [{?eh,tc_start,{ct_framework,{ct_init_per_group,g10,[{suite,group_require_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_init_per_group,g10,[{suite,group_require_3_SUITE}]},ok}}, + [{?eh,tc_start,{ct_framework,{init_per_group,g10,[{suite,group_require_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{init_per_group,g10,[{suite,group_require_3_SUITE}]},ok}}, {?eh,tc_done,{group_require_3_SUITE,t101,ok}}, - {?eh,tc_start,{ct_framework,{ct_end_per_group,g10,[{suite,group_require_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_end_per_group,g10,[{suite,group_require_3_SUITE}]},ok}}], + {?eh,tc_start,{ct_framework,{end_per_group,g10,[{suite,group_require_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{end_per_group,g10,[{suite,group_require_3_SUITE}]},ok}}], - [{?eh,tc_start,{ct_framework,{ct_init_per_group,g11,[{suite,group_require_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_init_per_group,g11,[{suite,group_require_3_SUITE}]},ok}}, + [{?eh,tc_start,{ct_framework,{init_per_group,g11,[{suite,group_require_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{init_per_group,g11,[{suite,group_require_3_SUITE}]},ok}}, {?eh,tc_done,{group_require_3_SUITE,t111,ok}}, {?eh,test_stats,{10,0,{0,3}}}, - {?eh,tc_start,{ct_framework,{ct_end_per_group,g11,[{suite,group_require_3_SUITE}]}}}, - {?eh,tc_done,{ct_framework,{ct_end_per_group,g11,[{suite,group_require_3_SUITE}]},ok}}], + {?eh,tc_start,{ct_framework,{end_per_group,g11,[{suite,group_require_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{end_per_group,g11,[{suite,group_require_3_SUITE}]},ok}}], {?eh,test_done,{'DEF','STOP_TIME'}}, {?eh,stop_logging,[]} diff --git a/lib/common_test/test/ct_groups_test_2_SUITE.erl b/lib/common_test/test/ct_groups_test_2_SUITE.erl index 2392b0b850..c3601ba0ce 100644 --- a/lib/common_test/test/ct_groups_test_2_SUITE.erl +++ b/lib/common_test/test/ct_groups_test_2_SUITE.erl @@ -171,16 +171,16 @@ test_events(missing_conf) -> {?eh,start_logging,{'DEF','RUNDIR'}}, {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, {?eh,start_info,{1,1,2}}, - {?eh,tc_start,{ct_framework,{ct_init_per_group,group1,[]}}}, - {?eh,tc_done,{ct_framework,{ct_init_per_group,group1,[]},ok}}, + {?eh,tc_start,{ct_framework,{init_per_group,group1,[]}}}, + {?eh,tc_done,{ct_framework,{init_per_group,group1,[]},ok}}, {?eh,tc_start,{missing_conf_SUITE,tc1}}, {?eh,tc_done,{missing_conf_SUITE,tc1,ok}}, {?eh,test_stats,{1,0,{0,0}}}, {?eh,tc_start,{missing_conf_SUITE,tc2}}, {?eh,tc_done,{missing_conf_SUITE,tc2,ok}}, {?eh,test_stats,{2,0,{0,0}}}, - {?eh,tc_start,{ct_framework,{ct_end_per_group,group1,[]}}}, - {?eh,tc_done,{ct_framework,{ct_end_per_group,group1,[]},ok}}, + {?eh,tc_start,{ct_framework,{end_per_group,group1,[]}}}, + {?eh,tc_done,{ct_framework,{end_per_group,group1,[]},ok}}, {?eh,test_done,{'DEF','STOP_TIME'}}, {?eh,stop_logging,[]} ]; diff --git a/lib/common_test/test/ct_hooks_SUITE.erl b/lib/common_test/test/ct_hooks_SUITE.erl index 2c519f08b5..efe57a7d0b 100644 --- a/lib/common_test/test/ct_hooks_SUITE.erl +++ b/lib/common_test/test/ct_hooks_SUITE.erl @@ -83,10 +83,9 @@ all(suite) -> fail_post_suite_cth, skip_pre_suite_cth, skip_post_suite_cth, recover_post_suite_cth, update_config_cth, state_update_cth, options_cth, same_id_cth, - fail_n_skip_with_minimal_cth, prio_cth + fail_n_skip_with_minimal_cth, prio_cth, no_config ] - ) - . + ). %%-------------------------------------------------------------------- @@ -214,6 +213,10 @@ prio_cth(Config) when is_list(Config) -> [{empty_cth,[1000],1000},{empty_cth,[900],900}, {prio_cth,[1100,100],100},{prio_cth,[1100]}],Config). +no_config(Config) when is_list(Config) -> + do_test(no_config, "ct_no_config_SUITE.erl", + [verify_config_cth],Config). + %%%----------------------------------------------------------------- %%% HELP FUNCTIONS %%%----------------------------------------------------------------- @@ -1078,6 +1081,56 @@ test_events(prio_cth) -> {?eh,test_done,{'DEF','STOP_TIME'}}, {?eh,stop_logging,[]}]; +test_events(no_config) -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,cth,{empty_cth,init,[verify_config_cth,[]]}}, + {?eh,start_info,{1,1,2}}, + {?eh,tc_start,{ct_framework,init_per_suite}}, + {?eh,cth,{empty_cth,pre_init_per_suite, + [ct_no_config_SUITE,'$proplist',[]]}}, + {?eh,cth,{empty_cth,post_init_per_suite, + [ct_no_config_SUITE,'$proplist','$proplist',[]]}}, + {?eh,tc_done,{ct_framework,init_per_suite,ok}}, + {?eh,tc_start,{ct_no_config_SUITE,test_case_1}}, + {?eh,cth,{empty_cth,pre_init_per_testcase, + [test_case_1,'$proplist',[]]}}, + {?eh,cth,{empty_cth,post_end_per_testcase, + [test_case_1,'$proplist',ok,[]]}}, + {?eh,tc_done,{ct_no_config_SUITE,test_case_1,ok}}, + {?eh,test_stats,{1,0,{0,0}}}, + [{?eh,tc_start,{ct_framework,{init_per_group,test_group,'$proplist'}}}, + {?eh,cth,{empty_cth,pre_init_per_group, + [test_group,'$proplist',[]]}}, + {?eh,cth,{empty_cth,post_init_per_group, + [test_group,'$proplist','$proplist',[]]}}, + {?eh,tc_done,{ct_framework, + {init_per_group,test_group,'$proplist'},ok}}, + {?eh,tc_start,{ct_no_config_SUITE,test_case_2}}, + {?eh,cth,{empty_cth,pre_init_per_testcase, + [test_case_2,'$proplist',[]]}}, + {?eh,cth,{empty_cth,post_end_per_testcase, + [test_case_2,'$proplist',ok,[]]}}, + {?eh,tc_done,{ct_no_config_SUITE,test_case_2,ok}}, + {?eh,test_stats,{2,0,{0,0}}}, + {?eh,tc_start,{ct_framework,{end_per_group,test_group,'$proplist'}}}, + {?eh,cth,{empty_cth,pre_end_per_group, + [test_group,'$proplist',[]]}}, + {?eh,cth,{empty_cth,post_end_per_group, + [test_group,'$proplist',ok,[]]}}, + {?eh,tc_done,{ct_framework,{end_per_group,test_group,'$proplist'},ok}}], + {?eh,tc_start,{ct_framework,end_per_suite}}, + {?eh,cth,{empty_cth,pre_end_per_suite, + [ct_no_config_SUITE,'$proplist',[]]}}, + {?eh,cth,{empty_cth,post_end_per_suite, + [ct_no_config_SUITE,'$proplist',ok,[]]}}, + {?eh,tc_done,{ct_framework,end_per_suite,ok}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,cth,{empty_cth,terminate,[[]]}}, + {?eh,stop_logging,[]} + ]; + test_events(ok) -> ok. diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_no_config_SUITE.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_no_config_SUITE.erl new file mode 100644 index 0000000000..2ad80aa1e7 --- /dev/null +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_no_config_SUITE.erl @@ -0,0 +1,64 @@ +%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2010-2011. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+
+-module(ct_no_config_SUITE).
+
+%% Note: This directive should only be used in test suites.
+-compile(export_all).
+
+-include("ct.hrl").
+
+%%% This suite is used to verify 2 things:
+%%%
+%%% 1) All hook pre/post functions get called, even if no init/end
+%%% config functions exist in the suite (new from ver 1.6.1, R15B01).
+%%%
+%%% 2) The hook functions can read Config list elements, as well as
+%%% required config variables, even if no init/end config
+%%% functions exist.
+
+suite() ->
+ [{timetrap, {seconds,1}},
+ {ct_hooks, [verify_config_cth]},
+ {require,suite_cfg},
+ {default_config,suite_cfg,?MODULE}].
+
+group(test_group) ->
+ [{require,group_cfg},
+ {default_config,group_cfg,test_group}].
+
+test_case_1() ->
+ [{require,test_case_1_cfg},
+ {default_config,test_case_1_cfg,test_case_1}].
+
+test_case_2() ->
+ [{require,test_case_2_cfg},
+ {default_config,test_case_2_cfg,test_case_2}].
+
+all() ->
+ [test_case_1, {group,test_group}].
+
+groups() ->
+ [{test_group,[],[test_case_2]}].
+
+test_case_1(Config) ->
+ ok.
+
+test_case_2(Config) ->
+ ok.
diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/empty_cth.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/empty_cth.erl index 7befcfa57c..2529e806ea 100644 --- a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/empty_cth.erl +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/empty_cth.erl @@ -1,277 +1,277 @@ -%%
-%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2010-2011. All Rights Reserved.
-%%
-%% The contents of this file are subject to the Erlang Public License,
-%% Version 1.1, (the "License"); you may not use this file except in
-%% compliance with the License. You should have received a copy of the
-%% Erlang Public License along with this software. If not, it can be
-%% retrieved online at http://www.erlang.org/.
-%%
-%% Software distributed under the License is distributed on an "AS IS"
-%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
-%% the License for the specific language governing rights and limitations
-%% under the License.
-%%
-%% %CopyrightEnd%
-%%
-
-%%% @doc Common Test Example Suite Callback module.
-%%%
-%%% <p>This module gives an example of a common test CTH (Common Test Hook).
-%%% There are many ways to add a CTH to a test run, you can do it either in
-%%% the command line using -ct_hook, in a test spec using
-%%% {ct_hook,M} or in the suite it self by returning ct_hook
-%%% from either suite/0, init_per_suite/1, init_per_group/2 and
-%%% init_per_testcase/2. The scope of the CTH is determined by where is it
-%%% started. If it is started in the command line or test spec then it will
-%%% be stopped at the end of all tests. If it is started in init_per_suite,
-%%% it will be stopped after end_per_suite and so on. See terminate
-%%% documentation for a table describing the scoping machanics.
-%%%
-%%% All of callbacks except init/1 in a CTH are optional.</p>
-
--module(empty_cth).
-
-%% CT Hooks
--export([id/1]).
--export([init/2]).
-
--export([pre_init_per_suite/3]).
--export([post_init_per_suite/4]).
--export([pre_end_per_suite/3]).
--export([post_end_per_suite/4]).
-
--export([pre_init_per_group/3]).
--export([post_init_per_group/4]).
--export([pre_end_per_group/3]).
--export([post_end_per_group/4]).
-
--export([pre_init_per_testcase/3]).
--export([post_end_per_testcase/4]).
-
--export([on_tc_fail/3]).
--export([on_tc_skip/3]).
-
--export([terminate/1]).
-
--include_lib("common_test/src/ct_util.hrl").
--include_lib("common_test/include/ct_event.hrl").
-
+%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2010-2011. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% + +%%% @doc Common Test Example Suite Callback module. +%%% +%%% <p>This module gives an example of a common test CTH (Common Test Hook). +%%% There are many ways to add a CTH to a test run, you can do it either in +%%% the command line using -ct_hook, in a test spec using +%%% {ct_hook,M} or in the suite it self by returning ct_hook +%%% from either suite/0, init_per_suite/1, init_per_group/2 and +%%% init_per_testcase/2. The scope of the CTH is determined by where is it +%%% started. If it is started in the command line or test spec then it will +%%% be stopped at the end of all tests. If it is started in init_per_suite, +%%% it will be stopped after end_per_suite and so on. See terminate +%%% documentation for a table describing the scoping machanics. +%%% +%%% All of callbacks except init/1 in a CTH are optional.</p> + +-module(empty_cth). + +%% CT Hooks +-export([id/1]). +-export([init/2]). + +-export([pre_init_per_suite/3]). +-export([post_init_per_suite/4]). +-export([pre_end_per_suite/3]). +-export([post_end_per_suite/4]). + +-export([pre_init_per_group/3]). +-export([post_init_per_group/4]). +-export([pre_end_per_group/3]). +-export([post_end_per_group/4]). + +-export([pre_init_per_testcase/3]). +-export([post_end_per_testcase/4]). + +-export([on_tc_fail/3]). +-export([on_tc_skip/3]). + +-export([terminate/1]). + +-include_lib("common_test/src/ct_util.hrl"). +-include_lib("common_test/include/ct_event.hrl"). + -type config() :: proplists:proplist(). --type reason() :: term().
--type skip_or_fail() :: {skip, reason()} |
- {auto_skip, reason()} |
- {fail, reason()} |
- {'EXIT',reason()}.
-
--record(state, { id = ?MODULE :: term()}).
-
-%% @doc Always called before any other callback function. Use this to initiate
-%% any common state. It should return an state for this CTH.
+-type reason() :: term(). +-type skip_or_fail() :: {skip, reason()} | + {auto_skip, reason()} | + {fail, reason()} | + {'EXIT',reason()}. + +-record(state, { id = ?MODULE :: term()}). + +%% @doc Always called before any other callback function. Use this to initiate +%% any common state. It should return an state for this CTH. -spec init(Id :: term(), Opts :: proplists:proplist()) -> - {ok, State :: #state{}}.
-init(Id, Opts) ->
- gen_event:notify(?CT_EVMGR_REF, #event{ name = cth, node = node(),
- data = {?MODULE, init, [Id, Opts]}}),
- {ok,Opts}.
-
-%% @doc The ID is used to uniquly identify an CTH instance, if two CTH's
-%% return the same ID the seconds CTH is ignored. This function should NOT
-%% have any side effects as it might be called multiple times by common test.
+ {ok, State :: #state{}}. +init(Id, Opts) -> + gen_event:notify(?CT_EVMGR_REF, #event{ name = cth, node = node(), + data = {?MODULE, init, [Id, Opts]}}), + {ok,Opts}. + +%% @doc The ID is used to uniquly identify an CTH instance, if two CTH's +%% return the same ID the seconds CTH is ignored. This function should NOT +%% have any side effects as it might be called multiple times by common test. -spec id(Opts :: proplists:proplist()) -> - Id :: term().
-id(Opts) ->
- gen_event:notify(?CT_EVMGR_REF, #event{ name = cth, node = node(),
- data = {?MODULE, id, [Opts]}}),
- now().
-
-%% @doc Called before init_per_suite is called. Note that this callback is
-%% only called if the CTH is added before init_per_suite is run (eg. in a test
-%% specification, suite/0 function etc).
-%% You can change the config in the this function.
--spec pre_init_per_suite(Suite :: atom(),
- Config :: config(),
- State :: #state{}) ->
- {config() | skip_or_fail(), NewState :: #state{}}.
-pre_init_per_suite(Suite,Config,State) ->
- gen_event:notify(
- ?CT_EVMGR_REF, #event{ name = cth, node = node(),
- data = {?MODULE, pre_init_per_suite,
- [Suite,Config,State]}}),
- {Config, State}.
-
-%% @doc Called after init_per_suite.
-%% you can change the return value in this function.
--spec post_init_per_suite(Suite :: atom(),
- Config :: config(),
- Return :: config() | skip_or_fail(),
- State :: #state{}) ->
- {config() | skip_or_fail(), NewState :: #state{}}.
-post_init_per_suite(Suite,Config,Return,State) ->
- gen_event:notify(
- ?CT_EVMGR_REF, #event{ name = cth, node = node(),
- data = {?MODULE, post_init_per_suite,
- [Suite,Config,Return,State]}}),
- {Return, State}.
-
-%% @doc Called before end_per_suite. The config/state can be changed here,
-%% though it will only affect the *end_per_suite function.
--spec pre_end_per_suite(Suite :: atom(),
- Config :: config() | skip_or_fail(),
- State :: #state{}) ->
- {ok | skip_or_fail(), NewState :: #state{}}.
-pre_end_per_suite(Suite,Config,State) ->
- gen_event:notify(
- ?CT_EVMGR_REF, #event{ name = cth, node = node(),
- data = {?MODULE, pre_end_per_suite,
- [Suite,Config,State]}}),
- {Config, State}.
-
-%% @doc Called after end_per_suite. Note that the config cannot be
-%% changed here, only the status of the suite.
--spec post_end_per_suite(Suite :: atom(),
- Config :: config(),
- Return :: term(),
- State :: #state{}) ->
- {ok | skip_or_fail(), NewState :: #state{}}.
-post_end_per_suite(Suite,Config,Return,State) ->
- gen_event:notify(
- ?CT_EVMGR_REF, #event{ name = cth, node = node(),
- data = {?MODULE, post_end_per_suite,
- [Suite,Config,Return,State]}}),
- {Return, State}.
-
-%% @doc Called before each init_per_group.
-%% You can change the config in this function.
--spec pre_init_per_group(Group :: atom(),
- Config :: config(),
- State :: #state{}) ->
- {config() | skip_or_fail(), NewState :: #state{}}.
-pre_init_per_group(Group,Config,State) ->
- gen_event:notify(
- ?CT_EVMGR_REF, #event{ name = cth, node = node(),
- data = {?MODULE, pre_init_per_group,
- [Group,Config,State]}}),
- {Config, State}.
-
-%% @doc Called after each init_per_group.
-%% You can change the return value in this function.
--spec post_init_per_group(Group :: atom(),
- Config :: config(),
- Return :: config() | skip_or_fail(),
- State :: #state{}) ->
- {config() | skip_or_fail(), NewState :: #state{}}.
-post_init_per_group(Group,Config,Return,State) ->
- gen_event:notify(
- ?CT_EVMGR_REF, #event{ name = cth, node = node(),
- data = {?MODULE, post_init_per_group,
- [Group,Config,Return,State]}}),
- {Return, State}.
-
-%% @doc Called after each end_per_group. The config/state can be changed here,
-%% though it will only affect the *end_per_group functions.
--spec pre_end_per_group(Group :: atom(),
- Config :: config() | skip_or_fail(),
- State :: #state{}) ->
- {ok | skip_or_fail(), NewState :: #state{}}.
-pre_end_per_group(Group,Config,State) ->
- gen_event:notify(
- ?CT_EVMGR_REF, #event{ name = cth, node = node(),
- data = {?MODULE, pre_end_per_group,
- [Group,Config,State]}}),
- {Config, State}.
-
-%% @doc Called after each end_per_group. Note that the config cannot be
-%% changed here, only the status of the group.
--spec post_end_per_group(Group :: atom(),
- Config :: config(),
- Return :: term(),
- State :: #state{}) ->
- {ok | skip_or_fail(), NewState :: #state{}}.
-post_end_per_group(Group,Config,Return,State) ->
- gen_event:notify(
- ?CT_EVMGR_REF, #event{ name = cth, node = node(),
- data = {?MODULE, post_end_per_group,
- [Group,Config,Return,State]}}),
- {Return, State}.
-
-%% @doc Called before each test case.
-%% You can change the config in this function.
--spec pre_init_per_testcase(TC :: atom(),
- Config :: config(),
- State :: #state{}) ->
- {config() | skip_or_fail(), NewState :: #state{}}.
-pre_init_per_testcase(TC,Config,State) ->
- gen_event:notify(
- ?CT_EVMGR_REF, #event{ name = cth, node = node(),
- data = {?MODULE, pre_init_per_testcase,
- [TC,Config,State]}}),
- {Config, State}.
-
-%% @doc Called after each test case. Note that the config cannot be
-%% changed here, only the status of the test case.
--spec post_end_per_testcase(TC :: atom(),
- Config :: config(),
- Return :: term(),
- State :: #state{}) ->
- {ok | skip_or_fail(), NewState :: #state{}}.
-post_end_per_testcase(TC,Config,Return,State) ->
- gen_event:notify(
- ?CT_EVMGR_REF, #event{ name = cth, node = node(),
- data = {?MODULE, post_end_per_testcase,
- [TC,Config,Return,State]}}),
- {Return, State}.
-
-%% @doc Called after post_init_per_suite, post_end_per_suite, post_init_per_group,
-%% post_end_per_group and post_end_per_tc if the suite, group or test case failed.
-%% This function should be used for extra cleanup which might be needed.
-%% It is not possible to modify the config or the status of the test run.
--spec on_tc_fail(TC :: init_per_suite | end_per_suite |
- init_per_group | end_per_group | atom(),
- Reason :: term(), State :: #state{}) ->
- NewState :: #state{}.
-on_tc_fail(TC, Reason, State) ->
- gen_event:notify(
- ?CT_EVMGR_REF, #event{ name = cth, node = node(),
- data = {?MODULE, on_tc_fail,
- [TC,Reason,State]}}),
- State.
-
-%% @doc Called when a test case is skipped by either user action
-%% or due to an init function failing. Test case can be
-%% end_per_suite, init_per_group, end_per_group and the actual test cases.
--spec on_tc_skip(TC :: end_per_suite |
- init_per_group | end_per_group | atom(),
- {tc_auto_skip, {failed, {Mod :: atom(), Function :: atom(), Reason :: term()}}} |
- {tc_user_skip, {skipped, Reason :: term()}},
- State :: #state{}) ->
- NewState :: #state{}.
-on_tc_skip(TC, Reason, State) ->
- gen_event:notify(
- ?CT_EVMGR_REF, #event{ name = cth, node = node(),
- data = {?MODULE, on_tc_skip,
- [TC,Reason,State]}}),
- State.
-
-%% @doc Called when the scope of the CTH is done, this depends on
-%% when the CTH was specified. This translation table describes when this
-%% function is called.
-%%
-%% | Started in | terminate called |
-%% |---------------------|-------------------------|
-%% | command_line | after all tests are run |
-%% | test spec | after all tests are run |
-%% | suite/0 | after SUITE is done |
-%% | init_per_suite/1 | after SUITE is done |
-%% | init_per_group/2 | after group is done |
-%% |-----------------------------------------------|
-%%
--spec terminate(State :: #state{}) ->
- term().
-terminate(State) ->
- gen_event:notify(
- ?CT_EVMGR_REF, #event{ name = cth, node = node(),
- data = {?MODULE, terminate, [State]}}),
- ok.
+ Id :: term(). +id(Opts) -> + gen_event:notify(?CT_EVMGR_REF, #event{ name = cth, node = node(), + data = {?MODULE, id, [Opts]}}), + now(). + +%% @doc Called before init_per_suite is called. Note that this callback is +%% only called if the CTH is added before init_per_suite is run (eg. in a test +%% specification, suite/0 function etc). +%% You can change the config in the this function. +-spec pre_init_per_suite(Suite :: atom(), + Config :: config(), + State :: #state{}) -> + {config() | skip_or_fail(), NewState :: #state{}}. +pre_init_per_suite(Suite,Config,State) -> + gen_event:notify( + ?CT_EVMGR_REF, #event{ name = cth, node = node(), + data = {?MODULE, pre_init_per_suite, + [Suite,Config,State]}}), + {Config, State}. + +%% @doc Called after init_per_suite. +%% you can change the return value in this function. +-spec post_init_per_suite(Suite :: atom(), + Config :: config(), + Return :: config() | skip_or_fail(), + State :: #state{}) -> + {config() | skip_or_fail(), NewState :: #state{}}. +post_init_per_suite(Suite,Config,Return,State) -> + gen_event:notify( + ?CT_EVMGR_REF, #event{ name = cth, node = node(), + data = {?MODULE, post_init_per_suite, + [Suite,Config,Return,State]}}), + {Return, State}. + +%% @doc Called before end_per_suite. The config/state can be changed here, +%% though it will only affect the *end_per_suite function. +-spec pre_end_per_suite(Suite :: atom(), + Config :: config() | skip_or_fail(), + State :: #state{}) -> + {ok | skip_or_fail(), NewState :: #state{}}. +pre_end_per_suite(Suite,Config,State) -> + gen_event:notify( + ?CT_EVMGR_REF, #event{ name = cth, node = node(), + data = {?MODULE, pre_end_per_suite, + [Suite,Config,State]}}), + {Config, State}. + +%% @doc Called after end_per_suite. Note that the config cannot be +%% changed here, only the status of the suite. +-spec post_end_per_suite(Suite :: atom(), + Config :: config(), + Return :: term(), + State :: #state{}) -> + {ok | skip_or_fail(), NewState :: #state{}}. +post_end_per_suite(Suite,Config,Return,State) -> + gen_event:notify( + ?CT_EVMGR_REF, #event{ name = cth, node = node(), + data = {?MODULE, post_end_per_suite, + [Suite,Config,Return,State]}}), + {Return, State}. + +%% @doc Called before each init_per_group. +%% You can change the config in this function. +-spec pre_init_per_group(Group :: atom(), + Config :: config(), + State :: #state{}) -> + {config() | skip_or_fail(), NewState :: #state{}}. +pre_init_per_group(Group,Config,State) -> + gen_event:notify( + ?CT_EVMGR_REF, #event{ name = cth, node = node(), + data = {?MODULE, pre_init_per_group, + [Group,Config,State]}}), + {Config, State}. + +%% @doc Called after each init_per_group. +%% You can change the return value in this function. +-spec post_init_per_group(Group :: atom(), + Config :: config(), + Return :: config() | skip_or_fail(), + State :: #state{}) -> + {config() | skip_or_fail(), NewState :: #state{}}. +post_init_per_group(Group,Config,Return,State) -> + gen_event:notify( + ?CT_EVMGR_REF, #event{ name = cth, node = node(), + data = {?MODULE, post_init_per_group, + [Group,Config,Return,State]}}), + {Return, State}. + +%% @doc Called after each end_per_group. The config/state can be changed here, +%% though it will only affect the *end_per_group functions. +-spec pre_end_per_group(Group :: atom(), + Config :: config() | skip_or_fail(), + State :: #state{}) -> + {ok | skip_or_fail(), NewState :: #state{}}. +pre_end_per_group(Group,Config,State) -> + gen_event:notify( + ?CT_EVMGR_REF, #event{ name = cth, node = node(), + data = {?MODULE, pre_end_per_group, + [Group,Config,State]}}), + {Config, State}. + +%% @doc Called after each end_per_group. Note that the config cannot be +%% changed here, only the status of the group. +-spec post_end_per_group(Group :: atom(), + Config :: config(), + Return :: term(), + State :: #state{}) -> + {ok | skip_or_fail(), NewState :: #state{}}. +post_end_per_group(Group,Config,Return,State) -> + gen_event:notify( + ?CT_EVMGR_REF, #event{ name = cth, node = node(), + data = {?MODULE, post_end_per_group, + [Group,Config,Return,State]}}), + {Return, State}. + +%% @doc Called before each test case. +%% You can change the config in this function. +-spec pre_init_per_testcase(TC :: atom(), + Config :: config(), + State :: #state{}) -> + {config() | skip_or_fail(), NewState :: #state{}}. +pre_init_per_testcase(TC,Config,State) -> + gen_event:notify( + ?CT_EVMGR_REF, #event{ name = cth, node = node(), + data = {?MODULE, pre_init_per_testcase, + [TC,Config,State]}}), + {Config, State}. + +%% @doc Called after each test case. Note that the config cannot be +%% changed here, only the status of the test case. +-spec post_end_per_testcase(TC :: atom(), + Config :: config(), + Return :: term(), + State :: #state{}) -> + {ok | skip_or_fail(), NewState :: #state{}}. +post_end_per_testcase(TC,Config,Return,State) -> + gen_event:notify( + ?CT_EVMGR_REF, #event{ name = cth, node = node(), + data = {?MODULE, post_end_per_testcase, + [TC,Config,Return,State]}}), + {Return, State}. + +%% @doc Called after post_init_per_suite, post_end_per_suite, post_init_per_group, +%% post_end_per_group and post_end_per_tc if the suite, group or test case failed. +%% This function should be used for extra cleanup which might be needed. +%% It is not possible to modify the config or the status of the test run. +-spec on_tc_fail(TC :: init_per_suite | end_per_suite | + init_per_group | end_per_group | atom(), + Reason :: term(), State :: #state{}) -> + NewState :: #state{}. +on_tc_fail(TC, Reason, State) -> + gen_event:notify( + ?CT_EVMGR_REF, #event{ name = cth, node = node(), + data = {?MODULE, on_tc_fail, + [TC,Reason,State]}}), + State. + +%% @doc Called when a test case is skipped by either user action +%% or due to an init function failing. Test case can be +%% end_per_suite, init_per_group, end_per_group and the actual test cases. +-spec on_tc_skip(TC :: end_per_suite | + init_per_group | end_per_group | atom(), + {tc_auto_skip, {failed, {Mod :: atom(), Function :: atom(), Reason :: term()}}} | + {tc_user_skip, {skipped, Reason :: term()}}, + State :: #state{}) -> + NewState :: #state{}. +on_tc_skip(TC, Reason, State) -> + gen_event:notify( + ?CT_EVMGR_REF, #event{ name = cth, node = node(), + data = {?MODULE, on_tc_skip, + [TC,Reason,State]}}), + State. + +%% @doc Called when the scope of the CTH is done, this depends on +%% when the CTH was specified. This translation table describes when this +%% function is called. +%% +%% | Started in | terminate called | +%% |---------------------|-------------------------| +%% | command_line | after all tests are run | +%% | test spec | after all tests are run | +%% | suite/0 | after SUITE is done | +%% | init_per_suite/1 | after SUITE is done | +%% | init_per_group/2 | after group is done | +%% |-----------------------------------------------| +%% +-spec terminate(State :: #state{}) -> + term(). +terminate(State) -> + gen_event:notify( + ?CT_EVMGR_REF, #event{ name = cth, node = node(), + data = {?MODULE, terminate, [State]}}), + ok. diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/verify_config_cth.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/verify_config_cth.erl new file mode 100644 index 0000000000..99ea261e14 --- /dev/null +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/verify_config_cth.erl @@ -0,0 +1,130 @@ +%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2010-2011. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+
+-module(verify_config_cth).
+
+-include_lib("common_test/src/ct_util.hrl").
+
+%% CT Hooks
+-compile(export_all).
+
+-define(val(K, L), proplists:get_value(K, L)).
+
+id(Opts) ->
+ ?MODULE.
+
+init(Id, Opts) ->
+ {ok, State} = empty_cth:init(Id, Opts),
+ {ok, State}.
+
+pre_init_per_suite(Suite, Config, State) ->
+ ct_no_config_SUITE = ct:get_config(suite_cfg),
+ empty_cth:pre_init_per_suite(Suite,
+ [{pre_init_per_suite,true} | Config],
+ State).
+
+post_init_per_suite(Suite,Config,Return,State) ->
+ true = ?val(pre_init_per_suite, Return),
+ ct_no_config_SUITE = ct:get_config(suite_cfg),
+ empty_cth:post_init_per_suite(Suite,
+ Config,
+ [{post_init_per_suite,true} | Return],
+ State).
+
+pre_end_per_suite(Suite,Config,State) ->
+ true = ?val(post_init_per_suite, Config),
+ ct_no_config_SUITE = ct:get_config(suite_cfg),
+ empty_cth:pre_end_per_suite(Suite,
+ [{pre_end_per_suite,true} | Config],
+ State).
+
+post_end_per_suite(Suite,Config,Return,State) ->
+ true = ?val(pre_end_per_suite, Config),
+ ct_no_config_SUITE = ct:get_config(suite_cfg),
+ empty_cth:post_end_per_suite(Suite,Config,Return,State).
+
+pre_init_per_group(Group,Config,State) ->
+ true = ?val(post_init_per_suite, Config),
+ ct_no_config_SUITE = ct:get_config(suite_cfg),
+ test_group = ct:get_config(group_cfg),
+ empty_cth:pre_init_per_group(Group,
+ [{pre_init_per_group,true} | Config],
+ State).
+
+post_init_per_group(Group,Config,Return,State) ->
+ true = ?val(pre_init_per_group, Return),
+ test_group = ct:get_config(group_cfg),
+ empty_cth:post_init_per_group(Group,
+ Config,
+ [{post_init_per_group,true} | Return],
+ State).
+
+pre_end_per_group(Group,Config,State) ->
+ true = ?val(post_init_per_group, Config),
+ ct_no_config_SUITE = ct:get_config(suite_cfg),
+ test_group = ct:get_config(group_cfg),
+ empty_cth:pre_end_per_group(Group,
+ [{pre_end_per_group,true} | Config],
+ State).
+
+post_end_per_group(Group,Config,Return,State) ->
+ true = ?val(pre_end_per_group, Config),
+ ct_no_config_SUITE = ct:get_config(suite_cfg),
+ test_group = ct:get_config(group_cfg),
+ empty_cth:post_end_per_group(Group,Config,Return,State).
+
+pre_init_per_testcase(TC,Config,State) ->
+ true = ?val(post_init_per_suite, Config),
+ case ?val(name, ?val(tc_group_properties, Config)) of
+ undefined ->
+ ok;
+ _ ->
+ true = ?val(post_init_per_group, Config),
+ test_group = ct:get_config(group_cfg)
+ end,
+ ct_no_config_SUITE = ct:get_config(suite_cfg),
+ CfgKey = list_to_atom(atom_to_list(TC) ++ "_cfg"),
+ TC = ct:get_config(CfgKey),
+ empty_cth:pre_init_per_testcase(TC,
+ [{pre_init_per_testcase,true} | Config],
+ State).
+
+post_end_per_testcase(TC,Config,Return,State) ->
+ true = ?val(post_init_per_suite, Config),
+ true = ?val(pre_init_per_testcase, Config),
+ case ?val(name, ?val(tc_group_properties, Config)) of
+ undefined ->
+ ok;
+ _ ->
+ true = ?val(post_init_per_group, Config),
+ test_group = ct:get_config(group_cfg)
+ end,
+ ct_no_config_SUITE = ct:get_config(suite_cfg),
+ CfgKey = list_to_atom(atom_to_list(TC) ++ "_cfg"),
+ TC = ct:get_config(CfgKey),
+ empty_cth:post_end_per_testcase(TC,Config,Return,State).
+
+on_tc_fail(TC, Reason, State) ->
+ empty_cth:on_tc_fail(TC,Reason,State).
+
+on_tc_skip(TC, Reason, State) ->
+ empty_cth:on_tc_skip(TC,Reason,State).
+
+terminate(State) ->
+ empty_cth:terminate(State).
diff --git a/lib/common_test/test/ct_test_server_if_1_SUITE.erl b/lib/common_test/test/ct_test_server_if_1_SUITE.erl index efc0309781..8825d84884 100644 --- a/lib/common_test/test/ct_test_server_if_1_SUITE.erl +++ b/lib/common_test/test/ct_test_server_if_1_SUITE.erl @@ -242,25 +242,28 @@ test_events(ts_if_1) -> {?eh,tc_auto_skip,{ts_if_5_SUITE,end_per_suite, {require_failed_in_suite0,{not_available,undef_variable}}}}, - {?eh,tc_start,{ts_if_6_SUITE,tc1}}, - {?eh,tc_done,{ts_if_6_SUITE,tc1,{failed,{error,{suite0_failed,{exited,suite0_byebye}}}}}}, - {?eh,test_stats,{3,5,{6,8}}}, + {?eh,tc_start,{ct_framework,init_per_suite}}, + {?eh,tc_done,{ct_framework,init_per_suite, + {failed,{error,{suite0_failed,{exited,suite0_byebye}}}}}}, + {?eh,tc_auto_skip,{ts_if_6_SUITE,tc1, + {failed,{error,{suite0_failed,{exited,suite0_byebye}}}}}}, + {?eh,test_stats,{3,5,{5,9}}}, {?eh,tc_start,{ts_if_7_SUITE,tc1}}, {?eh,tc_done,{ts_if_7_SUITE,tc1,ok}}, - {?eh,test_stats,{4,5,{6,8}}}, + {?eh,test_stats,{4,5,{5,9}}}, {?eh,tc_start,{ts_if_8_SUITE,tc1}}, {?eh,tc_done,{ts_if_8_SUITE,tc1,{failed,{error,failed_on_purpose}}}}, - {?eh,test_stats,{4,6,{6,8}}}, + {?eh,test_stats,{4,6,{5,9}}}, {?eh,tc_user_skip,{skipped_by_spec_1_SUITE,all,"should be skipped"}}, - {?eh,test_stats,{4,6,{7,8}}}, + {?eh,test_stats,{4,6,{6,9}}}, {?eh,tc_start,{skipped_by_spec_2_SUITE,init_per_suite}}, {?eh,tc_done,{skipped_by_spec_2_SUITE,init_per_suite,ok}}, {?eh,tc_user_skip,{skipped_by_spec_2_SUITE,tc1,"should be skipped"}}, - {?eh,test_stats,{4,6,{8,8}}}, + {?eh,test_stats,{4,6,{7,9}}}, {?eh,tc_start,{skipped_by_spec_2_SUITE,end_per_suite}}, {?eh,tc_done,{skipped_by_spec_2_SUITE,end_per_suite,ok}}, diff --git a/lib/debugger/src/dbg_iserver.erl b/lib/debugger/src/dbg_iserver.erl index 1bb73a43b9..31a856545f 100644 --- a/lib/debugger/src/dbg_iserver.erl +++ b/lib/debugger/src/dbg_iserver.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2011. All Rights Reserved. +%% Copyright Ericsson AB 1998-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -188,10 +188,7 @@ handle_call({new_break, Point, Options}, _From, State) -> handle_call(all_breaks, _From, State) -> {reply, State#state.breaks, State}; handle_call({all_breaks, Mod}, _From, State) -> - Reply = lists:filter(fun({{M,_L}, _Options}) -> - M =/= Mod - end, - State#state.breaks), + Reply = [Break || Break = {{M, _},_} <- State#state.breaks, M =:= Mod], {reply, Reply, State}; %% From Meta process diff --git a/lib/debugger/test/int_break_SUITE.erl b/lib/debugger/test/int_break_SUITE.erl index 159678a1f9..7bb0fc2018 100644 --- a/lib/debugger/test/int_break_SUITE.erl +++ b/lib/debugger/test/int_break_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2011. All Rights Reserved. +%% Copyright Ericsson AB 1999-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -76,6 +76,9 @@ basic(Config) when list(Config) -> ?line S3 = [xxx,y] = ordsets1:add_element(y, S2), ?line ok = i:ib(ordsets1, union, 2), ?line [xxx,y,z] = ordsets1:union(S3, [z]), + All = [{{ordsets1,86}, _}, {{ordsets1,_},_}|_] = lists:sort(int:all_breaks()), + [] = lists:sort(int:all_breaks(foobar)), + All = lists:sort(int:all_breaks(ordsets1)), ok. cleanup(doc) -> "Make sure that the auto-attach flag is turned off."; diff --git a/lib/ic/src/ic_noc.erl b/lib/ic/src/ic_noc.erl index d43d550a52..b3fa3ee96e 100644 --- a/lib/ic/src/ic_noc.erl +++ b/lib/ic/src/ic_noc.erl @@ -289,6 +289,9 @@ emit_serv_std(G, N, X) -> emit(Fd, "terminate(Reason, State) ->\n"), emit(Fd, " ~p:~p(Reason, State).\n", [Impl, terminate]), + nl(Fd), + emit(Fd, "code_change(_OldVsn, State, _Extra) ->\n"), + emit(Fd, " {ok, State}.\n"), nl(Fd), nl(Fd) end, Fd. @@ -304,13 +307,13 @@ gen_end_of_call(G, _N, _X) -> Fd = ic_genobj:stubfiled(G), nl(Fd), nl(Fd), ic_codegen:mcomment_light(Fd, ["Standard gen_server call handle"]), - emit(Fd, "handle_call(stop, From, State) ->\n"), + emit(Fd, "handle_call(stop, _From, State) ->\n"), emit(Fd, " {stop, normal, ok, State}"), case get_opt(G, serv_last_call) of exception -> emit(Fd, ";\n"), nl(Fd), - emit(Fd, "handle_call(Req, From, State) ->\n"), + emit(Fd, "handle_call(_Req, _From, State) ->\n"), emit(Fd, " {reply, ~p, State}.\n",[getCallErr()]); exit -> emit(Fd, ".\n"), @@ -335,7 +338,7 @@ gen_end_of_cast(G, _N, _X) -> exception -> emit(Fd, ";\n"), nl(Fd), - emit(Fd, "handle_cast(Req, State) ->\n"), + emit(Fd, "handle_cast(_Req, State) ->\n"), emit(Fd, " {reply, ~p, State}.\n",[getCastErr()]); exit -> emit(Fd, ".\n"), @@ -353,12 +356,13 @@ emit_skel_footer(G, N, X) -> Fd = ic_genobj:stubfiled(G), nl(Fd), nl(Fd), ic_codegen:mcomment_light(Fd, ["Standard gen_server handles"]), - emit(Fd, "handle_info(X, State) ->\n"), case use_impl_handle_info(G, N, X) of true -> + emit(Fd, "handle_info(X, State) ->\n"), emit(Fd, " ~p:handle_info(X, State).\n\n", [list_to_atom(ic_genobj:impl(G))]); false -> + emit(Fd, "handle_info(_X, State) ->\n"), emit(Fd, " {reply, ~p, State}.\n\n",[getInfoErr()]) end end, @@ -402,9 +406,8 @@ get_if_gen(G, N, X) -> [io_lib:format("Standard Operation: ~p", [Name])]), - emit(Fd, "handle_call({~s, ~p, []}, From, State) ->~n", + emit(Fd, "handle_call({_~s, ~p, []}, _From, State) ->~n", [mk_name(G, "Ref"), Name]), - emit(Fd, " {reply, ~p, State};~n", [IFC_TKS]), nl(Fd), ok; @@ -479,8 +482,8 @@ gen_head_special(G, N, X) when is_record(X, interface) -> nl(Fd), ic_codegen:comment(Fd, "gen server export stuff"), emit(Fd, "-behaviour(gen_server).\n"), - ic_codegen:export(Fd, [{init, 1}, {terminate, 2}, {handle_call, 3}, - {handle_cast, 2}, {handle_info, 2}]), + ic_codegen:export(Fd, [{init, 1}, {terminate, 2}, {code_change, 3}, + {handle_call, 3}, {handle_cast, 2}, {handle_info, 2}]), nl(Fd), nl(Fd), ic_codegen:mcomment(Fd, ["Object interface functions."]), nl(Fd), nl(Fd), nl(Fd) diff --git a/lib/ic/test/c_client_erl_server_SUITE_data/Makefile.src b/lib/ic/test/c_client_erl_server_SUITE_data/Makefile.src index d5277eb256..53543a5bf0 100644 --- a/lib/ic/test/c_client_erl_server_SUITE_data/Makefile.src +++ b/lib/ic/test/c_client_erl_server_SUITE_data/Makefile.src @@ -122,24 +122,33 @@ EBINS = $(ERL_FILES:.erl=.@EMULATOR@) all: $(PGMS) $(EBINS) +$(GEN_ERL_FILES) $(GEN_HRL_FILES): c_erl_test.built_erl +$(GEN_C_FILES) $(GEN_H_FILES): c_erl_test.built_c +$(OBJS): $(GEN_C_FILES) $(GEN_H_FILES) +$(EBINS): $(GEN_ERL_FILES) $(GEN_HRL_FILES) + clean: -rm -f $(OBJS) $(GEN_C_FILES) $(GEN_H_FILES) $(PGMS) \ - $(EBINS) $(GEN_ERL_FILES) $(GEN_HRL_FILES) + $(EBINS) $(GEN_ERL_FILES) $(GEN_HRL_FILES) \ + c_erl_test.built_erl c_erl_test.built_c -del /F /Q $(OBJS) $(GEN_C_FILES) $(GEN_H_FILES) $(PGMS) \ - $(EBINS) $(GEN_ERL_FILES) $(GEN_HRL_FILES) + $(EBINS) $(GEN_ERL_FILES) $(GEN_HRL_FILES) \ + c_erl_test.built_erl c_erl_test.built_c $(PGMS): $(OBJS) $(LD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) -$(GEN_C_FILES) $(GEN_H_FILES): c_erl_test.idl +c_erl_test.built_c: c_erl_test.idl $(ERLC) -I $(IC_INCLUDE_PATH) "+{be,c_client}" c_erl_test.idl + echo done > c_erl_test.built_c -$(GEN_ERL_FILES) $(GEN_HRL_FILES): c_erl_test.idl +c_erl_test.built_erl: c_erl_test.idl $(ERLC) -I $(IC_INCLUDE_PATH) "+{be,erl_genserv}" c_erl_test.idl + echo done > c_erl_test.built_erl -.c@obj@: +.c@obj@: $(CC) -c -o $*@obj@ $(CFLAGS) $< -.erl.@EMULATOR@: +.erl.@EMULATOR@: $(ERLC) -I $(IC_INCLUDE_PATH) $< diff --git a/lib/ic/test/c_client_erl_server_proto_SUITE_data/Makefile.src b/lib/ic/test/c_client_erl_server_proto_SUITE_data/Makefile.src index 8bc1a907a7..7d32ee4e87 100644 --- a/lib/ic/test/c_client_erl_server_proto_SUITE_data/Makefile.src +++ b/lib/ic/test/c_client_erl_server_proto_SUITE_data/Makefile.src @@ -122,25 +122,34 @@ EBINS = $(ERL_FILES:.erl=.@EMULATOR@) all: $(PGMS) $(EBINS) +$(GEN_ERL_FILES) $(GEN_HRL_FILES): c_erl_test.built_erl +$(GEN_C_FILES) $(GEN_H_FILES): c_erl_test.built_c +$(OBJS): $(GEN_C_FILES) $(GEN_H_FILES) +$(EBINS): $(GEN_ERL_FILES) $(GEN_HRL_FILES) + clean: -rm -f $(OBJS) $(GEN_C_FILES) $(GEN_H_FILES) $(PGMS) \ - $(EBINS) $(GEN_ERL_FILES) $(GEN_HRL_FILES) + $(EBINS) $(GEN_ERL_FILES) $(GEN_HRL_FILES) \ + c_erl_test.built_erl c_erl_test.built_c -del /F /Q $(OBJS) $(GEN_C_FILES) $(GEN_H_FILES) $(PGMS) \ - $(EBINS) $(GEN_ERL_FILES) $(GEN_HRL_FILES) + $(EBINS) $(GEN_ERL_FILES) $(GEN_HRL_FILES) \ + c_erl_test.built_erl c_erl_test.built_c $(PGMS): $(OBJS) $(LD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) -$(GEN_C_FILES) $(GEN_H_FILES): c_erl_test.idl +c_erl_test.built_c: c_erl_test.idl $(ERLC) -I $(IC_INCLUDE_PATH) "+{be,c_client}" \ "+{user_protocol,my}" c_erl_test.idl + echo done > c_erl_test.built_c -$(GEN_ERL_FILES) $(GEN_HRL_FILES): c_erl_test.idl +c_erl_test.built_erl: c_erl_test.idl $(ERLC) -I $(IC_INCLUDE_PATH) "+{be,erl_genserv}" c_erl_test.idl + echo done > c_erl_test.built_erl -.c@obj@: +.c@obj@: $(CC) -c -o $*@obj@ $(CFLAGS) $< -.erl.@EMULATOR@: +.erl.@EMULATOR@: $(ERLC) -I $(IC_INCLUDE_PATH) $< diff --git a/lib/ic/test/c_client_erl_server_proto_tmo_SUITE_data/Makefile.src b/lib/ic/test/c_client_erl_server_proto_tmo_SUITE_data/Makefile.src index 2585341791..19c67734ca 100644 --- a/lib/ic/test/c_client_erl_server_proto_tmo_SUITE_data/Makefile.src +++ b/lib/ic/test/c_client_erl_server_proto_tmo_SUITE_data/Makefile.src @@ -122,25 +122,33 @@ EBINS = $(ERL_FILES:.erl=.@EMULATOR@) all: $(PGMS) $(EBINS) +$(GEN_ERL_FILES) $(GEN_HRL_FILES): c_erl_test.built_erl +$(GEN_C_FILES) $(GEN_H_FILES): c_erl_test.built_c +$(OBJS): $(GEN_C_FILES) $(GEN_H_FILES) +$(EBINS): $(GEN_ERL_FILES) $(GEN_HRL_FILES) + clean: -rm -f $(OBJS) $(GEN_C_FILES) $(GEN_H_FILES) $(PGMS) \ - $(EBINS) $(GEN_ERL_FILES) $(GEN_HRL_FILES) + $(EBINS) $(GEN_ERL_FILES) $(GEN_HRL_FILES) \ + c_erl_test.built_erl c_erl_test.built_c -del /F /Q $(OBJS) $(GEN_C_FILES) $(GEN_H_FILES) $(PGMS) \ - $(EBINS) $(GEN_ERL_FILES) $(GEN_HRL_FILES) + $(EBINS) $(GEN_ERL_FILES) $(GEN_HRL_FILES) \ + c_erl_test.built_erl c_erl_test.built_c $(PGMS): $(OBJS) $(LD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) -$(GEN_C_FILES) $(GEN_H_FILES): c_erl_test.idl - $(ERLC) -I $(IC_INCLUDE_PATH) "+{be,c_client}" \ - "+{user_protocol,my}" "+{c_timeout,{5000,5000}}" c_erl_test.idl +c_erl_test.built_c: c_erl_test.idl + $(ERLC) -I $(IC_INCLUDE_PATH) "+{be,c_client}" c_erl_test.idl + echo done > c_erl_test.built_c -$(GEN_ERL_FILES) $(GEN_HRL_FILES): c_erl_test.idl +c_erl_test.built_erl: c_erl_test.idl $(ERLC) -I $(IC_INCLUDE_PATH) "+{be,erl_genserv}" c_erl_test.idl + echo done > c_erl_test.built_erl -.c@obj@: +.c@obj@: $(CC) -c -o $*@obj@ $(CFLAGS) $< -.erl.@EMULATOR@: +.erl.@EMULATOR@: $(ERLC) -I $(IC_INCLUDE_PATH) $< diff --git a/lib/ic/test/erl_client_c_server_SUITE_data/Makefile.src b/lib/ic/test/erl_client_c_server_SUITE_data/Makefile.src index 50cf9d4445..ac53d0a657 100644 --- a/lib/ic/test/erl_client_c_server_SUITE_data/Makefile.src +++ b/lib/ic/test/erl_client_c_server_SUITE_data/Makefile.src @@ -122,25 +122,34 @@ EBINS = $(ERL_FILES:.erl=.@EMULATOR@) all: $(PGMS) $(EBINS) +$(GEN_ERL_FILES) $(GEN_HRL_FILES): c_erl_test.built_erl +$(GEN_C_FILES) $(GEN_H_FILES): c_erl_test.built_c +$(OBJS): $(GEN_C_FILES) $(GEN_H_FILES) +$(EBINS): $(GEN_ERL_FILES) $(GEN_HRL_FILES) + clean: -rm -f $(OBJS) $(GEN_C_FILES) $(GEN_H_FILES) $(PGMS) \ - $(EBINS) $(GEN_ERL_FILES) $(GEN_HRL_FILES) + $(EBINS) $(GEN_ERL_FILES) $(GEN_HRL_FILES) \ + c_erl_test.built_erl c_erl_test.built_c -del /F /Q $(OBJS) $(GEN_C_FILES) $(GEN_H_FILES) $(PGMS) \ - $(EBINS) $(GEN_ERL_FILES) $(GEN_HRL_FILES) + $(EBINS) $(GEN_ERL_FILES) $(GEN_HRL_FILES) \ + c_erl_test.built_erl c_erl_test.built_c $(PGMS): $(OBJS) $(LD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) -$(GEN_C_FILES) $(GEN_H_FILES): erl_c_test.idl +c_erl_test.built_c: erl_c_test.idl $(ERLC) -I $(IC_INCLUDE_PATH) "+{be,c_server}" \ "+{scoped_op_calls,true}" erl_c_test.idl + echo done > c_erl_test.built_c # If we have scoped operation calls for C, we must have that for # Erlang as well, if we use the m_i.erl file for calling the server. -$(GEN_ERL_FILES) $(GEN_HRL_FILES): erl_c_test.idl +c_erl_test.built_erl: erl_c_test.idl $(ERLC) -I $(IC_INCLUDE_PATH) "+{be,erl_genserv}" \ "+{scoped_op_calls,true}" "+{timeout,true}" erl_c_test.idl + echo done > c_erl_test.built_erl .c@obj@: $(CC) -c -o $*@obj@ $(CFLAGS) $< diff --git a/lib/ic/test/erl_client_c_server_proto_SUITE_data/Makefile.src b/lib/ic/test/erl_client_c_server_proto_SUITE_data/Makefile.src index 6c7701ca50..d23de04944 100644 --- a/lib/ic/test/erl_client_c_server_proto_SUITE_data/Makefile.src +++ b/lib/ic/test/erl_client_c_server_proto_SUITE_data/Makefile.src @@ -122,25 +122,34 @@ EBINS = $(ERL_FILES:.erl=.@EMULATOR@) all: $(PGMS) $(EBINS) +$(GEN_ERL_FILES) $(GEN_HRL_FILES): c_erl_test.built_erl +$(GEN_C_FILES) $(GEN_H_FILES): c_erl_test.built_c +$(OBJS): $(GEN_C_FILES) $(GEN_H_FILES) +$(EBINS): $(GEN_ERL_FILES) $(GEN_HRL_FILES) + clean: -rm -f $(OBJS) $(GEN_C_FILES) $(GEN_H_FILES) $(PGMS) \ - $(EBINS) $(GEN_ERL_FILES) $(GEN_HRL_FILES) + $(EBINS) $(GEN_ERL_FILES) $(GEN_HRL_FILES) \ + c_erl_test.built_erl c_erl_test.built_c -del /F /Q $(OBJS) $(GEN_C_FILES) $(GEN_H_FILES) $(PGMS) \ - $(EBINS) $(GEN_ERL_FILES) $(GEN_HRL_FILES) + $(EBINS) $(GEN_ERL_FILES) $(GEN_HRL_FILES) \ + c_erl_test.built_erl c_erl_test.built_c $(PGMS): $(OBJS) $(LD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) -$(GEN_C_FILES) $(GEN_H_FILES): erl_c_test.idl +c_erl_test.built_c: erl_c_test.idl $(ERLC) -I $(IC_INCLUDE_PATH) "+{be,c_server}" \ "+{scoped_op_calls,true}" erl_c_test.idl + echo done > c_erl_test.built_c # If we have scoped operation calls for C, we must have that for # Erlang as well, if we use the m_i.erl file for calling the server. -$(GEN_ERL_FILES) $(GEN_HRL_FILES): erl_c_test.idl +c_erl_test.built_erl: erl_c_test.idl $(ERLC) -I $(IC_INCLUDE_PATH) "+{be,erl_genserv}" \ "+{scoped_op_calls,true}" "+{timeout,true}" erl_c_test.idl + echo done > c_erl_test.built_erl .c@obj@: $(CC) -c -o $*@obj@ $(CFLAGS) $< diff --git a/lib/ic/test/java_client_erl_server_SUITE_data/Makefile.src b/lib/ic/test/java_client_erl_server_SUITE_data/Makefile.src index 5e190fe1a5..0d84a62270 100644 --- a/lib/ic/test/java_client_erl_server_SUITE_data/Makefile.src +++ b/lib/ic/test/java_client_erl_server_SUITE_data/Makefile.src @@ -69,20 +69,29 @@ EBINS = $(ERL_FILES:.erl=.@EMULATOR@) all: $(CLASS_FILES) $(EBINS) +$(GEN_ERL_FILES) $(GEN_HRL_FILES): java_erl_test.built_erl +$(GEN_JAVA_FILES): java_erl_test.built_java +$(CLASS_FILES): $(GEN_JAVA_FILES) +$(EBINS): $(GEN_ERL_FILES) $(GEN_HRL_FILES) + clean: -rm -f $(GEN_JAVA_FILES) $(CLASS_FILES) \ - $(GEN_ERL_FILES) $(GEN_HRL_FILES) $(EBINS) + $(GEN_ERL_FILES) $(GEN_HRL_FILES) $(EBINS) \ + java_erl_test.built_erl java_erl_test.built_java -del /F /Q $(GEN_JAVA_FILES) $(CLASS_FILES) \ - $(GEN_ERL_FILES) $(GEN_HRL_FILES) $(EBINS) + $(GEN_ERL_FILES) $(GEN_HRL_FILES) $(EBINS) \ + java_erl_test.built_erl java_erl_test.built_java -$(GEN_JAVA_FILES) : java_erl_test.idl +java_erl_test.built_java: java_erl_test.idl $(ERLC) -I $(IC_INCLUDE_PATH) "+{be,java}" java_erl_test.idl + echo done > java_erl_test.built_java $(CLASS_FILES) : $(JAVA_FILES) $(JAVAC) -classpath $(CLASSPATH) $(JAVA_FILES) -$(GEN_ERL_FILES) $(GEN_HRL_FILES): java_erl_test.idl +java_erl_test.built_erl: java_erl_test.idl $(ERLC) -I $(IC_INCLUDE_PATH) "+{be,erl_genserv}" java_erl_test.idl + echo done > java_erl_test.built_erl .erl.@EMULATOR@: $(ERLC) -I $(IC_INCLUDE_PATH) $< diff --git a/lib/ic/vsn.mk b/lib/ic/vsn.mk index e21fc8fbb2..fc1475974e 100644 --- a/lib/ic/vsn.mk +++ b/lib/ic/vsn.mk @@ -1 +1 @@ -IC_VSN = 4.2.29 +IC_VSN = 4.2.30 diff --git a/lib/inets/doc/src/Makefile b/lib/inets/doc/src/Makefile index 53d505b102..c4152a1d72 100644 --- a/lib/inets/doc/src/Makefile +++ b/lib/inets/doc/src/Makefile @@ -48,6 +48,7 @@ XML_REF3_FILES = \ inets.xml \ ftp.xml \ tftp.xml \ + http_uri.xml\ httpc.xml\ httpd.xml \ httpd_conf.xml \ diff --git a/lib/inets/doc/src/book.xml b/lib/inets/doc/src/book.xml index 7da0abd98f..51cbb2d963 100644 --- a/lib/inets/doc/src/book.xml +++ b/lib/inets/doc/src/book.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="iso-8859-1" ?> <!DOCTYPE book SYSTEM "book.dtd"> <book xmlns:xi="http://www.w3.org/2001/XInclude"> <header titlestyle="normal"> <copyright> - <year>1997</year><year>2009</year> + <year>1997</year><year>2012</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> diff --git a/lib/inets/doc/src/fascicules.xml b/lib/inets/doc/src/fascicules.xml index 101e745722..ea3b988882 100644 --- a/lib/inets/doc/src/fascicules.xml +++ b/lib/inets/doc/src/fascicules.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="iso-8859-1" ?> <!DOCTYPE fascicules SYSTEM "fascicules.dtd"> <fascicules> diff --git a/lib/inets/doc/src/ftp_client.xml b/lib/inets/doc/src/ftp_client.xml index 7f62a453a6..b44674d997 100644 --- a/lib/inets/doc/src/ftp_client.xml +++ b/lib/inets/doc/src/ftp_client.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="iso-8859-1" ?> <!DOCTYPE chapter SYSTEM "chapter.dtd"> <chapter> <header> <copyright> - <year>2004</year><year>2009</year> + <year>2004</year><year>2012</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> diff --git a/lib/inets/doc/src/http_uri.xml b/lib/inets/doc/src/http_uri.xml new file mode 100644 index 0000000000..bd31ae42d2 --- /dev/null +++ b/lib/inets/doc/src/http_uri.xml @@ -0,0 +1,160 @@ +<?xml version="1.0" encoding="iso-8859-1" ?> +<!DOCTYPE erlref SYSTEM "erlref.dtd"> + +<erlref> + <header> + <copyright> + <year>2012</year><year>2012</year> + <holder>Ericsson AB. All Rights Reserved.</holder> + </copyright> + <legalnotice> + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + </legalnotice> + + <title>http_uri</title> + <prepared></prepared> + <responsible></responsible> + <docno></docno> + <date></date> + <rev></rev> + </header> + + <module>http_uri</module> + <modulesummary>URI utility module</modulesummary> + + <description> + <p>This module provides utility functions for working with URIs, + according to RFC 3986. </p> + + </description> + + <section> + <title>COMMON DATA TYPES </title> + <p>Type definitions that are used more than once in + this module:</p> + <code type="none"><![CDATA[ +boolean() = true | false +string() = list of ASCII characters + ]]></code> + + </section> + + <section> + <title>URI DATA TYPES </title> + <p>Type definitions that are related to URI:</p> + <p>For more information about URI, see RFC 3986. </p> + + <code type="none"><![CDATA[ +uri() = string() - Syntax according to the URI definition in rfc 3986, ex: "http://www.erlang.org/" +user_info() = string() +scheme() = atom() - Example: http, https +host() = string() +port() = pos_integer() +path() = string() - Representing a file path or directory path +query() = string() + ]]></code> + + <marker id="scheme_defaults"></marker> + </section> + + <funcs> + <func> + <name>scheme_defaults() -> SchemeDefaults</name> + <fsummary>A list of scheme and their default ports</fsummary> + <type> + <v>SchemeDefaults = [{scheme(), default_scheme_port_number()}] </v> + <v>default_scheme_port_number() = pos_integer()</v> + </type> + <desc> + <p>This function provides a list of the scheme and their default + port numbers currently supported (by default) by this utility. </p> + + <marker id="parse"></marker> + </desc> + </func> + + <func> + <name>parse(URI) -> {ok, Result} | {error, Reason}</name> + <name>parse(URI, Options) -> {ok, Result} | {error, Reason}</name> + <fsummary>Parse an URI</fsummary> + <type> + <v>URI = uri() </v> + <v>Options = [Option] </v> + <v>Option = {ipv6_host_with_brackets, boolean()} | + {scheme_defaults, scheme_defaults()}]</v> + <v>Result = {Scheme, UserInfo, Host, Port, Path, Query}</v> + <v>UserInfo = user_info()</v> + <v>Host = host()</v> + <v>Port = pos_integer()</v> + <v>Path = path()</v> + <v>Query = query()</v> + <v>Reason = term() </v> + </type> + <desc> + <p>This function is used to parse an URI. If no scheme defaults + are provided, the value of + <seealso marker="#scheme_defaults">scheme_defaults</seealso> + function will be used. </p> + + <p>Note that when parsing an URI with an unknown scheme (that is, + a scheme not found in the scheme defaults) a port number must be + provided or else the parsing will fail. </p> + + <marker id="encode"></marker> + </desc> + </func> + + <func> + <name>encode(URI) -> HexEncodedURI</name> + + <fsummary>Hex encode an URI</fsummary> + <type> + <v>URI = uri()</v> + <v>HexEncodedURI = string() - Hex encoded uri</v> + </type> + + <desc> + <p>Hex encode an URI. </p> + + <marker id="decode"></marker> + </desc> + </func> + + <func> + <name>decode(HexEncodedURI) -> URI</name> + + <fsummary>Decode a hex encoded URI</fsummary> + <type> + <v>HexEncodedURI = string() - A possibly hex encoded uri</v> + <v>URI = uri()</v> + </type> + + <desc> + <p>Decode a possibly hex encoded URI. </p> + + </desc> + </func> + + </funcs> + +<!-- + <section> + <title>SEE ALSO</title> + <p>RFC 2616, <seealso marker="inets">inets(3)</seealso>, + <seealso marker="kernel:gen_tcp">gen_tcp(3)</seealso>, + <seealso marker="ssl:ssl">ssl(3)</seealso> + </p> + </section> +--> + +</erlref> diff --git a/lib/inets/doc/src/httpc.xml b/lib/inets/doc/src/httpc.xml index 48a2089605..70c845bade 100644 --- a/lib/inets/doc/src/httpc.xml +++ b/lib/inets/doc/src/httpc.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>2004</year><year>2011</year> + <year>2004</year><year>2012</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -541,6 +541,35 @@ apply(Module, Function, [ReplyInfo | Args]) default value of the <c>max_sessions</c> option. </p> </note> + <marker id="get_options"></marker> + </desc> + </func> + + <func> + <name>get_options(OptionItems) -> {ok, Values} | {error, Reason}</name> + <name>get_options(OptionItems, Profile) -> {ok, Values} | {error, Reason}</name> + <fsummary>Gets the currently used options.</fsummary> + <type> + <v>OptionItems = all | [option_item()]</v> + <v>option_item() = proxy | + max_sessions | + keep_alive_timeout | + max_keep_alive_length | + pipeline_timeout | + max_pipeline_length | + cookies | + ipfamily | + ip | + port | + socket_opts | + verbose</v> + <v>Profile = profile() | pid() (when started <c>stand_alone</c>)</v> + <v>Values = [{option_item(), term()}]</v> + <v>Reason = term() </v> + </type> + <desc> + <p>Retrieves the options currently used by the client.</p> + <marker id="stream_next"></marker> </desc> </func> diff --git a/lib/inets/doc/src/httpd.xml b/lib/inets/doc/src/httpd.xml index f88099a82e..7e21229fcf 100644 --- a/lib/inets/doc/src/httpd.xml +++ b/lib/inets/doc/src/httpd.xml @@ -55,14 +55,14 @@ <section> <title>ERLANG HTTP SERVER SERVICE START/STOP </title> <p>A web server can be configured to start when starting the inets - application or started dynamically in runtime by calling the - Inets application API <c>inets:start(httpd, ServiceConfig)</c>, or - <c>inets:start(httpd, ServiceConfig, How)</c>, - see <seealso marker="inets">inets(3)</seealso> Below follows a - description of the available configuration options, also called - properties.</p> - - <marker id="file_prop"></marker> + application or started dynamically in runtime by calling the + Inets application API <c>inets:start(httpd, ServiceConfig)</c>, or + <c>inets:start(httpd, ServiceConfig, How)</c>, + see <seealso marker="inets">inets(3)</seealso> Below follows a + description of the available configuration options, also called + properties.</p> + + <marker id="props_file"></marker> <p><em>File properties</em></p> <p>When the web server is started @@ -76,21 +76,25 @@ list.</p> <taglist> + <marker id="prop_proplist_file"></marker> <tag>{proplist_file, path()}</tag> <item> - If this property is defined inets will expect to find - all other properties defined in this file. Note that the - file must include all properties listed under mandatory - properties. </item> - <tag>{file, path()}</tag> + <p>If this property is defined inets will expect to find + all other properties defined in this file. Note that the + file must include all properties listed under mandatory + properties. </p> + </item> - <item> If this property is defined - inets will expect to find all other properties defined in this - file, that uses Apache like syntax. Note that the file must - include all properties listed under mandatory properties. The - Apache like syntax is the property, written as one word where - each new word begins with a capital, followed by a white-space - followed by the value followed by a new line. Ex: + <marker id="prop_file"></marker> + <tag>{file, path()}</tag> + <item> + <p>If this property is defined inets will expect to find all + other properties defined in this file, that uses Apache like + syntax. Note that the file must include all properties listed + under mandatory properties. The Apache like syntax is the property, + written as one word where each new word begins with a capital, + followed by a white-space followed by the value followed by a + new line. Ex: </p> <code> {server_root, "/urs/local/www"} -> ServerRoot /usr/local/www @@ -114,40 +118,51 @@ <p>The properties proplist_file and file are mutually exclusive.</p> </note> - <marker id="mand_prop"></marker> + <marker id="props_mand"></marker> <p><em>Mandatory properties</em></p> <taglist> + <marker id="prop_port"></marker> <tag>{port, integer()} </tag> <item> - The port that the HTTP server shall listen on. - If zero is specified as port, an arbitrary available port - will be picked and you can use the httpd:info/2 function to find - out which port was picked. </item> + <p>The port that the HTTP server shall listen on. + If zero is specified as port, an arbitrary available port + will be picked and you can use the httpd:info/2 function to find + out which port was picked. </p> + </item> + + <marker id="prop_server_name"></marker> <tag>{server_name, string()} </tag> <item> - The name of your server, normally a fully qualified domain - name. + <p>The name of your server, normally a fully qualified domain name. </p> </item> + + <marker id="prop_server_root"></marker> <tag>{server_root, path()} </tag> <item> - Defines the servers home directory where log files etc can + <p>Defines the servers home directory where log files etc can be stored. Relative paths specified in other properties refer - to this directory.</item> + to this directory. </p> + </item> + + <marker id="prop_doc_root"></marker> <tag>{document_root, path()}</tag> <item> Defines the top directory for the documents that - are available on the HTTP server.</item> + are available on the HTTP server. + </item> </taglist> - <marker id="comm_prop"></marker> + <marker id="props_comm"></marker> <p><em>Communication properties</em> </p> <taglist> + <marker id="prop_bind_address"></marker> <tag>{bind_address, ip_address() | hostname() | any} </tag> <item> - Defaults to <c>any</c>. Note that <c>any</c> is denoted <em>*</em> - in the apache like configuration file. + <p>Defaults to <c>any</c>. Note that <c>any</c> is denoted <em>*</em> + in the apache like configuration file. </p> </item> + <marker id="prop_socket_type"></marker> <tag>{socket_type, ip_comm | ssl | essl}</tag> <item> <p>When using ssl, there are currently only one alternative. @@ -156,6 +171,7 @@ <p>Defaults to <c>ip_comm</c>. </p> </item> + <marker id="prop_ipfamily"></marker> <tag>{ipfamily, inet | inet6 | inet6fb4}</tag> <item> <p>Defaults to <c>inet6fb4. </c> </p> @@ -165,74 +181,93 @@ </taglist> + <marker id="props_api_modules"></marker> <p><em>Erlang Web server API modules</em> </p> <taglist> + <marker id="prop_modules"></marker> <tag>{modules, [atom()]} </tag> <item> - Defines which modules the HTTP server will use to handle + <p>Defines which modules the HTTP server will use to handle requests. Defaults to: <c>[mod_alias, mod_auth, mod_esi, mod_actions, mod_cgi, mod_dir, mod_get, mod_head, mod_log, mod_disk_log] </c> Note that some mod-modules are dependent on others, so the order can not be entirely arbitrary. See the <seealso marker="http_server"> Inets Web server Modules in the - Users guide</seealso> for more information. + Users guide</seealso> for more information. </p> </item> - </taglist> + </taglist> - <marker id="limit_prop"></marker> + <marker id="props_limit"></marker> <p><em>Limit properties</em> </p> <taglist> + <marker id="prop_disable_chunked_encoding"></marker> <tag>{disable_chunked_transfer_encoding_send, boolean()}</tag> <item> - This property allows you to disable chunked + <p>This property allows you to disable chunked transfer-encoding when sending a response to a HTTP/1.1 - client, by default this is false.</item> + client, by default this is false. </p> + </item> + <marker id="prop_keep_alive"></marker> <tag>{keep_alive, boolean()}</tag> <item> - Instructs the server whether or not to use persistent + <p>Instructs the server whether or not to use persistent connections when the client claims to be HTTP/1.1 - compliant, default is true.</item> + compliant, default is true. </p> + </item> + <marker id="prop_keep_alive_timeout"></marker> <tag>{keep_alive_timeout, integer()}</tag> <item> - The number of seconds the server will wait for a + <p>The number of seconds the server will wait for a subsequent request from the client before closing the - connection. Default is 150.</item> + connection. Default is 150. </p> + </item> + <marker id="prop_max_body_size"></marker> <tag>{max_body_size, integer()}</tag> <item> - Limits the size of the message body of HTTP request. - By the default there is no limit.</item> + <p>Limits the size of the message body of HTTP request. + By the default there is no limit. </p> + </item> + <marker id="prop_max_clients"></marker> <tag>{max_clients, integer()}</tag> <item> - Limits the number of simultaneous requests that can be - supported. Defaults to 150. </item> + <p>Limits the number of simultaneous requests that can be + supported. Defaults to 150. </p> + </item> + <marker id="prop_max_header_size"></marker> <tag>{max_header_size, integer()}</tag> <item> - Limits the size of the message header of HTTP request. - Defaults to 10240. + <p>Limits the size of the message header of HTTP request. + Defaults to 10240. </p> </item> + <marker id="prop_max_uri"></marker> <tag>{max_uri, integer()}</tag> <item> - Limits the size of the HTTP request URI. By - default there is no limit.</item> + <p>Limits the size of the HTTP request URI. By + default there is no limit. </p> + </item> + <marker id="prop_max_keep_alive_req"></marker> <tag>{max_keep_alive_requests, integer()}</tag> - <item> The number of request that a client can do on one + <item> + <p>The number of request that a client can do on one connection. When the server has responded to the number of requests defined by max_keep_alive_requests the server close the connection. The server will close it even if there are queued - request. Defaults to no limit.</item> + request. Defaults to no limit. </p> + </item> </taglist> - <marker id="admin_prop"></marker> + <marker id="props_admin"></marker> <p><em>Administrative properties</em></p> <taglist> + <marker id="prop_mime_types"></marker> <tag>{mime_types, [{MimeType, Extension}] | path()}</tag> <item> <p>Where MimeType = string() and Extension = string(). @@ -250,19 +285,43 @@ text/plain asc txt <p>Defaults to [{"html","text/html"},{"htm","text/html"}]</p> </item> + <marker id="prop_mime_type"></marker> <tag>{mime_type, string()}</tag> - <item> - When the server is asked to provide a document type which + <p>When the server is asked to provide a document type which cannot be determined by the MIME Type Settings, the server will - use this default type. </item> + use this default type. </p> + </item> + <marker id="prop_server_admin"></marker> <tag>{server_admin, string()}</tag> <item> - ServerAdmin defines the email-address of the server + <p>ServerAdmin defines the email-address of the server administrator, to be included in any error messages returned by - the server.</item> + the server. </p> + </item> + <marker id="prop_server_tokens"></marker> + <tag>{server_tokens, prod|major|minor|minimal|os|full|{private, string()}}</tag> + <item> + <p>ServerTokens defines how the value of the server header + should look. </p> + <p>Example: Assuming the version of inets is 5.8.1, + here is what the server header string could look like for + the different values of server-tokens: </p> + <pre> +prod "inets" +major "inets/5" +minor "inets/5.8" +minimal "inets/5.8.1" +os "inets/5.8.1 (unix)" +full "inets/5.8.1 (unix/linux) OTP/R15B" +{private, "foo/bar"} "foo/bar" + </pre> + <p>By default, the value is as before, which is <c>minimal</c>. </p> + </item> + + <marker id="prop_log_format"></marker> <tag>{log_format, common | combined}</tag> <item> <p>Defines if access logs should be written according to the common @@ -307,8 +366,9 @@ bytes <p>This affects the access logs written by mod_log and mod_disk_log. </p> - </item> - + </item> + + <marker id="prop_elog_format"></marker> <tag>{error_log_format, pretty | compact}</tag> <item> <p>Defaults to pretty. If the error log is meant to be read @@ -330,63 +390,77 @@ bytes </taglist> - <marker id="ssl_prop"></marker> + <marker id="props_ssl"></marker> <p><em>ssl properties</em></p> <taglist> + <marker id="prop_ssl_ca_cert_file"></marker> <tag>{ssl_ca_certificate_file, path()}</tag> <item> - Used as cacertfile option in ssl:listen/2 see - <seealso marker="ssl:ssl">ssl(3)</seealso> </item> + <p>Used as cacertfile option in ssl:listen/2 see + <seealso marker="ssl:ssl">ssl(3)</seealso>. </p> + </item> + <marker id="prop_ssl_cert_file"></marker> <tag>{ssl_certificate_file, path()}</tag> <item> - Used as certfile option in ssl:listen/2 see - <seealso marker="ssl:ssl">ssl(3)</seealso> + <p>Used as certfile option in ssl:listen/2 see + <seealso marker="ssl:ssl">ssl(3)</seealso>. </p> </item> + <marker id="prop_ssl_ciphers"></marker> <tag>{ssl_ciphers, list()}</tag> <item> - Used as ciphers option in ssl:listen/2 see - <seealso marker="ssl:ssl">ssl(3)</seealso> + <p>Used as ciphers option in ssl:listen/2 see + <seealso marker="ssl:ssl">ssl(3)</seealso>. </p> </item> + <marker id="prop_ssl_verify_client"></marker> <tag>{ssl_verify_client, integer()}</tag> <item> - Used as verify option in ssl:listen/2 see - <seealso marker="ssl:ssl">ssl(3)</seealso> </item> + <p>Used as verify option in ssl:listen/2 see + <seealso marker="ssl:ssl">ssl(3)</seealso>. </p> + </item> + <marker id="prop_ssl_verify_depth"></marker> <tag>{ssl_verify_depth, integer()}</tag> <item> - Used as depth option in ssl:listen/2 see - <seealso marker="ssl:ssl">ssl(3)</seealso> </item> + <p>Used as depth option in ssl:listen/2 see + <seealso marker="ssl:ssl">ssl(3)</seealso>. </p> + </item> + <marker id="prop_ssl_passwd_callback_funct"></marker> <tag>{ssl_password_callback_function, atom()}</tag> <item> - Used together with ssl_password_callback_module + <p>Used together with ssl_password_callback_module to retrieve a value to use as password option to ssl:listen/2 - see <seealso marker="ssl:ssl">ssl(3)</seealso> + see <seealso marker="ssl:ssl">ssl(3)</seealso>. </p> </item> + <marker id="prop_ssl_passwd_callback_args"></marker> <tag>{ssl_password_callback_arguments, list()}</tag> <item> - Used together with ssl_password_callback_function to supply a + <p>Used together with ssl_password_callback_function to supply a list of arguments to the callback function. If not specified - the callback function will be assumed to have arity 0. </item> + the callback function will be assumed to have arity 0. </p> + </item> + <marker id="prop_ssl_passwd_callback_mod"></marker> <tag>{ssl_password_callback_module, atom()}</tag> <item> - Used together with ssl_password_callback_function + <p>Used together with ssl_password_callback_function to retrieve a value to use as password option to ssl:listen/2 - see <seealso marker="ssl:ssl">ssl(3)</seealso></item> + see <seealso marker="ssl:ssl">ssl(3)</seealso>. </p> + </item> </taglist> - <marker id="alias_prop"></marker> + <marker id="props_alias"></marker> <p><em>URL aliasing properties - requires mod_alias</em></p> <taglist> + <marker id="prop_alias"></marker> <tag>{alias, {Alias, RealName}}</tag> - - <item> Where Alias = string() and RealName = string(). + <item> + <p>Where Alias = string() and RealName = string(). The Alias property allows documents to be stored in the local file system instead of the document_root location. URLs with a path that begins with url-path is mapped to local files that begins with @@ -395,11 +469,13 @@ bytes <code>{alias, {"/image", "/ftp/pub/image"}</code> and an access to http://your.server.org/image/foo.gif would refer to - the file /ftp/pub/image/foo.gif.</item> + the file /ftp/pub/image/foo.gif. </p> + </item> - <tag>{re_write, {Re, Replacement}}</tag> - - <item> Where Re = string() and Replacement = string(). + <marker id="prop_re_write"></marker> + <tag>{re_write, {Re, Replacement}}</tag> + <item> + <p>Where Re = string() and Replacement = string(). The ReWrite property allows documents to be stored in the local file system instead of the document_root location. URLs are rewritten by re:replace/3 to produce a path in the local filesystem. @@ -419,13 +495,13 @@ bytes Beware of trailing space in Replacement that will be used. If you must have a space in Re use e.g the character encoding - <code>\040</code> see <seealso marker="stdlib:re">re(3)</seealso>. + <code>\040</code> see <seealso marker="stdlib:re">re(3)</seealso>. </p> </item> - <tag>{directory_index, [string()]}</tag> - + <marker id="prop_dir_idx"></marker> + <tag>{directory_index, [string()]}</tag> <item> - DirectoryIndex specifies a list of resources to look for + <p>DirectoryIndex specifies a list of resources to look for if a client requests a directory using a / at the end of the directory name. file depicts the name of a file in the directory. Several files may be given, in which case the server @@ -436,70 +512,79 @@ bytes and access to http://your.server.org/docs/ would return http://your.server.org/docs/index.html or http://your.server.org/docs/welcome.html if index.html do not - exist. + exist. </p> </item> </taglist> - <marker id="cgi_prop"></marker> + <marker id="props_cgi"></marker> <p><em>CGI properties - requires mod_cgi</em></p> <taglist> + <marker id="prop_script_alias"></marker> <tag>{script_alias, {Alias, RealName}}</tag> - <item> Where Alias = string() and RealName = string(). + <item> + <p>Where Alias = string() and RealName = string(). Has the same behavior as the Alias property, except that it also marks the target directory as containing CGI scripts. URLs with a path beginning with url-path are mapped to scripts beginning with directory-filename, for example: - <code> {script_alias, {"/cgi-bin/", "/web/cgi-bin/"}</code> + <code>{script_alias, {"/cgi-bin/", "/web/cgi-bin/"}</code> and an access to http://your.server.org/cgi-bin/foo would cause - the server to run the script /web/cgi-bin/foo. + the server to run the script /web/cgi-bin/foo. </p> </item> + <marker id="prop_script_re_write"></marker> <tag>{script_re_write, {Re, Replacement}}</tag> - <item> Where Re = string() and Replacement = string(). + <item> + <p>Where Re = string() and Replacement = string(). Has the same behavior as the ReWrite property, except that it also marks the target directory as containing CGI scripts. URLs with a path beginning with url-path are mapped to scripts beginning with directory-filename, for example: - <code> {script_re_write, {"^/cgi-bin/(\\d+)/", "/web/\\1/cgi-bin/"}</code> + <code>{script_re_write, {"^/cgi-bin/(\\d+)/", "/web/\\1/cgi-bin/"}</code> and an access to http://your.server.org/cgi-bin/17/foo would cause - the server to run the script /web/17/cgi-bin/foo. + the server to run the script /web/17/cgi-bin/foo. </p> </item> + <marker id="prop_script_nocache"></marker> <tag>{script_nocache, boolean()}</tag> - <item> - If ScriptNoCache is set to true the HTTP server will by + <p>If ScriptNoCache is set to true the HTTP server will by default add the header fields necessary to prevent proxies from caching the page. Generally this is something you want. Defaults - to false.</item> + to false. </p> + </item> + <marker id="prop_script_timeout"></marker> <tag>{script_timeout, integer()}</tag> - <item> - The time in seconds the web server will wait between each + <p>The time in seconds the web server will wait between each chunk of data from the script. If the CGI-script not delivers any data before the timeout the connection to the client will be - closed. Defaults to 15. </item> + closed. Defaults to 15. </p> + </item> + <marker id="prop_action"></marker> <tag>{action, {MimeType, CgiScript}} - requires mod_action</tag> - - <item>Where MimeType = string() and CgiScript = string(). + <item> + <p>Where MimeType = string() and CgiScript = string(). Action adds an action, which will activate a cgi-script whenever a file of a certain mime-type is requested. It propagates the URL and file path of the requested document using the standard CGI PATH_INFO and PATH_TRANSLATED environment variables. - <code> {action, {"text/plain", "/cgi-bin/log_and_deliver_text"} - </code> + + <code>{action, {"text/plain", "/cgi-bin/log_and_deliver_text"}</code> + </p> </item> + <marker id="prop_script"></marker> <tag>{script, {Method, CgiScript}} - requires mod_action</tag> - - <item>Where Method = string() and CgiScript = string(). + <item> + <p>Where Method = string() and CgiScript = string(). Script adds an action, which will activate a cgi-script whenever a file is requested using a certain HTTP method. The method is either GET or POST as defined in RFC 1945. It @@ -507,18 +592,19 @@ bytes the standard CGI PATH_INFO and PATH_TRANSLATED environment variables. - <code> {script, {"PUT", "/cgi-bin/put"} - </code> + <code>{script, {"PUT", "/cgi-bin/put"}</code> + </p> </item> </taglist> - <marker id="esi_prop"></marker> + <marker id="props_esi"></marker> <p><em>ESI properties - requires mod_esi</em></p> <taglist> - <tag>{erl_script_alias, {URLPath, [AllowedModule]}}</tag> - - <item>Where URLPath = string() and AllowedModule = atom(). + <marker id="prop_esi_alias"></marker> + <tag>{erl_script_alias, {URLPath, [AllowedModule]}}</tag> + <item> + <p>Where URLPath = string() and AllowedModule = atom(). erl_script_alias marks all URLs matching url-path as erl scheme scripts. A matching URL is mapped into a specific module and function. For example: @@ -531,140 +617,151 @@ bytes would refer to httpd_example:yahoo/3 or, if that did not exist, httpd_example:yahoo/2 and http://your.server.org/cgi-bin/example/other:yahoo would - not be allowed to execute. + not be allowed to execute. </p> </item> + <marker id="prop_esi_nocache"></marker> <tag>{erl_script_nocache, boolean()}</tag> - <item> - If erl_script_nocache is set to true the server will add + <p>If erl_script_nocache is set to true the server will add http header fields that prevents proxies from caching the page. This is generally a good idea for dynamic content, since - the content often vary between each request. Defaults to false. + the content often vary between each request. + Defaults to false. </p> </item> + <marker id="prop_esi_timeout"></marker> <tag>{erl_script_timeout, integer()}</tag> - <item> - If erl_script_timeout sets the time in seconds the server will + <p>If erl_script_timeout sets the time in seconds the server will wait between each chunk of data to be delivered through mod_esi:deliver/2. Defaults to 15. This is only relevant - for scripts that uses the erl scheme. + for scripts that uses the erl scheme. </p> </item> + <marker id="prop_esi_timeout"></marker> <tag>{eval_script_alias, {URLPath, [AllowedModule]}}</tag> - - <item>Where URLPath = string() and AllowedModule = atom(). + <item> + <p>Where URLPath = string() and AllowedModule = atom(). Same as erl_script_alias but for scripts - using the eval scheme. Note that this is only supported - for backwards compatibility. The eval scheme is deprecated.</item> + using the eval scheme. Note that this is only supported + for backwards compatibility. The eval scheme is deprecated. </p> + </item> </taglist> - <marker id="log_prop"></marker> + <marker id="props_log"></marker> <p><em>Log properties - requires mod_log</em></p> <taglist> + <marker id="prop_elog"></marker> <tag>{error_log, path()}</tag> - <item> - Defines the filename of the error log file to be used to log + <p>Defines the filename of the error log file to be used to log server errors. If the filename does not begin with a slash (/) - it is assumed to be relative to the server_root</item> + it is assumed to be relative to the server_root. </p> + </item> + <marker id="prop_slog"></marker> <tag>{security_log, path()}</tag> - <item> - Defines the filename of the access log file to be used to - log security events. If the filename does not begin with a slash - (/) it is assumed to be relative to the server_root. + <p>Defines the filename of the access log file to be used to + log security events. If the filename does not begin with a slash + (/) it is assumed to be relative to the server_root. </p> </item> + <marker id="prop_tlog"></marker> <tag>{transfer_log, path()}</tag> - <item> - Defines the filename of the access log file to be used to + <p>Defines the filename of the access log file to be used to log incoming requests. If the filename does not begin with a - slash (/) it is assumed to be relative to the server_root. + slash (/) it is assumed to be relative to the server_root. </p> </item> </taglist> - <marker id="dlog_prop"></marker> + <marker id="props_dlog"></marker> <p><em>Disk Log properties - requires mod_disk_log</em></p> <taglist> + <marker id="prop_dlog_format"></marker> <tag>{disk_log_format, internal | external}</tag> - <item> - Defines the file-format of the log files see disk_log for + <p>Defines the file-format of the log files see disk_log for more information. If the internal file-format is used, the logfile will be repaired after a crash. When a log file is repaired data might get lost. When the external file-format is used httpd will not start if the log file is broken. Defaults to - external. + external. </p> </item> + <marker id="prop_edlog"></marker> <tag>{error_disk_log, internal | external}</tag> - <item> - Defines the filename of the (disk_log(3)) error log file + <p>Defines the filename of the (disk_log(3)) error log file to be used to log server errors. If the filename does not begin - with a slash (/) it is assumed to be relative to the server_root. + with a slash (/) it is assumed to be relative to the server_root. </p> </item> + <marker id="prop_edlog_size"></marker> <tag>{error_disk_log_size, {MaxBytes, MaxFiles}}</tag> - - <item>Where MaxBytes = integer() and MaxFiles = integer(). + <item> + <p>Where MaxBytes = integer() and MaxFiles = integer(). Defines the properties of the (disk_log(3)) error log file. The disk_log(3) error log file is of type wrap log and max-bytes will be written to each file and max-files will be - used before the first file is truncated and reused. </item> + used before the first file is truncated and reused. </p> + </item> + <marker id="prop_sdlog"></marker> <tag>{security_disk_log, path()}</tag> - <item> - Defines the filename of the (disk_log(3)) access log file + <p>Defines the filename of the (disk_log(3)) access log file which logs incoming security events i.e authenticated requests. If the filename does not begin with a slash (/) it - is assumed to be relative to the server_root. + is assumed to be relative to the server_root. </p> </item> + <marker id="prop_sdlog_size"></marker> <tag>{security_disk_log_size, {MaxBytes, MaxFiles}}</tag> - - <item>Where MaxBytes = integer() and MaxFiles = integer(). + <item> + <p>Where MaxBytes = integer() and MaxFiles = integer(). Defines the properties of the disk_log(3) access log file. The disk_log(3) access log file is of type wrap log and max-bytes will be written to each file and max-files will be - used before the first file is truncated and reused.</item> + used before the first file is truncated and reused. </p> + </item> - <tag>{transfer_disk_log, path()}</tag> - + <marker id="prop_tdlog"></marker> + <tag>{transfer_disk_log, path()}</tag> <item> - Defines the filename of the (disk_log(3)) access log file + <p>Defines the filename of the (disk_log(3)) access log file which logs incoming requests. If the filename does not begin with a slash (/) it is assumed to be relative to the - server_root. + server_root. </p> </item> + <marker id="prop_tdlog_size"></marker> <tag>{transfer_disk_log_size, {MaxBytes, MaxFiles}}</tag> - - <item>Where MaxBytes = integer() and MaxFiles = integer(). + <item> + <p>Where MaxBytes = integer() and MaxFiles = integer(). Defines the properties of the disk_log(3) access log file. The disk_log(3) access log file is of type wrap log and max-bytes will be written to each file and max-files will be - used before the first file is truncated and reused.</item> + used before the first file is truncated and reused. </p> + </item> </taglist> - <marker id="auth_prop"></marker> + <marker id="props_auth"></marker> <p><em>Authentication properties - requires mod_auth</em></p> + <marker id="prop_dri"></marker> <p><em>{directory, {path(), [{property(), term()}]}}</em></p> - <marker id="dir_prop"></marker> + <marker id="props_dir"></marker> <p>Here follows the valid properties for directories </p> <taglist> + <marker id="prop_allow_from"></marker> <tag>{allow_from, all | [RegxpHostString]}</tag> - <item> - Defines a set of hosts which should be granted access to a + <p>Defines a set of hosts which should be granted access to a given directory. For example: @@ -672,34 +769,36 @@ bytes <code>{allow_from, ["123.34.56.11", "150.100.23"] </code> The host 123.34.56.11 and all machines on the 150.100.23 - subnet are allowed access.</item> + subnet are allowed access. </p> + </item> + <marker id="prop_deny_from"></marker> <tag>{deny_from, all | [RegxpHostString]}</tag> - <item> - Defines a set of hosts + <p>Defines a set of hosts which should be denied access to a given directory. For example: <code>{deny_from, ["123.34.56.11", "150.100.23"] </code> The host 123.34.56.11 and all machines on the 150.100.23 - subnet are not allowed access.</item> + subnet are not allowed access. </p> + </item> + <marker id="prop_auth_type"></marker> <tag>{auth_type, plain | dets | mnesia}</tag> - <item> - Sets the type of authentication database that is used for the + <p>Sets the type of authentication database that is used for the directory.The key difference between the different methods is that dynamic data can be saved when Mnesia and Dets is used. This property is called AuthDbType in the Apache like - configuration files. + configuration files. </p> </item> + <marker id="prop_auth_user_file"></marker> <tag>{auth_user_file, path()}</tag> - <item> - Sets the name of a file which contains the list of users and + <p>Sets the name of a file which contains the list of users and passwords for user authentication. filename can be either absolute or relative to the <c>server_root</c>. If using the plain storage method, this file is a plain text file, where @@ -717,12 +816,13 @@ bytes storage method. For security reasons, make sure that the <c>auth_user_file</c> is stored outside the document tree of the Web server. If it is placed in the directory which it protects, - clients will be able to download it. + clients will be able to download it. </p> </item> + <marker id="prop_auth_group_file"></marker> <tag>{auth_group_file, path()}</tag> - - <item> Sets the name of a file which contains the list of user + <item> + <p>Sets the name of a file which contains the list of user groups for user authentication. Filename can be either absolute or relative to the <c>server_root</c>. If you use the plain storage method, the group file is a plain text file, where @@ -738,93 +838,109 @@ bytes For security reasons, make sure that the <c>auth_group_file</c> is stored outside the document tree of the Web server. If it is placed in the directory which it protects, clients will be - able to download it.</item> + able to download it. </p> + </item> + <marker id="prop_auth_name"></marker> <tag>{auth_name, string()}</tag> - <item> - Sets the name of the authorization realm (auth-domain) for + <p>Sets the name of the authorization realm (auth-domain) for a directory. This string informs the client about which user - name and password to use. </item> + name and password to use. </p> + </item> + <marker id="prop_auth_access_passwd"></marker> <tag>{auth_access_password, string()}</tag> - - <item> If set to other than "NoPassword" the password is required + <item> + <p>If set to other than "NoPassword" the password is required for all API calls. If the password is set to "DummyPassword" the password must be changed before any other API calls. To secure the authenticating data the password must be changed after the web server is started since it otherwise is written in clear - text in the configuration file.</item> + text in the configuration file. </p> + </item> + <marker id="prop_req_user"></marker> <tag>{require_user, [string()]}</tag> <item> - Defines users which should be granted access to a given - directory using a secret password. + <p>Defines users which should be granted access to a given + directory using a secret password. </p> </item> + <marker id="prop_req_grp"></marker> <tag>{require_group, [string()]}</tag> <item> - Defines users which should be granted access to a given - directory using a secret password. + <p>Defines users which should be granted access to a given + directory using a secret password. </p> </item> </taglist> - <marker id="htaccess_prop"></marker> + <marker id="props_htaccess"></marker> <p><em>Htaccess authentication properties - requires mod_htaccess</em></p> <taglist> + <marker id="prop_access_files"></marker> <tag>{access_files, [path()]}</tag> - - <item> Specify which filenames that are used for + <item> + <p>Specify which filenames that are used for access-files. When a request comes every directory in the path to the requested asset will be searched after files with the names specified by this parameter. If such a file is found the file will be parsed and the restrictions specified in it will - be applied to the request. + be applied to the request. </p> </item> </taglist> - <marker id="sec_prop"></marker> + <marker id="props_sec"></marker> <p><em>Security properties - requires mod_security </em></p> + <marker id="prop_sec_dir"></marker> <p><em>{security_directory, {path(), [{property(), term()}]}</em></p> - <marker id="sdir_prop"></marker> - <p> Here follows the valid properties for security directories</p> + <marker id="props_sdir"></marker> + <p>Here follows the valid properties for security directories</p> <taglist> - <tag>{data_file, path()}</tag> - + <marker id="prop_data_file"></marker> + <tag>{data_file, path()}</tag> <item> - Name of the security data file. The filename can either + <p>Name of the security data file. The filename can either absolute or relative to the server_root. This file is used to - store persistent data for the mod_security module. </item> - - <tag>{max_retries, integer()}</tag> + store persistent data for the mod_security module. </p> + </item> - <item> Specifies the maximum number of tries to authenticate a + <marker id="prop_max_retries"></marker> + <tag>{max_retries, integer()}</tag> + <item> + <p>Specifies the maximum number of tries to authenticate a user has before the user is blocked out. If a user successfully authenticates when the user has been blocked, the user will receive a 403 (Forbidden) response from the server. If the user makes a failed attempt while blocked the server will return 401 (Unauthorized), for security - reasons. Defaults to 3 may also be set to infinity.</item> + reasons. + Defaults to 3 may also be set to infinity. </p> + </item> + <marker id="prop_block_time"></marker> <tag>{block_time, integer()}</tag> - - <item> Specifies the number of minutes a user is blocked. After + <item> + <p>Specifies the number of minutes a user is blocked. After this amount of time, he automatically regains access. - Defaults to 60</item> + Defaults to 60. </p> + </item> + <marker id="prop_fail_exp_time"></marker> <tag>{fail_expire_time, integer()}</tag> - <item> - Specifies the number of minutes a failed user authentication + <p>Specifies the number of minutes a failed user authentication is remembered. If a user authenticates after this amount of time, his previous failed authentications are - forgotten. Defaults to 30</item> + forgotten. + Defaults to 30. </p> + </item> + <marker id="prop_auth_timeout"></marker> <tag>{auth_timeout, integer()}</tag> - <item> Specifies the number of seconds a successful user authentication is remembered. After this time has passed, the @@ -835,6 +951,7 @@ bytes <funcs> <func> + <marker id="info1"></marker> <name>info(Pid) -></name> <name>info(Pid, Properties) -> [{Option, Value}]</name> <fsummary>Fetches information about the HTTP server</fsummary> @@ -858,6 +975,7 @@ bytes </func> <func> + <marker id="info2"></marker> <name>info(Address, Port) -> </name> <name>info(Address, Port, Properties) -> [{Option, Value}] </name> <fsummary>Fetches information about the HTTP server</fsummary> @@ -883,6 +1001,7 @@ bytes </func> <func> + <marker id="reload_config"></marker> <name>reload_config(Config, Mode) -> ok | {error, Reason}</name> <fsummary>Reloads the HTTP server configuration without restarting the server.</fsummary> @@ -1003,6 +1122,7 @@ bytes </section> <funcs> <func> + <marker id="module_do"></marker> <name>Module:do(ModData)-> {proceed, OldData} | {proceed, NewData} | {break, NewData} | done</name> <fsummary>Called for each request to the Web server.</fsummary> <type> @@ -1046,7 +1166,9 @@ bytes closing the connection.</p> </desc> </func> + <func> + <marker id="module_load"></marker> <name>Module:load(Line, AccIn)-> eof | ok | {ok, AccOut} | {ok, AccOut, {Option, Value}} | {ok, AccOut, [{Option, Value}]} | {error, Reason} </name> <fsummary>Load is used to convert a line in a Apache like config file to a <c>{Option, Value}</c> tuple.</fsummary> @@ -1068,7 +1190,9 @@ bytes </p> </desc> </func> + <func> + <marker id="module_store"></marker> <name>Module:store({Option, Value}, Config)-> {ok, {Option, NewValue}} | {error, Reason} </name> <fsummary></fsummary> <type> @@ -1092,6 +1216,7 @@ bytes </func> <func> + <marker id="module_remove"></marker> <name>Module:remove(ConfigDB) -> ok | {error, Reason} </name> <fsummary>Callback function that is called when the Web server is closed.</fsummary> <type> @@ -1112,6 +1237,7 @@ bytes </section> <funcs> <func> + <marker id="parse_query"></marker> <name>parse_query(QueryString) -> [{Key,Value}]</name> <fsummary>Parse incoming data to <c>erl </c>and <c>eval </c>scripts.</fsummary> <type> @@ -1120,7 +1246,6 @@ bytes <v>Value = string()</v> </type> <desc> - <marker id="parse_query"></marker> <p><c>parse_query/1</c> parses incoming data to <c>erl</c> and <c>eval</c> scripts (See <seealso marker="mod_esi">mod_esi(3)</seealso>) as defined in the standard URL format, that is '+' becomes 'space' and decoding of diff --git a/lib/inets/doc/src/httpd_conf.xml b/lib/inets/doc/src/httpd_conf.xml index a1ad76a8ae..fc34f14ec3 100644 --- a/lib/inets/doc/src/httpd_conf.xml +++ b/lib/inets/doc/src/httpd_conf.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="iso-8859-1" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> <header> <copyright> - <year>1997</year><year>2009</year> + <year>1997</year><year>2012</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -33,11 +33,14 @@ Web server API programmer.</modulesummary> <description> <p>This module provides the Erlang Webserver API programmer with - utility functions for adding run-time configuration directives.</p> + utility functions for adding run-time configuration directives.</p> + + <marker id="check_enum"></marker> </description> + <funcs> <func> - <name>check_enum(EnumString,ValidEnumStrings) -> Result</name> + <name>check_enum(EnumString, ValidEnumStrings) -> Result</name> <fsummary>Check if string is a valid enumeration.</fsummary> <type> <v>EnumString = string()</v> @@ -47,10 +50,13 @@ <desc> <marker id="check_enum"></marker> <p><c>check_enum/2</c> checks if <c>EnumString</c> is a valid - enumeration of <c>ValidEnumStrings</c> in which case it is - returned as an atom.</p> + enumeration of <c>ValidEnumStrings</c> in which case it is + returned as an atom.</p> + + <marker id="clean"></marker> </desc> </func> + <func> <name>clean(String) -> Stripped</name> <fsummary>Remove leading and/or trailing white spaces.</fsummary> @@ -60,9 +66,12 @@ <desc> <marker id="clean"></marker> <p><c>clean/1</c> removes leading and/or trailing white spaces - from <c>String</c>.</p> + from <c>String</c>.</p> + + <marker id="custom_clean"></marker> </desc> </func> + <func> <name>custom_clean(String,Before,After) -> Stripped</name> <fsummary>Remove leading and/or trailing white spaces and custom characters.</fsummary> @@ -73,11 +82,14 @@ <desc> <marker id="custom_clean"></marker> <p><c>custom_clean/3</c> removes leading and/or trailing white - spaces and custom characters from <c>String</c>. <c>Before</c> - and <c>After</c> are regular expressions, as defined in - <c>regexp(3)</c>, describing the custom characters.</p> + spaces and custom characters from <c>String</c>. <c>Before</c> + and <c>After</c> are regular expressions, as defined in + <c>regexp(3)</c>, describing the custom characters.</p> + + <marker id="is_directory"></marker> </desc> </func> + <func> <name>is_directory(FilePath) -> Result</name> <fsummary>Check if a file path is a directory.</fsummary> @@ -91,13 +103,16 @@ <desc> <marker id="is_directory"></marker> <p><c>is_directory/1</c> checks if <c>FilePath</c> is a - directory in which case it is returned. Please read - <c>file(3)</c> for a description of <c>enoent</c>, - <c>eaccess</c> and <c>enotdir</c>. The definition of - the file info record can be found by including <c>file.hrl</c> - from the kernel application, see file(3).</p> + directory in which case it is returned. Please read + <c>file(3)</c> for a description of <c>enoent</c>, + <c>eaccess</c> and <c>enotdir</c>. The definition of + the file info record can be found by including <c>file.hrl</c> + from the kernel application, see file(3).</p> + + <marker id="is_file"></marker> </desc> </func> + <func> <name>is_file(FilePath) -> Result</name> <fsummary>Check if a file path is a regular file.</fsummary> @@ -111,13 +126,16 @@ <desc> <marker id="is_file"></marker> <p><c>is_file/1</c> checks if <c>FilePath</c> is a regular - file in which case it is returned. Read <c>file(3)</c> for a - description of <c>enoent</c>, <c>eaccess</c> and - <c>enotdir</c>. The definition of the file info record can be - found by including <c>file.hrl</c> from the kernel application, - see file(3).</p> + file in which case it is returned. Read <c>file(3)</c> for a + description of <c>enoent</c>, <c>eaccess</c> and + <c>enotdir</c>. The definition of the file info record can be + found by including <c>file.hrl</c> from the kernel application, + see file(3).</p> + + <marker id="make_integer"></marker> </desc> </func> + <func> <name>make_integer(String) -> Result</name> <fsummary>Return an integer representation of a string.</fsummary> diff --git a/lib/inets/doc/src/httpd_socket.xml b/lib/inets/doc/src/httpd_socket.xml index fba1a58d3a..58cd2ec575 100644 --- a/lib/inets/doc/src/httpd_socket.xml +++ b/lib/inets/doc/src/httpd_socket.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="iso-8859-1" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> <header> <copyright> - <year>1997</year><year>2009</year> + <year>1997</year><year>2012</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -33,10 +33,13 @@ Web server API programmer.</modulesummary> <description> <p>This module provides the Erlang Web server API module programmer - with utility functions for generic sockets communication. The - appropriate communication mechanism is transparently used, that - is <c>ip_comm</c> or <c>ssl</c>.</p> + with utility functions for generic sockets communication. The + appropriate communication mechanism is transparently used, that + is <c>ip_comm</c> or <c>ssl</c>.</p> + + <marker id="deliver"></marker> </description> + <funcs> <func> <name>deliver(SocketType, Socket, Data) -> Result</name> @@ -50,11 +53,14 @@ <desc> <marker id="deliver"></marker> <p><c>deliver/3</c> sends the <c>Binary</c> over the - <c>Socket</c> using the specified <c>SocketType</c>. Socket - and SocketType should be the socket and the socket_type form - the mod record as defined in httpd.hrl</p> + <c>Socket</c> using the specified <c>SocketType</c>. Socket + and SocketType should be the socket and the socket_type form + the mod record as defined in httpd.hrl</p> + + <marker id="peername"></marker> </desc> </func> + <func> <name>peername(SocketType,Socket) -> {Port,IPAddress}</name> <fsummary>Return the port and IP-address of the remote socket.</fsummary> @@ -67,9 +73,12 @@ <desc> <marker id="peername"></marker> <p><c>peername/3</c> returns the <c>Port</c> and - <c>IPAddress</c> of the remote <c>Socket</c>. </p> + <c>IPAddress</c> of the remote <c>Socket</c>. </p> + + <marker id="resolve"></marker> </desc> </func> + <func> <name>resolve() -> HostName</name> <fsummary>Return the official name of the current host.</fsummary> @@ -79,7 +88,7 @@ <desc> <marker id="resolve"></marker> <p><c>resolve/0</c> returns the official <c>HostName</c> of - the current host. </p> + the current host. </p> </desc> </func> </funcs> diff --git a/lib/inets/doc/src/httpd_util.xml b/lib/inets/doc/src/httpd_util.xml index 6ac2b13c72..9f290084d2 100644 --- a/lib/inets/doc/src/httpd_util.xml +++ b/lib/inets/doc/src/httpd_util.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="iso-8859-1" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> <header> <copyright> - <year>1997</year><year>2010</year> + <year>1997</year><year>2012</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> diff --git a/lib/inets/doc/src/inets_services.xml b/lib/inets/doc/src/inets_services.xml index c274d67f19..e282050b12 100644 --- a/lib/inets/doc/src/inets_services.xml +++ b/lib/inets/doc/src/inets_services.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="iso-8859-1" ?> <!DOCTYPE chapter SYSTEM "chapter.dtd"> <chapter> <header> <copyright> - <year>1997</year><year>2009</year> + <year>1997</year><year>2012</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> diff --git a/lib/inets/doc/src/mod_alias.xml b/lib/inets/doc/src/mod_alias.xml index c783b99b23..265a1b8e76 100644 --- a/lib/inets/doc/src/mod_alias.xml +++ b/lib/inets/doc/src/mod_alias.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="iso-8859-1" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> <header> <copyright> - <year>1997</year><year>2009</year> + <year>1997</year><year>2012</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -32,8 +32,11 @@ <modulesummary>URL aliasing.</modulesummary> <description> <p>Erlang Webserver Server internal API for handling of things - such as interaction data exported by the mod_alias module.</p> + such as interaction data exported by the mod_alias module.</p> + + <marker id="default_index"></marker> </description> + <funcs> <func> <name>default_index(ConfigDB, Path) -> NewPath</name> @@ -45,17 +48,20 @@ <desc> <marker id="default_index"></marker> <p>If <c>Path</c> is a directory, <c>default_index/2</c>, it starts - searching for resources or files that are specified in the config - directive DirectoryIndex. - If an appropriate resource or file is found, it is appended to - the end of <c>Path</c> and then returned. <c>Path</c> is - returned unaltered, if no appropriate - file is found, or if <c>Path</c> is not a directory. - <c>config_db()</c> is the server config file in ETS table format - as described in - <seealso marker="http_server">Inets Users Guide.</seealso>.</p> + searching for resources or files that are specified in the config + directive DirectoryIndex. + If an appropriate resource or file is found, it is appended to + the end of <c>Path</c> and then returned. <c>Path</c> is + returned unaltered, if no appropriate + file is found, or if <c>Path</c> is not a directory. + <c>config_db()</c> is the server config file in ETS table format + as described in + <seealso marker="http_server">Inets Users Guide.</seealso>.</p> + + <marker id="path"></marker> </desc> </func> + <func> <name>path(PathData, ConfigDB, RequestURI) -> Path</name> <fsummary>Return the actual file path to a URL.</fsummary> @@ -67,15 +73,19 @@ <desc> <marker id="path"></marker> <p><c>path/3</c> returns the actual file <c>Path</c> in the - <c>RequestURI</c> (See RFC 1945). If the interaction data - <c>{real_name,{Path,AfterPath}}</c> has been exported by - mod_alias; - <c>Path</c> is returned. If no interaction data has been - exported, ServerRoot is used to - generate a file <c>Path</c>. <c>config_db()</c> and - <c>interaction_data()</c> are as defined in <seealso marker="http_server">Inets Users Guide</seealso>.</p> + <c>RequestURI</c> (See RFC 1945). If the interaction data + <c>{real_name,{Path,AfterPath}}</c> has been exported by + mod_alias; + <c>Path</c> is returned. If no interaction data has been + exported, ServerRoot is used to + generate a file <c>Path</c>. <c>config_db()</c> and + <c>interaction_data()</c> are as defined in + <seealso marker="http_server">Inets Users Guide</seealso>.</p> + + <marker id="real_name"></marker> </desc> </func> + <func> <name>real_name(ConfigDB, RequestURI, Aliases) -> Ret</name> <fsummary>Expand a request uri using Alias config directives.</fsummary> @@ -89,18 +99,24 @@ <desc> <marker id="real_name"></marker> <p><c>real_name/3</c> traverses <c>Aliases</c>, typically - extracted from <c>ConfigDB</c>, and matches each - <c>FakeName</c> with <c>RequestURI</c>. If a match is found - <c>FakeName</c> is replaced with <c>RealName</c> in the - match. The resulting path is split into two parts, that - is <c>ShortPath</c> and <c>AfterPath</c> as defined in <seealso marker="httpd_util#split_path">httpd_util:split_path/1</seealso>. - <c>Path</c> is generated from <c>ShortPath</c>, that is - the result from <seealso marker="#default_index">default_index/2</seealso> with - <c>ShortPath</c> as an argument. - <c>config_db()</c> is the server config file in ETS table - format as described in <seealso marker="http_server">Inets User Guide.</seealso>. </p> + extracted from <c>ConfigDB</c>, and matches each + <c>FakeName</c> with <c>RequestURI</c>. If a match is found + <c>FakeName</c> is replaced with <c>RealName</c> in the + match. The resulting path is split into two parts, that + is <c>ShortPath</c> and <c>AfterPath</c> as defined in + <seealso marker="httpd_util#split_path">httpd_util:split_path/1</seealso>. + <c>Path</c> is generated from <c>ShortPath</c>, that is + the result from + <seealso marker="#default_index">default_index/2</seealso> with + <c>ShortPath</c> as an argument. + <c>config_db()</c> is the server config file in ETS table + format as described in + <seealso marker="http_server">Inets User Guide.</seealso>. </p> + + <marker id="real_script_name"></marker> </desc> </func> + <func> <name>real_script_name(ConfigDB,RequestURI,ScriptAliases) -> Ret</name> <fsummary>Expand a request uri using ScriptAlias config directives.</fsummary> @@ -114,15 +130,15 @@ <desc> <marker id="real_script_name"></marker> <p><c>real_name/3</c> traverses <c>ScriptAliases</c>, - typically extracted from <c>ConfigDB</c>, and matches each - <c>FakeName</c> with <c>RequestURI</c>. If a match is found - <c>FakeName</c> is replaced with <c>RealName</c> in the - match. If the resulting match is not an executable script - <c>not_a_script</c> is returned. If it is a script the - resulting script path is in two parts, that is - <c>ShortPath</c> and <c>AfterPath</c> as defined in <seealso marker="httpd_util#split_script_path">httpd_util:split_script_path/1</seealso>. - <c>config_db()</c> is the server config file in ETS table - format as described in <seealso marker="http_server">Inets Users Guide.</seealso>.</p> + typically extracted from <c>ConfigDB</c>, and matches each + <c>FakeName</c> with <c>RequestURI</c>. If a match is found + <c>FakeName</c> is replaced with <c>RealName</c> in the + match. If the resulting match is not an executable script + <c>not_a_script</c> is returned. If it is a script the + resulting script path is in two parts, that is + <c>ShortPath</c> and <c>AfterPath</c> as defined in <seealso marker="httpd_util#split_script_path">httpd_util:split_script_path/1</seealso>. + <c>config_db()</c> is the server config file in ETS table + format as described in <seealso marker="http_server">Inets Users Guide.</seealso>.</p> </desc> </func> </funcs> diff --git a/lib/inets/doc/src/mod_auth.xml b/lib/inets/doc/src/mod_auth.xml index 2134ebeeae..7801567862 100644 --- a/lib/inets/doc/src/mod_auth.xml +++ b/lib/inets/doc/src/mod_auth.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="iso-8859-1" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> @@ -32,8 +32,11 @@ <modulesummary>User authentication using text files, dets or mnesia database.</modulesummary> <description> <p>This module provides for basic user authentication using - textual files, dets databases as well as mnesia databases. </p> + textual files, dets databases as well as mnesia databases. </p> + + <marker id="add_user"></marker> </description> + <funcs> <func> <name>add_user(UserName, Options) -> true| {error, Reason}</name> @@ -55,12 +58,17 @@ <desc> <marker id="user_api"></marker> <marker id="add_user"></marker> - <p><c>add_user/2, add_user/5</c> and <c>add_user/6</c> adds a user to the user - database. If the operation is successful, this function returns - <c>true</c>. If an error occurs, <c>{error,Reason}</c> is returned. When <c>add_user/2</c> - is called the Password, UserData Port and Dir options is mandatory.</p> + <p><c>add_user/2, add_user/5</c> and <c>add_user/6</c> adds a + user to the user + database. If the operation is successful, this function returns + <c>true</c>. If an error occurs, <c>{error,Reason}</c> is returned. + When <c>add_user/2</c> is called the Password, + UserData Port and Dir options is mandatory.</p> + + <marker id="delete_user"></marker> </desc> </func> + <func> <name>delete_user(UserName,Options) -> true | {error, Reason}</name> <name>delete_user(UserName, Port, Dir) -> true | {error, Reason}</name> @@ -79,13 +87,16 @@ <desc> <marker id="delete_user"></marker> <p><c>delete_user/2, delete_user/3</c> and <c>delete_user/4</c> - deletes a user - from the user database. If the operation is successful, this - function returns <c>true</c>. If an error occurs, - <c>{error,Reason}</c> is returned. When <c>delete_user/2</c> is - called the Port and Dir options are mandatory.</p> + deletes a user from the user database. + If the operation is successful, this function returns <c>true</c>. + If an error occurs, <c>{error,Reason}</c> is returned. + When <c>delete_user/2</c> is called the Port and Dir options + are mandatory.</p> + + <marker id="get_user"></marker> </desc> </func> + <func> <name>get_user(UserName,Options) -> {ok, #httpd_user} |{error, Reason}</name> <name>get_user(UserName, Port, Dir) -> {ok, #httpd_user} | {error, Reason}</name> @@ -104,12 +115,15 @@ <desc> <marker id="get_user"></marker> <p><c>get_user/2, get_user/3</c> and <c>get_user/4</c> returns a - <c>httpd_user</c> record containing the userdata for a - specific user. If the user cannot be found, <c>{error, Reason}</c> - is returned. When <c>get_user/2</c> is called the Port and Dir - options are mandatory.</p> + <c>httpd_user</c> record containing the userdata for a + specific user. If the user cannot be found, <c>{error, Reason}</c> + is returned. When <c>get_user/2</c> is called the Port and Dir + options are mandatory.</p> + + <marker id="list_users"></marker> </desc> </func> + <func> <name>list_users(Options) -> {ok, Users} | {error, Reason}</name> <name>list_users(Port, Dir) -> {ok, Users} | {error, Reason}</name> @@ -127,12 +141,16 @@ </type> <desc> <marker id="list_users"></marker> - <p><c>list_users/1, list_users/2</c> and <c>list_users/3</c> returns a list - of users in the user database for a specific <c>Port/Dir</c>. - When <c>list_users/1</c> is called the Port and Dir - options are mandatory.</p> + <p><c>list_users/1, list_users/2</c> and <c>list_users/3</c> + returns a list + of users in the user database for a specific <c>Port/Dir</c>. + When <c>list_users/1</c> is called the Port and Dir + options are mandatory.</p> + + <marker id="add_group_member"></marker> </desc> </func> + <func> <name>add_group_member(GroupName, UserName, Options) -> true | {error, Reason}</name> <name>add_group_member(GroupName, UserName, Port, Dir) -> true | {error, Reason}</name> @@ -151,13 +169,18 @@ </type> <desc> <marker id="add_group_member"></marker> - <p><c>add_group_member/3, add_group_member/4</c> and <c>add_group_member/5</c> - adds a user to a group. If the group does not exist, it - is created and the user is added to the group. Upon successful - operation, this function returns <c>true</c>. When <c>add_group_members/3</c> - is called the Port and Dir options are mandatory.</p> + <p><c>add_group_member/3, add_group_member/4</c> and + <c>add_group_member/5</c> + adds a user to a group. If the group does not exist, it + is created and the user is added to the group. Upon successful + operation, this function returns <c>true</c>. + When <c>add_group_members/3</c> + is called the Port and Dir options are mandatory.</p> + + <marker id="delete_group_member"></marker> </desc> </func> + <func> <name>delete_group_member(GroupName, UserName, Options) -> true | {error, Reason}</name> <name>delete_group_member(GroupName, UserName, Port, Dir) -> true | {error, Reason}</name> @@ -176,13 +199,17 @@ </type> <desc> <marker id="delete_group_member"></marker> - <p><c>delete_group_member/3, delete_group_member/4</c> and <c>delete_group_member/5</c> deletes a user from a group. - If the group or the user does not exist, - this function returns an error, otherwise it returns <c>true</c>. - When <c>delete_group_member/3</c> is called the Port and Dir options - are mandatory.</p> + <p><c>delete_group_member/3, delete_group_member/4</c> and + <c>delete_group_member/5</c> deletes a user from a group. + If the group or the user does not exist, + this function returns an error, otherwise it returns <c>true</c>. + When <c>delete_group_member/3</c> is called the Port and Dir options + are mandatory.</p> + + <marker id="list_group_members"></marker> </desc> </func> + <func> <name>list_group_members(GroupName, Options) -> {ok, Users} | {error, Reason}</name> <name>list_group_members(GroupName, Port, Dir) -> {ok, Users} | {error, Reason}</name> @@ -201,13 +228,17 @@ </type> <desc> <marker id="list_group_members"></marker> - <p><c>list_group_members/2, list_group_members/3</c> and <c>list_group_members/4</c> - lists the members of a specified group. If the group does not - exist or there is an error, <c>{error, Reason}</c> is returned. - When <c>list_group_members/2</c> is called the Port and Dir options - are mandatory.</p> + <p><c>list_group_members/2, list_group_members/3</c> and + <c>list_group_members/4</c> + lists the members of a specified group. If the group does not + exist or there is an error, <c>{error, Reason}</c> is returned. + When <c>list_group_members/2</c> is called the Port and Dir options + are mandatory.</p> + + <marker id="list_groups"></marker> </desc> </func> + <func> <name>list_groups(Options) -> {ok, Groups} | {error, Reason}</name> <name>list_groups(Port, Dir) -> {ok, Groups} | {error, Reason}</name> @@ -225,12 +256,16 @@ </type> <desc> <marker id="list_groups"></marker> - <p><c>list_groups/1, list_groups/2</c> and <c>list_groups/3</c> lists all - the groups available. If there is an error, <c>{error, Reason}</c> - is returned. When <c>list_groups/1</c> is called the Port and Dir options - are mandatory.</p> + <p><c>list_groups/1, list_groups/2</c> and <c>list_groups/3</c> + lists all the groups available. + If there is an error, <c>{error, Reason}</c> is returned. + When <c>list_groups/1</c> is called the Port and Dir options + are mandatory.</p> + + <marker id="delete_group"></marker> </desc> </func> + <func> <name>delete_group(GroupName, Options) -> true | {error,Reason} <name>delete_group(GroupName, Port, Dir) -> true | {error, Reason}</name> <name>delete_group(GroupName, Address, Port, Dir) -> true | {error, Reason}</name> @@ -247,12 +282,16 @@ </type> <desc> <marker id="delete_group"></marker> - <p><c>delete_group/2, delete_group/3</c> and <c>delete_group/4</c> deletes the - group specified and returns <c>true</c>. If there is an error, - <c>{error, Reason}</c> is returned. When <c>delete_group/2</c> is called the - Port and Dir options are mandatory.</p> + <p><c>delete_group/2, delete_group/3</c> and <c>delete_group/4</c> + deletes the group specified and returns <c>true</c>. + If there is an error, <c>{error, Reason}</c> is returned. + When <c>delete_group/2</c> is called the + Port and Dir options are mandatory.</p> + + <marker id="update_password"></marker> </desc> </func> + <func> <name>update_password(Port, Dir, OldPassword, NewPassword, NewPassword) -> ok | {error, Reason}</name> <name>update_password(Address,Port, Dir, OldPassword, NewPassword, NewPassword) -> ok | {error, Reason}</name> @@ -268,10 +307,12 @@ </type> <desc> <marker id="update_password"></marker> - <p><c>update_password/5</c> and <c>update_password/6</c> Updates the AuthAccessPassword - for the specified directory. If NewPassword is equal to "NoPassword" no password is requires to - change authorisation data. If NewPassword is equal to "DummyPassword" no changes can be done - without changing the password first.</p> + <p><c>update_password/5</c> and <c>update_password/6</c> + Updates the AuthAccessPassword for the specified directory. + If NewPassword is equal to "NoPassword" no password is requires to + change authorisation data. + If NewPassword is equal to "DummyPassword" no changes can be done + without changing the password first.</p> </desc> </func> </funcs> diff --git a/lib/inets/doc/src/notes.xml b/lib/inets/doc/src/notes.xml index cfc58b8ddb..dfdeb4016c 100644 --- a/lib/inets/doc/src/notes.xml +++ b/lib/inets/doc/src/notes.xml @@ -33,6 +33,96 @@ </header> + <section><title>Inets 5.9</title> + + <section><title>Improvements and New Features</title> +<!-- + <p>-</p> +--> + + <list> + <item> + <p>[httpd] Make the server header configurable with new config + option + <seealso marker="httpd#prop_server_tokens">server_tokens</seealso>. + The value of the server header, which was previously hard-coded + (at compile time), is now possible to manipulate through the means + of the + <seealso marker="httpd#prop_server_tokens">server_tokens</seealso> + config option. </p> + <p>Own Id: OTP-9805</p> + </item> + + <item> + <p>Improve inets support for inets as an included application. </p> + <p><c>inets_app</c> calls <c>supervisor:start_link/3</c> directly + rather than calling the root supervisor function + <c>inets_sup:start_link/0</c>. + This precludes using included_applications to start inets without + having a wrapper function. </p> + <p>Jay Nelson</p> + <p>Own Id: OTP-9960</p> + </item> + + <item> + <p>[httpc] Add function for retrieving current options, + <seealso marker="httpc#get_options">get_options/1,2</seealso>. </p> + <p>Own Id: OTP-9979</p> + </item> + + <item> + <p>Utility module + <seealso marker="http_uri">http_uri</seealso> + now officially supported. </p> + <p>Also, the + <seealso marker="http_uri#parse">parse</seealso> + function has been extended with more + scheme support and a way to provide your own scheme info. </p> + <p>Own Id: OTP-9983</p> + <p>Aux Id: Seq 12022</p> + </item> + + </list> + + </section> + + <section><title>Fixed Bugs and Malfunctions</title> + <p>-</p> + +<!-- + <list> + <item> + <p>[httpd] Fix logging of content length in mod_log. </p> + <p>Garrett Smith</p> + <p>Own Id: OTP-9715</p> + </item> + + </list> +--> + + </section> + + <section> + <title>Incompatibilities</title> + <p>-</p> + +<!-- + <list> + <item> + <p>[httpc|httpd] The old ssl implementation (based on OpenSSL), + has been deprecated. The config option that specified usage of + this version of the ssl app, <c>ossl</c>, has been removed. </p> + <p>Own Id: OTP-9522</p> + </item> + + </list> +--> + + </section> + + </section> <!-- 5.9 --> + + <section><title>Inets 5.8.1</title> <section><title>Improvements and New Features</title> <p>-</p> @@ -417,7 +507,7 @@ <p><c>ossl</c> will work for as long as the ssl application supports it. </p> <p>See the httpd - <seealso marker="httpd#comm_prop">socket_type</seealso> + <seealso marker="httpd#props_comm">socket_type</seealso> communication property or the httpc <seealso marker="httpc#request2">request/4,5</seealso> function for more info. </p> @@ -436,7 +526,7 @@ <list> <item> <p>[httpd] Wrong - <seealso marker="httpd#sec_prop">security property</seealso> + <seealso marker="httpd#props_sec">security property</seealso> names used in documentation. </p> <p><c>security_data_file</c> used instead of <c>data_file</c>. </p> <p><c>security_max_retries</c> used instead of <c>max_retries</c>. </p> @@ -620,7 +710,7 @@ the <c>essl</c> tag instead. </p> <p>See the <c>http_option</c> option in the <seealso marker="httpc#request2">request/4,5</seealso> or - the <seealso marker="httpd#comm_prop">socket-type</seealso> + the <seealso marker="httpd#props_comm">socket-type</seealso> section of the Communication properties chapter for more info, </p> <p>Own Id: OTP-7907</p> </item> @@ -637,9 +727,9 @@ <p>[httpd] - Improved mod_alias. Now able to do better URL rewrites. </p> <p>See - <seealso marker="httpd#alias_prop">URL aliasing properties</seealso> + <seealso marker="httpd#props_alias">URL aliasing properties</seealso> and the - <seealso marker="httpd#cgi_prop">CGI properties</seealso> + <seealso marker="httpd#props_cgi">CGI properties</seealso> section(s) for more info, </p> <p>Own Id: OTP-8573</p> </item> @@ -1225,7 +1315,7 @@ <p>Default is <c>inet6fb4</c> which emulates the behaviour of the previous version. </p> <p>See the - <seealso marker="httpd#comm_prop">Communication properties</seealso> + <seealso marker="httpd#props_comm">Communication properties</seealso> section for more info. </p> <p>Own Id: OTP-8069</p> <p>Aux Id: seq11086</p> diff --git a/lib/inets/doc/src/notes_history.xml b/lib/inets/doc/src/notes_history.xml index 151bec375e..bd59c1ba47 100644 --- a/lib/inets/doc/src/notes_history.xml +++ b/lib/inets/doc/src/notes_history.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="iso-8859-1" ?> <!DOCTYPE chapter SYSTEM "chapter.dtd"> <chapter> <header> <copyright> - <year>2004</year><year>2011</year> + <year>2004</year><year>2012</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> diff --git a/lib/inets/doc/src/part.xml b/lib/inets/doc/src/part.xml index 36955df6b3..3b6734a9b8 100644 --- a/lib/inets/doc/src/part.xml +++ b/lib/inets/doc/src/part.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="iso-8859-1" ?> <!DOCTYPE part SYSTEM "part.dtd"> <part xmlns:xi="http://www.w3.org/2001/XInclude"> <header> <copyright> - <year>2004</year><year>2009</year> + <year>2004</year><year>2012</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> diff --git a/lib/inets/doc/src/part_notes.xml b/lib/inets/doc/src/part_notes.xml index 21f464318b..81b0dedbfa 100644 --- a/lib/inets/doc/src/part_notes.xml +++ b/lib/inets/doc/src/part_notes.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="iso-8859-1" ?> <!DOCTYPE part SYSTEM "part.dtd"> <part xmlns:xi="http://www.w3.org/2001/XInclude"> <header> <copyright> - <year>2002</year><year>2009</year> + <year>2002</year><year>2012</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> diff --git a/lib/inets/doc/src/part_notes_history.xml b/lib/inets/doc/src/part_notes_history.xml index 3c1e6f5232..f714a6d2e3 100644 --- a/lib/inets/doc/src/part_notes_history.xml +++ b/lib/inets/doc/src/part_notes_history.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="iso-8859-1" ?> <!DOCTYPE part SYSTEM "part.dtd"> <part> <header> <copyright> - <year>2004</year><year>2009</year> + <year>2004</year><year>2012</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> diff --git a/lib/inets/doc/src/ref_man.xml b/lib/inets/doc/src/ref_man.xml index 45d5dfcd0e..e44829827c 100644 --- a/lib/inets/doc/src/ref_man.xml +++ b/lib/inets/doc/src/ref_man.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="iso-8859-1" ?> <!DOCTYPE application SYSTEM "application.dtd"> <application xmlns:xi="http://www.w3.org/2001/XInclude"> <header> <copyright> - <year>1997</year><year>2010</year> + <year>1997</year><year>2012</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -30,8 +30,8 @@ </header> <description> <p>Inets is a container for Internet clients and - servers. Currently a FTP client, a HTTP client and server, and - a tftp client and server has been incorporated in Inets.</p> + servers. Currently a FTP client, a HTTP client and server, and + a tftp client and server has been incorporated in Inets.</p> </description> <xi:include href="inets.xml"/> <xi:include href="ftp.xml"/> @@ -45,6 +45,7 @@ <xi:include href="mod_auth.xml"/> <xi:include href="mod_esi.xml"/> <xi:include href="mod_security.xml"/> + <xi:include href="http_uri.xml"/> </application> diff --git a/lib/inets/doc/src/tftp.xml b/lib/inets/doc/src/tftp.xml index 96d6ae0dd5..0b3e93a153 100644 --- a/lib/inets/doc/src/tftp.xml +++ b/lib/inets/doc/src/tftp.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="iso-8859-1" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> <header> <copyright> - <year>2006</year><year>2009</year> + <year>2006</year><year>2012</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -218,6 +218,8 @@ <c>5</c> times when the timeout expires.</p> </item> </taglist> + + <marker id="start1"></marker> </section> <funcs> @@ -231,11 +233,14 @@ </type> <desc> <p>Starts a daemon process which listens for udp packets on a - port. When it receives a request for read or write it spawns - a temporary server process which handles the actual transfer - of the (virtual) file.</p> + port. When it receives a request for read or write it spawns + a temporary server process which handles the actual transfer + of the (virtual) file.</p> + + <marker id="read_file"></marker> </desc> </func> + <func> <name>read_file(RemoteFilename, LocalFilename, Options) -> {ok, LastCallbackState} | {error, Reason}</name> <fsummary>Read a (virtual) file from a TFTP server</fsummary> @@ -248,23 +253,26 @@ </type> <desc> <p>Reads a (virtual) file <c>RemoteFilename</c> from a TFTP - server.</p> - <p>If <c>LocalFilename</c> is the atom <c>binary</c>, - <c>tftp_binary</c> is used as callback module. It concatenates - all transferred blocks and returns them as one single binary - in <c>LastCallbackState</c>.</p> - <p>If <c>LocalFilename</c> is a string and there are no - registered callback modules, <c>tftp_file</c> is used as - callback module. It writes each transferred block to the file - named <c>LocalFilename</c> and returns the number of - transferred bytes in <c>LastCallbackState</c>.</p> - <p>If <c>LocalFilename</c> is a string and there are registered - callback modules, <c>LocalFilename</c> is tested against - the regexps of these and the callback module corresponding to - the first match is used, or an error tuple is returned if no - matching regexp is found.</p> + server.</p> + <p>If <c>LocalFilename</c> is the atom <c>binary</c>, + <c>tftp_binary</c> is used as callback module. It concatenates + all transferred blocks and returns them as one single binary + in <c>LastCallbackState</c>.</p> + <p>If <c>LocalFilename</c> is a string and there are no + registered callback modules, <c>tftp_file</c> is used as + callback module. It writes each transferred block to the file + named <c>LocalFilename</c> and returns the number of + transferred bytes in <c>LastCallbackState</c>.</p> + <p>If <c>LocalFilename</c> is a string and there are registered + callback modules, <c>LocalFilename</c> is tested against + the regexps of these and the callback module corresponding to + the first match is used, or an error tuple is returned if no + matching regexp is found.</p> </desc> + + <marker id="write_file"></marker> </func> + <func> <name>write_file(RemoteFilename, LocalFilename, Options) -> {ok, LastCallbackState} | {error, Reason}</name> <fsummary>Write a (virtual) file to a TFTP server</fsummary> @@ -288,10 +296,12 @@ block by block and returns the number of transferred bytes in <c>LastCallbackState</c>.</p> <p>If <c>LocalFilename</c> is a string and there are registered - callback modules, <c>LocalFilename</c> is tested against - the regexps of these and the callback module corresponding to - the first match is used, or an error tuple is returned if no - matching regexp is found.</p> + callback modules, <c>LocalFilename</c> is tested against + the regexps of these and the callback module corresponding to + the first match is used, or an error tuple is returned if no + matching regexp is found.</p> + + <marker id="info_daemons"></marker> </desc> </func> @@ -304,8 +314,9 @@ <v>Reason = term()</v> </type> <desc> - <p>Returns info about all TFTP daemon processes. - </p> + <p>Returns info about all TFTP daemon processes. </p> + + <marker id="info_servers"></marker> </desc> </func> @@ -318,8 +329,9 @@ <v>Reason = term()</v> </type> <desc> - <p>Returns info about all TFTP server processes. - </p> + <p>Returns info about all TFTP server processes. </p> + + <marker id="info_pid"></marker> </desc> </func> @@ -332,6 +344,8 @@ </type> <desc> <p>Returns info about a TFTP daemon, server or client process.</p> + + <marker id="change_config_daemons"></marker> </desc> </func> @@ -346,8 +360,9 @@ <v>Reason = term()</v> </type> <desc> - <p>Changes config for all TFTP daemon processes - </p> + <p>Changes config for all TFTP daemon processes. </p> + + <marker id="change_config_servers"></marker> </desc> </func> @@ -362,8 +377,9 @@ <v>Reason = term()</v> </type> <desc> - <p>Changes config for all TFTP server processes - </p> + <p>Changes config for all TFTP server processes. </p> + + <marker id="change_config_pid"></marker> </desc> </func> @@ -378,8 +394,11 @@ </type> <desc> <p>Changes config for a TFTP daemon, server or client process</p> + + <marker id="start2"></marker> </desc> </func> + <func> <name>start() -> ok | {error, Reason}</name> <fsummary>Start the Inets application</fsummary> @@ -442,8 +461,9 @@ by the already ongoing connection on the server side. By not setting up yet another connection, in parallel with the ongoing one, the server will - consumer lesser resources. - </p> + consumer lesser resources. </p> + + <marker id="prepare"></marker> </section> <funcs> @@ -468,17 +488,20 @@ <v>Text = string()</v> </type> <desc> - <p>Prepares to open a file on the client side.</p> - <p>No new options may be added, but the ones that are present in - <c>SuggestedOptions</c> may be omitted or replaced with new - values in <c>AcceptedOptions</c>.</p> - <p>Will be followed by a call to <c>open/4</c> before any - read/write access is performed. <c>AcceptedOptions</c> is - sent to the server which replies with those options that it - accepts. These will be forwarded to <c>open/4</c> as - <c>SuggestedOptions</c>.</p> + <p>Prepares to open a file on the client side.</p> + <p>No new options may be added, but the ones that are present in + <c>SuggestedOptions</c> may be omitted or replaced with new + values in <c>AcceptedOptions</c>.</p> + <p>Will be followed by a call to <c>open/4</c> before any + read/write access is performed. <c>AcceptedOptions</c> is + sent to the server which replies with those options that it + accepts. These will be forwarded to <c>open/4</c> as + <c>SuggestedOptions</c>.</p> + + <marker id="open"></marker> </desc> </func> + <func> <name>open(Peer, Access, Filename, Mode, SuggestedOptions, State) -> {ok, AcceptedOptions, NewState} | {error, {Code, Text}}</name> <fsummary>Open a file for read or write access</fsummary> @@ -503,14 +526,17 @@ <desc> <p>Opens a file for read or write access.</p> <p>On the client side where the <c>open/5</c> call has been - preceded by a call to <c>prepare/5</c>, all options must be - accepted or rejected.</p> - <p>On the server side, where there is no preceding - <c>prepare/5</c> call, no new options may be added, but - the ones that are present in <c>SuggestedOptions</c> may be - omitted or replaced with new values in <c>AcceptedOptions</c>.</p> + preceded by a call to <c>prepare/5</c>, all options must be + accepted or rejected.</p> + <p>On the server side, where there is no preceding + <c>prepare/5</c> call, no new options may be added, but + the ones that are present in <c>SuggestedOptions</c> may be + omitted or replaced with new values in <c>AcceptedOptions</c>.</p> + + <marker id="read"></marker> </desc> </func> + <func> <name>read(State) -> {more, Bin, NewState} | {last, Bin, FileSize} | {error, {Code, Text}}</name> <fsummary>Read a chunk from the file</fsummary> @@ -526,15 +552,18 @@ <desc> <p>Read a chunk from the file.</p> <p>The callback function is expected to close - the file when the last file chunk is - encountered. When an error is encountered - the callback function is expected to clean - up after the aborted file transfer, such as - closing open file descriptors etc. In both - cases there will be no more calls to any of - the callback functions.</p> + the file when the last file chunk is + encountered. When an error is encountered + the callback function is expected to clean + up after the aborted file transfer, such as + closing open file descriptors etc. In both + cases there will be no more calls to any of + the callback functions.</p> + + <marker id="write"></marker> </desc> </func> + <func> <name>write(Bin, State) -> {more, NewState} | {last, FileSize} | {error, {Code, Text}}</name> <fsummary>Write a chunk to the file</fsummary> @@ -550,15 +579,18 @@ <desc> <p>Write a chunk to the file.</p> <p>The callback function is expected to close - the file when the last file chunk is - encountered. When an error is encountered - the callback function is expected to clean - up after the aborted file transfer, such as - closing open file descriptors etc. In both - cases there will be no more calls to any of - the callback functions.</p> + the file when the last file chunk is + encountered. When an error is encountered + the callback function is expected to clean + up after the aborted file transfer, such as + closing open file descriptors etc. In both + cases there will be no more calls to any of + the callback functions.</p> + + <marker id="abort"></marker> </desc> </func> + <func> <name>abort(Code, Text, State) -> ok</name> <fsummary>Abort the file transfer</fsummary> @@ -572,14 +604,14 @@ <desc> <p>Invoked when the file transfer is aborted.</p> <p>The callback function is expected to clean - up its used resources after the aborted file - transfer, such as closing open file - descriptors etc. The function will not be - invoked if any of the other callback - functions returns an error, as it is - expected that they already have cleaned up - the necessary resources. It will however be - invoked if the functions fails (crashes).</p> + up its used resources after the aborted file + transfer, such as closing open file + descriptors etc. The function will not be + invoked if any of the other callback + functions returns an error, as it is + expected that they already have cleaned up + the necessary resources. It will however be + invoked if the functions fails (crashes).</p> </desc> </func> </funcs> @@ -589,7 +621,9 @@ <title>LOGGER FUNCTIONS</title> <p>A <c>tftp_logger</c> callback module should be implemented as a - <c>tftp_logger</c> behavior and export the functions listed below.</p> + <c>tftp_logger</c> behavior and export the functions listed below.</p> + + <marker id="error_msg"></marker> </section> <funcs> @@ -602,7 +636,10 @@ <v>Reason = term()</v> </type> <desc> - <p>Log an error message. See <c>error_logger:error_msg/2 for details.</c> </p> + <p>Log an error message. + See <c>error_logger:error_msg/2 for details.</c> </p> + + <marker id="warning_msg"></marker> </desc> </func> @@ -615,7 +652,10 @@ <v>Reason = term()</v> </type> <desc> - <p>Log a warning message. See <c>error_logger:warning_msg/2 for details.</c> </p> + <p>Log a warning message. + See <c>error_logger:warning_msg/2 for details.</c> </p> + + <marker id="info_msg"></marker> </desc> </func> @@ -628,7 +668,8 @@ <v>Reason = term()</v> </type> <desc> - <p>Log an info message. See <c>error_logger:info_msg/2 for details.</c> </p> + <p>Log an info message. + See <c>error_logger:info_msg/2 for details.</c> </p> </desc> </func> </funcs> diff --git a/lib/inets/src/http_client/httpc.erl b/lib/inets/src/http_client/httpc.erl index ae87ceed93..0a30fe1e20 100644 --- a/lib/inets/src/http_client/httpc.erl +++ b/lib/inets/src/http_client/httpc.erl @@ -31,8 +31,10 @@ -export([ request/1, request/2, request/4, request/5, cancel_request/1, cancel_request/2, - set_option/2, set_option/3, + set_option/2, set_option/3, set_options/1, set_options/2, + get_option/1, get_option/2, + get_options/1, get_options/2, store_cookies/2, store_cookies/3, cookie_header/1, cookie_header/2, cookie_header/3, which_cookies/0, which_cookies/1, @@ -156,7 +158,7 @@ request(Method, {http_options, HTTPOptions}, {options, Options}, {profile, Profile}]), - case http_uri:parse(Url, Options) of + case uri_parse(Url, Options) of {error, Reason} -> {error, Reason}; {ok, ParsedUrl} -> @@ -177,7 +179,7 @@ request(Method, {http_options, HTTPOptions}, {options, Options}, {profile, Profile}]), - case http_uri:parse(Url, Options) of + case uri_parse(Url, Options) of {error, Reason} -> {error, Reason}; {ok, ParsedUrl} -> @@ -230,7 +232,7 @@ cancel_request(RequestId, Profile) set_options(Options) -> set_options(Options, default_profile()). set_options(Options, Profile) when is_atom(Profile) orelse is_pid(Profile) -> - ?hcrt("set cookies", [{options, Options}, {profile, Profile}]), + ?hcrt("set options", [{options, Options}, {profile, Profile}]), case validate_options(Options) of {ok, Opts} -> try @@ -253,6 +255,58 @@ set_option(Key, Value, Profile) -> %%-------------------------------------------------------------------------- +%% get_options(OptionItems) -> {ok, Values} | {error, Reason} +%% get_options(OptionItems, Profile) -> {ok, Values} | {error, Reason} +%% OptionItems - all | [option_item()] +%% option_item() - proxy | pipeline_timeout | max_pipeline_length | +%% keep_alive_timeout | max_keep_alive_length | +%% max_sessions | verbose | +%% cookies | ipfamily | ip | port | socket_opts +%% Profile - atom() +%% Values - [{option_item(), term()}] +%% Reason - term() +%% Description: Retrieves the current options. +%%------------------------------------------------------------------------- +get_options() -> + record_info(fields, options). + +get_options(Options) -> + get_options(Options, default_profile()). + +get_options(all = _Options, Profile) -> + get_options(get_options(), Profile); +get_options(Options, Profile) + when (is_list(Options) andalso + (is_atom(Profile) orelse is_pid(Profile))) -> + ?hcrt("get options", [{options, Options}, {profile, Profile}]), + case Options -- get_options() of + [] -> + try + begin + {ok, httpc_manager:get_options(Options, + profile_name(Profile))} + end + catch + exit:{noproc, _} -> + {error, inets_not_started} + end; + InvalidGetOptions -> + {error, {invalid_options, InvalidGetOptions}} + end. + +get_option(Key) -> + get_option(Key, default_profile()). + +get_option(Key, Profile) -> + case get_options([Key], Profile) of + {ok, [{Key, Value}]} -> + {ok, Value}; + Error -> + Error + end. + + +%%-------------------------------------------------------------------------- %% store_cookies(SetCookieHeaders, Url [, Profile]) -> ok | {error, reason} %% %% @@ -274,7 +328,7 @@ store_cookies(SetCookieHeaders, Url, Profile) %% Since the Address part is not actually used %% by the manager when storing cookies, we dont %% care about ipv6-host-with-brackets. - {ok, {_, _, Host, Port, Path, _}} = http_uri:parse(Url), + {ok, {_, _, Host, Port, Path, _}} = uri_parse(Url), Address = {Host, Port}, ProfileName = profile_name(Profile), Cookies = httpc_cookie:cookies(SetCookieHeaders, Path, Host), @@ -347,7 +401,7 @@ which_cookies(Profile) -> %% info() -> list() %% info(Profile) -> list() %% -%% Description: Debug function, retreive info about the profile +%% Description: Debug function, retrieve info about the profile %%------------------------------------------------------------------------- info() -> info(default_profile()). @@ -1144,6 +1198,22 @@ validate_headers(RequestHeaders, _, _) -> RequestHeaders. +%%-------------------------------------------------------------------------- +%% These functions is just simple wrappers to parse specifically HTTP URIs +%%-------------------------------------------------------------------------- + +scheme_defaults() -> + [{http, 80}, {https, 443}]. + +uri_parse(URI) -> + http_uri:parse(URI, [{scheme_defaults, scheme_defaults()}]). + +uri_parse(URI, Opts) -> + http_uri:parse(URI, [{scheme_defaults, scheme_defaults()} | Opts]). + + +%%-------------------------------------------------------------------------- + child_name2info(undefined) -> {error, no_such_service}; child_name2info(httpc_manager) -> diff --git a/lib/inets/src/http_client/httpc_handler.erl b/lib/inets/src/http_client/httpc_handler.erl index bfe9b14ef6..b8c34bd99b 100644 --- a/lib/inets/src/http_client/httpc_handler.erl +++ b/lib/inets/src/http_client/httpc_handler.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2002-2011. All Rights Reserved. +%% Copyright Ericsson AB 2002-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -851,14 +851,17 @@ connect(SocketType, ToAddress, case IpFamily of inet6fb4 -> Opts3 = [inet6 | Opts2], - case http_transport:connect(SocketType, ToAddress, Opts3, Timeout) of - {error, _Reason} = Error -> + case http_transport:connect(SocketType, + ToAddress, Opts3, Timeout) of + {error, Reason6} -> Opts4 = [inet | Opts2], case http_transport:connect(SocketType, ToAddress, Opts4, Timeout) of - {error, _} -> - %% Reply with the "original" error - Error; + {error, Reason4} -> + {error, {failed_connect, + [{to_address, ToAddress}, + {inet6, Opts3, Reason6}, + {inet, Opts4, Reason4}]}}; OK -> OK end; @@ -867,7 +870,13 @@ connect(SocketType, ToAddress, end; _ -> Opts3 = [IpFamily | Opts2], - http_transport:connect(SocketType, ToAddress, Opts3, Timeout) + case http_transport:connect(SocketType, ToAddress, Opts3, Timeout) of + {error, Reason} -> + {error, {failed_connect, [{to_address, ToAddress}, + {IpFamily, Opts3, Reason}]}}; + Else -> + Else + end end. connect_and_send_first_request(Address, Request, #state{options = Options} = State) -> diff --git a/lib/inets/src/http_client/httpc_manager.erl b/lib/inets/src/http_client/httpc_manager.erl index 453081da21..b225b43214 100644 --- a/lib/inets/src/http_client/httpc_manager.erl +++ b/lib/inets/src/http_client/httpc_manager.erl @@ -37,6 +37,7 @@ update_session/4, delete_session/2, set_options/2, + get_options/2, store_cookies/3, which_cookies/1, which_cookies/2, which_cookies/3, reset_cookies/1, @@ -250,6 +251,21 @@ set_options(Options, ProfileName) -> %%-------------------------------------------------------------------- +%% Function: get_options(OptionItems, ProfileName) -> Values +%% +%% OptionItems = [OptionItem] +%% OptionItem = Any or all fields of the current #options{} record +%% Values = [{OptionItem, Value}] +%% Value = term() +%% +%% Description: Gets the specified options used by the client. +%%-------------------------------------------------------------------- + +get_options(Options, ProfileName) -> + call(ProfileName, {get_options, Options}). + + +%%-------------------------------------------------------------------- %% Function: store_cookies(Cookies, Address, ProfileName) -> ok %% %% Cookies = [Cookie] @@ -430,7 +446,7 @@ handle_call(which_cookies, _, #state{cookie_db = CookieDb} = State) -> handle_call({which_cookies, Url, Options}, _, #state{cookie_db = CookieDb} = State) -> ?hcrv("which cookies", [{url, Url}, {options, Options}]), - case http_uri:parse(Url, Options) of + case uri_parse(Url, Options) of {ok, {Scheme, _, Host, Port, Path, _}} -> CookieHeaders = httpc_cookie:header(CookieDb, Scheme, {Host, Port}, Path), @@ -439,6 +455,12 @@ handle_call({which_cookies, Url, Options}, _, {reply, ERROR, State} end; +handle_call({get_options, OptionItems}, _, #state{options = Options} = State) -> + ?hcrv("get options", [{option_items, OptionItems}]), + Reply = [{OptionItem, get_option(OptionItem, Options)} || OptionItem <- + OptionItems], + {reply, Reply, State}; + handle_call(info, _, State) -> ?hcrv("info", []), Info = get_manager_info(State), @@ -872,6 +894,19 @@ make_db_name(ProfileName, Post) -> list_to_atom(atom_to_list(ProfileName) ++ Post). +%%-------------------------------------------------------------------------- +%% These functions is just simple wrappers to parse specifically HTTP URIs +%%-------------------------------------------------------------------------- + +scheme_defaults() -> + [{http, 80}, {https, 443}]. + +uri_parse(URI, Opts) -> + http_uri:parse(URI, [{scheme_defaults, scheme_defaults()} | Opts]). + + +%%-------------------------------------------------------------------------- + call(ProfileName, Msg) -> Timeout = infinity, @@ -883,6 +918,31 @@ cast(ProfileName, Msg) -> gen_server:cast(ProfileName, Msg). +get_option(proxy, #options{proxy = Proxy}) -> + Proxy; +get_option(pipeline_timeout, #options{pipeline_timeout = Timeout}) -> + Timeout; +get_option(max_pipeline_length, #options{max_pipeline_length = Length}) -> + Length; +get_option(keep_alive_timeout, #options{keep_alive_timeout = Timeout}) -> + Timeout; +get_option(max_keep_alive_length, #options{max_keep_alive_length = Length}) -> + Length; +get_option(max_sessions, #options{max_sessions = MaxSessions}) -> + MaxSessions; +get_option(cookies, #options{cookies = Cookies}) -> + Cookies; +get_option(verbose, #options{verbose = Verbose}) -> + Verbose; +get_option(ipfamily, #options{ipfamily = IpFamily}) -> + IpFamily; +get_option(ip, #options{ip = IP}) -> + IP; +get_option(port, #options{port = Port}) -> + Port; +get_option(socket_opts, #options{socket_opts = SocketOpts}) -> + SocketOpts. + get_proxy(Opts, #options{proxy = Default}) -> proplists:get_value(proxy, Opts, Default). diff --git a/lib/inets/src/http_client/httpc_response.erl b/lib/inets/src/http_client/httpc_response.erl index 919115a23a..23924e355e 100644 --- a/lib/inets/src/http_client/httpc_response.erl +++ b/lib/inets/src/http_client/httpc_response.erl @@ -342,7 +342,7 @@ redirect(Response = {StatusLine, Headers, Body}, Request) -> RedirUrl -> UrlParseOpts = [{ipv6_host_with_brackets, Request#request.ipv6_host_with_brackets}], - case http_uri:parse(RedirUrl, UrlParseOpts) of + case uri_parse(RedirUrl, UrlParseOpts) of {error, no_scheme} when (Request#request.settings)#http_options.relaxed -> NewLocation = fix_relative_uri(Request, RedirUrl), @@ -437,3 +437,17 @@ format_response({StatusLine, Headers, Body}) -> end, {{StatusLine, http_response:header_list(Headers), NewBody}, Data}. +%%-------------------------------------------------------------------------- +%% These functions is just simple wrappers to parse specifically HTTP URIs +%%-------------------------------------------------------------------------- + +scheme_defaults() -> + [{http, 80}, {https, 443}]. + +uri_parse(URI, Opts) -> + http_uri:parse(URI, [{scheme_defaults, scheme_defaults()} | Opts]). + + +%%-------------------------------------------------------------------------- + + diff --git a/lib/inets/src/http_lib/http_uri.erl b/lib/inets/src/http_lib/http_uri.erl index 32c6305a79..5962001c3a 100644 --- a/lib/inets/src/http_lib/http_uri.erl +++ b/lib/inets/src/http_lib/http_uri.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2006-2011. All Rights Reserved. +%% Copyright Ericsson AB 2006-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -17,39 +17,95 @@ %% %CopyrightEnd% %% %% -%% RFC 3986 +%% This is from chapter 3, Syntax Components, of RFC 3986: +%% +%% The generic URI syntax consists of a hierarchical sequence of +%% components referred to as the scheme, authority, path, query, and +%% fragment. +%% +%% URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] +%% +%% hier-part = "//" authority path-abempty +%% / path-absolute +%% / path-rootless +%% / path-empty +%% +%% The scheme and path components are required, though the path may be +%% empty (no characters). When authority is present, the path must +%% either be empty or begin with a slash ("/") character. When +%% authority is not present, the path cannot begin with two slash +%% characters ("//"). These restrictions result in five different ABNF +%% rules for a path (Section 3.3), only one of which will match any +%% given URI reference. +%% +%% The following are two example URIs and their component parts: +%% +%% foo://example.com:8042/over/there?name=ferret#nose +%% \_/ \______________/\_________/ \_________/ \__/ +%% | | | | | +%% scheme authority path query fragment +%% | _____________________|__ +%% / \ / \ +%% urn:example:animal:ferret:nose +%% +%% scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) +%% authority = [ userinfo "@" ] host [ ":" port ] +%% userinfo = *( unreserved / pct-encoded / sub-delims / ":" ) +%% %% -module(http_uri). -export([parse/1, parse/2, + scheme_defaults/0, encode/1, decode/1]). +-export_type([scheme/0, default_scheme_port_number/0]). + %%%========================================================================= %%% API %%%========================================================================= + +-type scheme() :: atom(). +-type default_scheme_port_number() :: pos_integer(). + +-spec scheme_defaults() -> + [{scheme(), default_scheme_port_number()}]. + +scheme_defaults() -> + [{http, 80}, + {https, 443}, + {ftp, 21}, + {ssh, 22}, + {sftp, 22}, + {tftp, 69}]. + parse(AbsURI) -> parse(AbsURI, []). parse(AbsURI, Opts) -> - case parse_scheme(AbsURI) of + case parse_scheme(AbsURI, Opts) of {error, Reason} -> {error, Reason}; - {Scheme, Rest} -> - case (catch parse_uri_rest(Scheme, Rest, Opts)) of - {UserInfo, Host, Port, Path, Query} -> + {Scheme, DefaultPort, Rest} -> + case (catch parse_uri_rest(Scheme, DefaultPort, Rest, Opts)) of + {ok, {UserInfo, Host, Port, Path, Query}} -> {ok, {Scheme, UserInfo, Host, Port, Path, Query}}; + {error, Reason} -> + {error, {Reason, Scheme, AbsURI}}; _ -> - {error, {malformed_url, AbsURI}} + {error, {malformed_url, Scheme, AbsURI}} end end. +reserved() -> + sets:from_list([$;, $:, $@, $&, $=, $+, $,, $/, $?, + $#, $[, $], $<, $>, $\", ${, $}, $|, + $\\, $', $^, $%, $ ]). + encode(URI) -> - Reserved = sets:from_list([$;, $:, $@, $&, $=, $+, $,, $/, $?, - $#, $[, $], $<, $>, $\", ${, $}, $|, - $\\, $', $^, $%, $ ]), - %% lists:append(lists:map(fun(Char) -> uri_encode(Char, Reserved) end, URI)). + Reserved = reserved(), lists:append([uri_encode(Char, Reserved) || Char <- URI]). decode(String) -> @@ -67,20 +123,31 @@ do_decode([]) -> %%% Internal functions %%%======================================================================== -parse_scheme(AbsURI) -> +which_scheme_defaults(Opts) -> + Key = scheme_defaults, + case lists:keysearch(Key, 1, Opts) of + {value, {Key, SchemeDefaults}} -> + SchemeDefaults; + false -> + scheme_defaults() + end. + +parse_scheme(AbsURI, Opts) -> case split_uri(AbsURI, ":", {error, no_scheme}, 1, 1) of {error, no_scheme} -> {error, no_scheme}; - {StrScheme, Rest} -> - case list_to_atom(http_util:to_lower(StrScheme)) of - Scheme when (Scheme =:= http) orelse (Scheme =:= https) -> - {Scheme, Rest}; - Scheme -> - {error, {not_supported_scheme, Scheme}} + {SchemeStr, Rest} -> + Scheme = list_to_atom(http_util:to_lower(SchemeStr)), + SchemeDefaults = which_scheme_defaults(Opts), + case lists:keysearch(Scheme, 1, SchemeDefaults) of + {value, {Scheme, DefaultPort}} -> + {Scheme, DefaultPort, Rest}; + false -> + {Scheme, no_default_port, Rest} end end. -parse_uri_rest(Scheme, "//" ++ URIPart, Opts) -> +parse_uri_rest(Scheme, DefaultPort, "//" ++ URIPart, Opts) -> {Authority, PathQuery} = case split_uri(URIPart, "/", URIPart, 1, 0) of Split = {_, _} -> @@ -93,26 +160,25 @@ parse_uri_rest(Scheme, "//" ++ URIPart, Opts) -> {URIPart,""} end end, - {UserInfo, HostPort} = split_uri(Authority, "@", {"", Authority}, 1, 1), - {Host, Port} = parse_host_port(Scheme, HostPort, Opts), + {Host, Port} = parse_host_port(Scheme, DefaultPort, HostPort, Opts), {Path, Query} = parse_path_query(PathQuery), - {UserInfo, Host, Port, Path, Query}. + {ok, {UserInfo, Host, Port, Path, Query}}. parse_path_query(PathQuery) -> {Path, Query} = split_uri(PathQuery, "\\?", {PathQuery, ""}, 1, 0), {path(Path), Query}. -parse_host_port(Scheme,"[" ++ HostPort, Opts) -> %ipv6 - DefaultPort = default_port(Scheme), +%% In this version of the function, we no longer need +%% the Scheme argument, but just in case... +parse_host_port(_Scheme, DefaultPort, "[" ++ HostPort, Opts) -> %ipv6 {Host, ColonPort} = split_uri(HostPort, "\\]", {HostPort, ""}, 1, 1), Host2 = maybe_ipv6_host_with_brackets(Host, Opts), {_, Port} = split_uri(ColonPort, ":", {"", DefaultPort}, 0, 1), {Host2, int_port(Port)}; -parse_host_port(Scheme, HostPort, _Opts) -> - DefaultPort = default_port(Scheme), +parse_host_port(_Scheme, DefaultPort, HostPort, _Opts) -> {Host, Port} = split_uri(HostPort, ":", {HostPort, DefaultPort}, 1, 1), {Host, int_port(Port)}. @@ -133,15 +199,14 @@ maybe_ipv6_host_with_brackets(Host, Opts) -> Host end. -default_port(http) -> - 80; -default_port(https) -> - 443. int_port(Port) when is_integer(Port) -> Port; int_port(Port) when is_list(Port) -> - list_to_integer(Port). + list_to_integer(Port); +%% This is the case where no port was found and there was no default port +int_port(no_default_port) -> + throw({error, no_default_port}). path("") -> "/"; diff --git a/lib/inets/src/http_server/Makefile b/lib/inets/src/http_server/Makefile index 55cc68dede..c341a2cec7 100644 --- a/lib/inets/src/http_server/Makefile +++ b/lib/inets/src/http_server/Makefile @@ -88,6 +88,8 @@ ERL_FILES = $(MODULES:%=%.erl) TARGET_FILES= $(MODULES:%=$(EBIN)/%.$(EMULATOR)) +INETS_FLAGS = -D'SERVER_SOFTWARE="$(APPLICATION)/$(VSN)"' + # ---------------------------------------------------- # FLAGS diff --git a/lib/inets/src/http_server/httpd_conf.erl b/lib/inets/src/http_server/httpd_conf.erl index 7646300409..b575d7331b 100644 --- a/lib/inets/src/http_server/httpd_conf.erl +++ b/lib/inets/src/http_server/httpd_conf.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2011. All Rights Reserved. +%% Copyright Ericsson AB 1997-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -210,12 +210,32 @@ load("MaxBodySize " ++ MaxBodySize, []) -> {ok, Integer} -> {ok, [], {max_body_size,Integer}}; {error, _} -> - {error, ?NICE(clean(MaxBodySize)++ + {error, ?NICE(clean(MaxBodySize) ++ " is an invalid number of MaxBodySize")} end; load("ServerName " ++ ServerName, []) -> - {ok,[],{server_name,clean(ServerName)}}; + {ok,[], {server_name, clean(ServerName)}}; + +load("ServerTokens " ++ ServerTokens, []) -> + %% These are the valid *plain* server tokens: + %% sprod, major, minor, minimum, os, full + %% It can also be a "private" server token: private:<any string> + case string:tokens(ServerTokens, [$:]) of + ["private", Private] -> + {ok,[], {server_tokens, clean(Private)}}; + [TokStr] -> + Tok = list_to_atom(clean(TokStr)), + case lists:member(Tok, [prod, major, minor, minimum, os, full]) of + true -> + {ok,[], {server_tokens, Tok}}; + false -> + {error, ?NICE(clean(ServerTokens) ++ + " is an invalid ServerTokens")} + end; + _ -> + {error, ?NICE(clean(ServerTokens) ++ " is an invalid ServerTokens")} + end; load("SocketType " ++ SocketType, []) -> %% ssl is the same as HTTP_DEFAULT_SSL_KIND @@ -475,7 +495,7 @@ validate_properties(Properties) -> validate_properties2(Properties) -> case proplists:get_value(bind_address, Properties) of undefined -> - case proplists:get_value(sock_type, Properties, ip_comm) of + case proplists:get_value(sock_type, Properties, ip_comm) of ip_comm -> case proplists:get_value(ipfamily, Properties) of undefined -> @@ -537,6 +557,20 @@ validate_config_params([{server_name, Value} | Rest]) validate_config_params([{server_name, Value} | _]) -> throw({server_name, Value}); +validate_config_params([{server_tokens, Value} | Rest]) + when is_atom(Value) -> + case lists:member(Value, plain_server_tokens()) of + true -> + validate_config_params(Rest); + false -> + throw({server_tokens, Value}) + end; +validate_config_params([{server_tokens, {private, Value}} | Rest]) + when is_list(Value) -> + validate_config_params(Rest); +validate_config_params([{server_tokens, Value} | _]) -> + throw({server_tokens, Value}); + validate_config_params([{socket_type, Value} | Rest]) when (Value =:= ip_comm) orelse (Value =:= ssl) orelse @@ -737,9 +771,73 @@ store({log_format, LogFormat}, _ConfigList) store({log_format, LogFormat}, _ConfigList) when (LogFormat =:= compact) orelse (LogFormat =:= pretty) -> {ok, {log_format, LogFormat}}; +store({server_tokens, ServerTokens} = Entry, _ConfigList) -> + Server = server(ServerTokens), + {ok, [Entry, {server, Server}]}; store(ConfigListEntry, _ConfigList) -> {ok, ConfigListEntry}. + +%% The SERVER_SOFTWARE macro has the following structure: +%% <product>/<version> +%% Example: "inets/1.2.3" +%% So, with this example (on a linux machine, with OTP R15B), +%% this will result in: +%% prod: "inets" +%% major: "inets/1" +%% minor: "inets/1.2" +%% minimal: "inets/1.2.3" +%% os: "inets/1.2.3 (unix) +%% full: "inets/1.2.3 (unix/linux) OTP/R15B" +%% Note that the format of SERVER_SOFTWARE is that of 'minimal'. +%% Also, there will always be atleast two digits in a version: +%% Not just 1 but 1.0 +%% +%% We have already checked that the value is valid, +%% so there is no need to check enything here. +%% +server(prod = _ServerTokens) -> + [Prod|_Version] = string:tokens(?SERVER_SOFTWARE, [$/]), + Prod; +server(major = _ServerTokens) -> + [Prod|Version] = string:tokens(?SERVER_SOFTWARE, [$/]), + [Major|_] = string:tokens(Version, [$.]), + Prod ++ "/" ++ Major; +server(minor = _ServerTokens) -> + [Prod|Version] = string:tokens(?SERVER_SOFTWARE, [$/]), + [Major,Minor|_] = string:tokens(Version, [$.]), + Prod ++ "/" ++ Major ++ "." ++ Minor; +server(minimal = _ServerTokens) -> + %% This is the default + ?SERVER_SOFTWARE; +server(os = _ServerTokens) -> + OS = os_info(partial), + lists:flatten(io_lib:format("~s ~s", [?SERVER_SOFTWARE, OS])); +server(full = _ServerTokens) -> + OTPRelease = otp_release(), + OS = os_info(full), + lists:flatten( + io_lib:format("~s ~s OTP/~s", [?SERVER_SOFTWARE, OS, OTPRelease])); +server({private, Server} = _ServerTokens) when is_list(Server) -> + %% The user provide its own + Server; +server(_) -> + ?SERVER_SOFTWARE. + +os_info(Info) -> + case os:type() of + {OsFamily, _OsName} when Info =:= partial -> + lists:flatten(io_lib:format("(~w)", [OsFamily])); + {OsFamily, OsName} -> + lists:flatten(io_lib:format("(~w/~w)", [OsFamily, OsName])); + OsFamily -> + lists:flatten(io_lib:format("(~w)", [OsFamily])) + end. + +otp_release() -> + erlang:system_info(otp_release). + + %% Phase 3: Remove remove_all(ConfigDB) -> Modules = httpd_util:lookup(ConfigDB,modules,[]), @@ -1159,6 +1257,10 @@ ssl_ca_certificate_file(ConfigDB) -> [{cacertfile, File}] end. +plain_server_tokens() -> + [prod, major, minor, minimum, os, full]. + error_report(Where,M,F,Error) -> error_logger:error_report([{?MODULE, Where}, {apply, {M, F, []}}, Error]). + diff --git a/lib/inets/src/http_server/httpd_response.erl b/lib/inets/src/http_server/httpd_response.erl index dd7223876e..2dedb088e4 100644 --- a/lib/inets/src/http_server/httpd_response.erl +++ b/lib/inets/src/http_server/httpd_response.erl @@ -144,10 +144,14 @@ send_response(ModData, Header, Body) -> end end. -send_header(#mod{socket_type = Type, socket = Sock, - http_version = Ver, connection = Conn} = _ModData, +send_header(#mod{socket_type = Type, + socket = Sock, + http_version = Ver, + connection = Conn, + config_db = ConfigDb} = _ModData, StatusCode, KeyValueTupleHeaders) -> - Headers = create_header(lists:map(fun transform/1, KeyValueTupleHeaders)), + Headers = create_header(ConfigDb, + lists:map(fun transform/1, KeyValueTupleHeaders)), NewVer = case {Ver, StatusCode} of {[], _} -> %% May be implicit! @@ -275,13 +279,20 @@ cache_headers(#mod{config_db = Db}) -> [] end. -create_header(KeyValueTupleHeaders) -> - NewHeaders = add_default_headers([{"date", httpd_util:rfc1123_date()}, - {"content-type", "text/html"}, - {"server", ?SERVER_SOFTWARE}], - KeyValueTupleHeaders), +create_header(ConfigDb, KeyValueTupleHeaders) -> + Date = httpd_util:rfc1123_date(), + ContentType = "text/html", + Server = server(ConfigDb), + NewHeaders = add_default_headers([{"date", Date}, + {"content-type", ContentType}, + {"server", Server}], + KeyValueTupleHeaders), lists:map(fun fix_header/1, NewHeaders). + +server(ConfigDb) -> + httpd_util:lookup(ConfigDb, server, ?SERVER_SOFTWARE). + fix_header({Key0, Value}) -> %% make sure first letter is capital Words1 = string:tokens(Key0, "-"), diff --git a/lib/inets/src/http_server/httpd_script_env.erl b/lib/inets/src/http_server/httpd_script_env.erl index d3115150b0..a5613ba4a4 100644 --- a/lib/inets/src/http_server/httpd_script_env.erl +++ b/lib/inets/src/http_server/httpd_script_env.erl @@ -50,29 +50,44 @@ create_env(ScriptType, ModData, ScriptElements) -> %%%======================================================================== %%% Internal functions %%%======================================================================== + +which_server(#mod{config_db = ConfigDb}) -> + httpd_util:lookup(ConfigDb, server, ?SERVER_SOFTWARE). + +which_port(#mod{config_db = ConfigDb}) -> + httpd_util:lookup(ConfigDb, port, 80). + +which_peername(#mod{init_data = #init_data{peername = {_, RemoteAddr}}}) -> + RemoteAddr. + +which_resolve(#mod{init_data = #init_data{resolve = Resolve}}) -> + Resolve. + +which_method(#mod{method = Method}) -> + Method. + +which_request_uri(#mod{request_uri = RUri}) -> + RUri. + create_basic_elements(esi, ModData) -> - {_, RemoteAddr} = (ModData#mod.init_data)#init_data.peername, - [{server_software, ?SERVER_SOFTWARE}, - {server_name, (ModData#mod.init_data)#init_data.resolve}, - {gateway_interface,?GATEWAY_INTERFACE}, - {server_protocol, ?SERVER_PROTOCOL}, - {server_port, httpd_util:lookup(ModData#mod.config_db,port,80)}, - {request_method, ModData#mod.method}, - {remote_addr, RemoteAddr}, - {script_name, ModData#mod.request_uri}]; + [{server_software, which_server(ModData)}, + {server_name, which_resolve(ModData)}, + {gateway_interface, ?GATEWAY_INTERFACE}, + {server_protocol, ?SERVER_PROTOCOL}, + {server_port, which_port(ModData)}, + {request_method, which_method(ModData)}, + {remote_addr, which_peername(ModData)}, + {script_name, which_request_uri(ModData)}]; create_basic_elements(cgi, ModData) -> - {_, RemoteAddr} = (ModData#mod.init_data)#init_data.peername, - [{"SERVER_SOFTWARE",?SERVER_SOFTWARE}, - {"SERVER_NAME", (ModData#mod.init_data)#init_data.resolve}, - {"GATEWAY_INTERFACE",?GATEWAY_INTERFACE}, - {"SERVER_PROTOCOL",?SERVER_PROTOCOL}, - {"SERVER_PORT", - integer_to_list(httpd_util:lookup( - ModData#mod.config_db, port, 80))}, - {"REQUEST_METHOD", ModData#mod.method}, - {"REMOTE_ADDR", RemoteAddr}, - {"SCRIPT_NAME", ModData#mod.request_uri}]. + [{"SERVER_SOFTWARE", which_server(ModData)}, + {"SERVER_NAME", which_resolve(ModData)}, + {"GATEWAY_INTERFACE", ?GATEWAY_INTERFACE}, + {"SERVER_PROTOCOL", ?SERVER_PROTOCOL}, + {"SERVER_PORT", integer_to_list(which_port(ModData))}, + {"REQUEST_METHOD", which_method(ModData)}, + {"REMOTE_ADDR", which_peername(ModData)}, + {"SCRIPT_NAME", which_request_uri(ModData)}]. create_http_header_elements(ScriptType, Headers) -> create_http_header_elements(ScriptType, Headers, []). @@ -80,7 +95,7 @@ create_http_header_elements(ScriptType, Headers) -> create_http_header_elements(_, [], Acc) -> Acc; create_http_header_elements(ScriptType, [{Name, [Value | _] = Values } | - Headers], Acc) + Headers], Acc) when is_list(Value) -> NewName = lists:map(fun(X) -> if X == $- -> $_; true -> X end end, Name), Element = http_env_element(ScriptType, NewName, multi_value(Values)), diff --git a/lib/inets/src/http_server/httpd_sup.erl b/lib/inets/src/http_server/httpd_sup.erl index 264dc9f006..8f3e8f9500 100644 --- a/lib/inets/src/http_server/httpd_sup.erl +++ b/lib/inets/src/http_server/httpd_sup.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2011. All Rights Reserved. +%% Copyright Ericsson AB 2004-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -162,17 +162,30 @@ httpd_config([Value| _] = Config) when is_tuple(Value) -> httpd_child_spec([Value| _] = Config, AcceptTimeout, Debug) when is_tuple(Value) -> + ?hdrt("httpd_child_spec - entry", [{accept_timeout, AcceptTimeout}, + {debug, Debug}]), Address = proplists:get_value(bind_address, Config, any), Port = proplists:get_value(port, Config, 80), httpd_child_spec(Config, AcceptTimeout, Debug, Address, Port); -httpd_child_spec(ConfigFile, AcceptTimeout, Debug) -> +%% In this case the AcceptTimeout and Debug will only have default values... +httpd_child_spec(ConfigFile, AcceptTimeoutDef, DebugDef) -> + ?hdrt("httpd_child_spec - entry", [{config_file, ConfigFile}, + {accept_timeout_def, AcceptTimeoutDef}, + {debug_def, DebugDef}]), case httpd_conf:load(ConfigFile) of {ok, ConfigList} -> + ?hdrt("httpd_child_spec - loaded", [{config_list, ConfigList}]), case (catch httpd_conf:validate_properties(ConfigList)) of {ok, Config} -> + ?hdrt("httpd_child_spec - validated", [{config, Config}]), Address = proplists:get_value(bind_address, Config, any), Port = proplists:get_value(port, Config, 80), + AcceptTimeout = + proplists:get_value(accept_timeout, Config, + AcceptTimeoutDef), + Debug = + proplists:get_value(debug, Config, DebugDef), httpd_child_spec([{file, ConfigFile} | Config], AcceptTimeout, Debug, Address, Port); Error -> @@ -183,7 +196,7 @@ httpd_child_spec(ConfigFile, AcceptTimeout, Debug) -> end. httpd_child_spec(Config, AcceptTimeout, Debug, Addr, Port) -> - case Port == 0 orelse proplists:is_defined(fd, Config) of + case (Port =:= 0) orelse proplists:is_defined(fd, Config) of true -> httpd_child_spec_listen(Config, AcceptTimeout, Debug, Addr, Port); false -> diff --git a/lib/inets/src/http_server/mod_get.erl b/lib/inets/src/http_server/mod_get.erl index 5cb30e3d97..c58d1f3508 100644 --- a/lib/inets/src/http_server/mod_get.erl +++ b/lib/inets/src/http_server/mod_get.erl @@ -18,9 +18,16 @@ %% %% -module(mod_get). + -export([do/1]). + -include("httpd.hrl"). -include("httpd_internal.hrl"). +-include("inets_internal.hrl"). + +-define(VMODULE,"GET"). + + %% do do(Info) -> @@ -84,15 +91,16 @@ send_response(_Socket, _SocketType, Path, Info)-> file:close(FileDescriptor), {proceed,[{response,{already_sent,200, FileInfo#file_info.size}}, - {mime_type,MimeType}|Info#mod.data]}; + {mime_type,MimeType} | Info#mod.data]}; {error, Reason} -> + ?hdrt("send_response -> failed open file", + [{path, Path}, {reason, Reason}]), Status = httpd_file:handle_error(Reason, "open", Info, Path), - {proceed, - [{status, Status}| Info#mod.data]} + {proceed, [{status, Status} | Info#mod.data]} end. %% send - + send(#mod{socket = Socket, socket_type = SocketType} = Info, StatusCode, Headers, FileDescriptor) -> ?DEBUG("send -> send header",[]), diff --git a/lib/inets/src/inets_app/Makefile b/lib/inets/src/inets_app/Makefile index d99e33b4ea..6da6a1d79f 100644 --- a/lib/inets/src/inets_app/Makefile +++ b/lib/inets/src/inets_app/Makefile @@ -46,7 +46,8 @@ MODULES = \ inets_service \ inets_app \ inets_sup \ - inets_regexp + inets_regexp \ + inets_trace INTERNAL_HRL_FILES = inets_internal.hrl EXTERNAL_HRL_FILES = ../../include/httpd.hrl \ diff --git a/lib/inets/src/inets_app/inets.app.src b/lib/inets/src/inets_app/inets.app.src index 1db7ed2c30..4aea2ef3d7 100644 --- a/lib/inets/src/inets_app/inets.app.src +++ b/lib/inets/src/inets_app/inets.app.src @@ -18,14 +18,15 @@ %% {application,inets, - [{description,"INETS CXC 138 49"}, - {vsn,"%VSN%"}, + [{description, "INETS CXC 138 49"}, + {vsn, "%VSN%"}, {modules,[ inets, inets_sup, inets_app, inets_service, inets_regexp, + inets_trace, %% FTP ftp, diff --git a/lib/inets/src/inets_app/inets.appup.src b/lib/inets/src/inets_app/inets.appup.src index e80cb2a23b..c7029f7b31 100644 --- a/lib/inets/src/inets_app/inets.appup.src +++ b/lib/inets/src/inets_app/inets.appup.src @@ -18,65 +18,115 @@ {"%VSN%", [ + {"5.8.1", + [ + {load_module, http_uri, soft_purge, soft_purge, []}, + {load_module, httpc_response, soft_purge, soft_purge, [http_uri]}, + + {load_module, httpc, soft_purge, soft_purge, + [http_uri, httpc_manager]}, + {update, httpc_manager, soft, soft_purge, soft_purge, [http_uri]}, + + {load_module, inets_app, soft_purge, soft_purge, [inets_sup]}, + {update, inets_sup, soft, soft_purge, soft_purge, []}, + + {load_module, httpd_conf, soft_purge, soft_purge, []}, + {load_module, httpd_response, soft_purge, soft_purge, []}, + {load_module, httpd_script_env, soft_purge, soft_purge, []}, + + {load_module, inets, soft_purge, soft_purge, [inets_trace]}, + {update, httpc_handler, soft, soft_purge, soft_purge, []}, + {update, httpd_sup, soft, soft_purge, soft_purge, []}, + {add_module, inets_trace} + ] + }, {"5.8", [ + {load_module, http_uri, soft_purge, soft_purge, []}, + {load_module, httpc_response, soft_purge, soft_purge, [http_uri]}, + + {load_module, httpc, soft_purge, soft_purge, + [http_uri, httpc_manager]}, + + {load_module, inets_app, soft_purge, soft_purge, [inets_sup]}, + {update, inets_sup, soft, soft_purge, soft_purge, []}, + + {load_module, inets, soft_purge, soft_purge, [inets_trace]}, + + {load_module, httpd_conf, soft_purge, soft_purge, []}, + {load_module, httpd_response, soft_purge, soft_purge, []}, + {load_module, httpd_script_env, soft_purge, soft_purge, []}, + {load_module, ftp, soft_purge, soft_purge, []}, {update, httpc_handler, {advanced, upgrade_from_pre_5_8_1}, soft_purge, soft_purge, []}, {update, httpc_manager, {advanced, upgrade_from_pre_5_8_1}, - soft_purge, soft_purge, [httpc_handler]} + soft_purge, soft_purge, [http_uri, httpc_handler]}, + {update, httpd_sup, soft, soft_purge, soft_purge, []}, + + {add_module, inets_trace} ] }, {"5.7.2", [ {restart_application, inets} ] - }, - {"5.7.1", - [ - {restart_application, inets} - ] - }, - {"5.7", + } + ], + [ + {"5.8.1", [ - {restart_application, inets} + {load_module, http_uri, soft_purge, soft_purge, []}, + {load_module, httpc_response, soft_purge, soft_purge, [http_uri]}, + + {load_module, httpc, soft_purge, soft_purge, + [http_uri, httpc_manager]}, + {update, httpc_manager, soft, soft_purge, soft_purge, [http_uri]}, + + {load_module, inets_app, soft_purge, soft_purge, [inets_sup]}, + {update, inets_sup, soft, soft_purge, soft_purge, []}, + + {load_module, httpd_conf, soft_purge, soft_purge, []}, + {load_module, httpd_response, soft_purge, soft_purge, []}, + {load_module, httpd_script_env, soft_purge, soft_purge, []}, + + {load_module, inets, soft_purge, soft_purge, []}, + {update, httpc_handler, soft, soft_purge, soft_purge, []}, + {update, httpd_sup, soft, soft_purge, soft_purge, []}, + {remove, {inets_trace, soft_purge, brutal_purge}} ] }, - {"5.6", - [ - {restart_application, inets} - ] - } - ], - [ {"5.8", [ + {load_module, http_uri, soft_purge, soft_purge, []}, + {load_module, httpc_response, soft_purge, soft_purge, [http_uri]}, + + {load_module, httpc, soft_purge, soft_purge, + [http_uri, httpc_manager]}, + + {load_module, inets_app, soft_purge, soft_purge, [inets_sup]}, + {update, inets_sup, soft, soft_purge, soft_purge, []}, + + {load_module, inets, soft_purge, soft_purge, []}, + + {load_module, httpd_conf, soft_purge, soft_purge, []}, + {load_module, httpd_response, soft_purge, soft_purge, []}, + {load_module, httpd_script_env, soft_purge, soft_purge, []}, + {load_module, ftp, soft_purge, soft_purge, []}, {update, httpc_handler, {advanced, upgrade_from_pre_5_8_1}, soft_purge, soft_purge, []}, {update, httpc_manager, {advanced, upgrade_from_pre_5_8_1}, - soft_purge, soft_purge, [httpc_handler]} + soft_purge, soft_purge, [http_uri, httpc_handler]}, + {update, httpd_sup, soft, soft_purge, soft_purge, []}, + + {remove, {inets_trace, soft_purge, brutal_purge}} ] }, {"5.7.2", [ {restart_application, inets} ] - }, - {"5.7.1", - [ - {restart_application, inets} - ] - }, - {"5.7", - [ - {restart_application, inets} - ] - }, - {"5.6", - [ - {restart_application, inets} - ] } ] }. diff --git a/lib/inets/src/inets_app/inets.erl b/lib/inets/src/inets_app/inets.erl index 054468e445..8e79f8d456 100644 --- a/lib/inets/src/inets_app/inets.erl +++ b/lib/inets/src/inets_app/inets.erl @@ -28,7 +28,7 @@ stop/0, stop/2, services/0, services_info/0, service_names/0]). --export([enable_trace/2, enable_trace/3, disable_trace/0, set_trace/1, +-export([enable_trace/2, enable_trace/3, disable_trace/0, set_trace/1, report_event/4]). -export([versions/0, print_version_info/0, print_version_info/1]). @@ -409,47 +409,8 @@ service_names() -> %% Severity withing Limit) will be written to stdout using io:format. %% %%----------------------------------------------------------------- -enable_trace(Level, Dest) -> - enable_trace(Level, Dest, all). - -enable_trace(Level, Dest, Service) -> - case valid_trace_service(Service) of - true -> - enable_trace2(Level, Dest, Service); - false -> - {error, {invalid_service, Service}} - end. - -enable_trace2(Level, File, Service) - when is_list(File) -> - case file:open(File, [write]) of - {ok, Fd} -> - HandleSpec = {fun handle_trace/2, {Service, Fd}}, - do_enable_trace(Level, process, HandleSpec); - Err -> - Err - end; -enable_trace2(Level, Port, _) when is_integer(Port) -> - do_enable_trace(Level, port, dbg:trace_port(ip, Port)); -enable_trace2(Level, io, Service) -> - HandleSpec = {fun handle_trace/2, {Service, standard_io}}, - do_enable_trace(Level, process, HandleSpec); -enable_trace2(Level, {Fun, _Data} = HandleSpec, _) when is_function(Fun) -> - do_enable_trace(Level, process, HandleSpec). - -do_enable_trace(Level, Type, HandleSpec) -> - case dbg:tracer(Type, HandleSpec) of - {ok, _} -> - set_trace(Level), - ok; - Error -> - Error - end. - -valid_trace_service(all) -> - true; -valid_trace_service(Service) -> - lists:member(Service, [httpc, httpd, ftpc, tftp]). +enable_trace(Level, Dest) -> inets_trace:enable(Level, Dest). +enable_trace(Level, Dest, Service) -> inets_trace:enable(Level, Dest, Service). %%----------------------------------------------------------------- @@ -458,12 +419,7 @@ valid_trace_service(Service) -> %% Description: %% This function is used to stop tracing. %%----------------------------------------------------------------- -disable_trace() -> - %% This is to make handle_trace/2 close the output file (if the - %% event gets there before dbg closes) - inets:report_event(100, "stop trace", stop_trace, [stop_trace]), - dbg:stop(). - +disable_trace() -> inets_trace:disable(). %%----------------------------------------------------------------- @@ -476,60 +432,7 @@ disable_trace() -> %% This function is used to change the trace level when tracing has %% already been started. %%----------------------------------------------------------------- -set_trace(Level) -> - set_trace(Level, all). - -set_trace(Level, Service) -> - Pat = make_pattern(?MODULE, Service, Level), - change_pattern(Pat). - -make_pattern(Mod, Service, Level) - when is_atom(Mod) andalso is_atom(Service) -> - case Level of - min -> - {Mod, Service, []}; - max -> - Head = ['$1', '_', '_', '_'], - Body = [], - Cond = [], - {Mod, Service, [{Head, Cond, Body}]}; - DetailLevel when is_integer(DetailLevel) -> - Head = ['$1', '_', '_', '_'], - Body = [], - Cond = [{ '=<', '$1', DetailLevel}], - {Mod, Service, [{Head, Cond, Body}]}; - _ -> - exit({bad_level, Level}) - end. - -change_pattern({Mod, Service, Pattern}) - when is_atom(Mod) andalso is_atom(Service) -> - MFA = {Mod, report_event, 4}, - case Pattern of - [] -> - try - error_to_exit(ctp, dbg:ctp(MFA)), - error_to_exit(p, dbg:p(all, clear)) - catch - exit:{Where, Reason} -> - {error, {Where, Reason}} - end; - List when is_list(List) -> - try - error_to_exit(ctp, dbg:ctp(MFA)), - error_to_exit(tp, dbg:tp(MFA, Pattern)), - error_to_exit(p, dbg:p(all, [call, timestamp])) - catch - exit:{Where, Reason} -> - {error, {Where, Reason}} - end - end, - ok. - -error_to_exit(_Where, {ok, _} = OK) -> - OK; -error_to_exit(Where, {error, Reason}) -> - exit({Where, Reason}). +set_trace(Level) -> inets_trace:set_level(Level). %%----------------------------------------------------------------- @@ -546,164 +449,8 @@ error_to_exit(Where, {error, Reason}) -> %% put trace on this function. %%----------------------------------------------------------------- -report_event(Severity, Label, Service, Content) - when (is_integer(Severity) andalso - (Severity >= 0) andalso (100 >= Severity)) andalso - is_list(Label) andalso - is_atom(Service) andalso - is_list(Content) -> - hopefully_traced. - - -%% ---------------------------------------------------------------------- -%% handle_trace(Event, Fd) -> Verbosity -%% -%% Parameters: -%% Event -> The trace event (only megaco 'trace_ts' events are printed) -%% Fd -> standard_io | file_descriptor() | trace_port() -%% -%% Description: -%% This function is used to "receive" and print the trace events. -%% Events are printed if: -%% - Verbosity is max -%% - Severity is =< Verbosity (e.g. Severity = 30, and Verbosity = 40) -%% Events are not printed if: -%% - Verbosity is min -%% - Severity is > Verbosity -%%----------------------------------------------------------------- - -handle_trace(_, closed_file = Fd) -> - Fd; -handle_trace({trace_ts, _Who, call, - {?MODULE, report_event, - [_Sev, "stop trace", stop_trace, [stop_trace]]}, - Timestamp}, - {_, standard_io} = Fd) -> - (catch io:format(standard_io, "stop trace at ~s~n", [format_timestamp(Timestamp)])), - Fd; -handle_trace({trace_ts, _Who, call, - {?MODULE, report_event, - [_Sev, "stop trace", stop_trace, [stop_trace]]}, - Timestamp}, - standard_io = Fd) -> - (catch io:format(Fd, "stop trace at ~s~n", [format_timestamp(Timestamp)])), - Fd; -handle_trace({trace_ts, _Who, call, - {?MODULE, report_event, - [_Sev, "stop trace", stop_trace, [stop_trace]]}, - Timestamp}, - {_Service, Fd}) -> - (catch io:format(Fd, "stop trace at ~s~n", [format_timestamp(Timestamp)])), - (catch file:close(Fd)), - closed_file; -handle_trace({trace_ts, _Who, call, - {?MODULE, report_event, - [_Sev, "stop trace", stop_trace, [stop_trace]]}, - Timestamp}, - Fd) -> - (catch io:format(Fd, "stop trace at ~s~n", [format_timestamp(Timestamp)])), - (catch file:close(Fd)), - closed_file; -handle_trace({trace_ts, Who, call, - {?MODULE, report_event, - [Sev, Label, Service, Content]}, Timestamp}, - Fd) -> - (catch print_inets_trace(Fd, Sev, Timestamp, Who, - Label, Service, Content)), - Fd; -handle_trace(Event, Fd) -> - (catch print_trace(Fd, Event)), - Fd. - - -print_inets_trace({Service, Fd}, - Sev, Timestamp, Who, Label, Service, Content) -> - do_print_inets_trace(Fd, Sev, Timestamp, Who, Label, Service, Content); -print_inets_trace({ServiceA, Fd}, - Sev, Timestamp, Who, Label, ServiceB, Content) - when (ServiceA =:= all) -> - do_print_inets_trace(Fd, Sev, Timestamp, Who, Label, ServiceB, Content); -print_inets_trace({ServiceA, _Fd}, - _Sev, _Timestamp, _Who, _Label, ServiceB, _Content) - when ServiceA =/= ServiceB -> - ok; -print_inets_trace(Fd, Sev, Timestamp, Who, Label, Service, Content) -> - do_print_inets_trace(Fd, Sev, Timestamp, Who, Label, Service, Content). - -do_print_inets_trace(Fd, Sev, Timestamp, Who, Label, Service, Content) -> - Ts = format_timestamp(Timestamp), - io:format(Fd, "[inets ~w trace ~w ~w ~s] ~s " - "~n Content: ~p" - "~n", - [Service, Sev, Who, Ts, Label, Content]). - -print_trace({_, Fd}, Event) -> - do_print_trace(Fd, Event); -print_trace(Fd, Event) -> - do_print_trace(Fd, Event). - -do_print_trace(Fd, {trace, Who, What, Where}) -> - io:format(Fd, "[trace]" - "~n Who: ~p" - "~n What: ~p" - "~n Where: ~p" - "~n", [Who, What, Where]); - -do_print_trace(Fd, {trace, Who, What, Where, Extra}) -> - io:format(Fd, "[trace]" - "~n Who: ~p" - "~n What: ~p" - "~n Where: ~p" - "~n Extra: ~p" - "~n", [Who, What, Where, Extra]); - -do_print_trace(Fd, {trace_ts, Who, What, Where, When}) -> - Ts = format_timestamp(When), - io:format(Fd, "[trace ~s]" - "~n Who: ~p" - "~n What: ~p" - "~n Where: ~p" - "~n", [Ts, Who, What, Where]); - -do_print_trace(Fd, {trace_ts, Who, What, Where, Extra, When}) -> - Ts = format_timestamp(When), - io:format(Fd, "[trace ~s]" - "~n Who: ~p" - "~n What: ~p" - "~n Where: ~p" - "~n Extra: ~p" - "~n", [Ts, Who, What, Where, Extra]); - -do_print_trace(Fd, {seq_trace, What, Where}) -> - io:format(Fd, "[seq trace]" - "~n What: ~p" - "~n Where: ~p" - "~n", [What, Where]); - -do_print_trace(Fd, {seq_trace, What, Where, When}) -> - Ts = format_timestamp(When), - io:format(Fd, "[seq trace ~s]" - "~n What: ~p" - "~n Where: ~p" - "~n", [Ts, What, Where]); - -do_print_trace(Fd, {drop, Num}) -> - io:format(Fd, "[drop trace] ~p~n", [Num]); - -do_print_trace(Fd, Trace) -> - io:format(Fd, "[trace] " - "~n ~p" - "~n", [Trace]). - - -format_timestamp({_N1, _N2, N3} = Now) -> - {Date, Time} = calendar:now_to_datetime(Now), - {YYYY,MM,DD} = Date, - {Hour,Min,Sec} = Time, - FormatDate = - io_lib:format("~.4w:~.2.0w:~.2.0w ~.2.0w:~.2.0w:~.2.0w 4~w", - [YYYY,MM,DD,Hour,Min,Sec,round(N3/1000)]), - lists:flatten(FormatDate). +report_event(Severity, Label, Service, Content) -> + inets_trace:report_event(Severity, Label, Service, Content). %%-------------------------------------------------------------------- diff --git a/lib/inets/src/inets_app/inets.mk b/lib/inets/src/inets_app/inets.mk index 194b4ca2b1..d24cc0aea3 100644 --- a/lib/inets/src/inets_app/inets.mk +++ b/lib/inets/src/inets_app/inets.mk @@ -41,8 +41,6 @@ INETS_APP_VSN_COMPILE_FLAGS = \ +'{parse_transform,sys_pre_attributes}' \ +'{attribute,insert,app_vsn,$(APP_VSN)}' -INETS_FLAGS = -D'SERVER_SOFTWARE="$(APPLICATION)/$(VSN)"' - INETS_ERL_COMPILE_FLAGS += \ -pa $(ERL_TOP)/lib/inets/ebin \ $(INETS_APP_VSN_COMPILE_FLAGS) diff --git a/lib/inets/src/inets_app/inets_app.erl b/lib/inets/src/inets_app/inets_app.erl index cae79a6767..77c39d85eb 100644 --- a/lib/inets/src/inets_app/inets_app.erl +++ b/lib/inets/src/inets_app/inets_app.erl @@ -24,7 +24,7 @@ -export([start/2, stop/1]). start(_Type, _State) -> - supervisor:start_link({local, inets_sup}, inets_sup, []). + inets_sup:start_link(). stop(_State) -> ok. diff --git a/lib/inets/src/inets_app/inets_internal.hrl b/lib/inets/src/inets_app/inets_internal.hrl index 55c3669e4a..e56af3b59d 100644 --- a/lib/inets/src/inets_app/inets_internal.hrl +++ b/lib/inets/src/inets_app/inets_internal.hrl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% Copyright Ericsson AB 2005-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -24,8 +24,8 @@ %% Various trace macros -define(report(Severity, Label, Service, Content), - inets:report_event(Severity, Label, Service, - [{module, ?MODULE}, {line, ?LINE} | Content])). + inets_trace:report_event(Severity, Label, Service, + [{module, ?MODULE}, {line, ?LINE} | Content])). -define(report_important(Label, Service, Content), ?report(20, Label, Service, Content)). -define(report_verbose(Label, Service, Content), diff --git a/lib/inets/src/inets_app/inets_sup.erl b/lib/inets/src/inets_app/inets_sup.erl index 20d5ef343e..0382362778 100644 --- a/lib/inets/src/inets_app/inets_sup.erl +++ b/lib/inets/src/inets_app/inets_sup.erl @@ -25,9 +25,19 @@ -behaviour(supervisor). +%% External API +-export([start_link/0]). + +%% Supervisor callbacks -export([init/1]). %%%========================================================================= +%%% External functions +%%%========================================================================= +start_link() -> + supervisor:start_link({local, ?MODULE}, ?MODULE, []). + +%%%========================================================================= %%% Supervisor callback %%%========================================================================= init([]) -> diff --git a/lib/inets/src/inets_app/inets_trace.erl b/lib/inets/src/inets_app/inets_trace.erl new file mode 100644 index 0000000000..8911f65897 --- /dev/null +++ b/lib/inets/src/inets_app/inets_trace.erl @@ -0,0 +1,357 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2011-2012. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% +%% +%%---------------------------------------------------------------------- +%% Purpose: Module for debug trace functions of the inets application +%%---------------------------------------------------------------------- + +-module(inets_trace). + +%% API +-export([enable/2, enable/3, + disable/0, + set_level/1, set_level/2, + report_event/4]). + + +%%==================================================================== +%% API +%%==================================================================== + +%%----------------------------------------------------------------- +%% enable(Level, Destination) -> void() +%% enable(Level, Destination, Service) -> void() +%% +%% Parameters: +%% Level -> max | min | integer() +%% Destination -> File | Port | io | HandlerSpec +%% Service -> httpc | httpd | ftpc | tftp | all +%% File -> string() +%% Port -> integer() +%% Verbosity -> true | false +%% HandlerSpec = {function(), Data} +%% Data = term() +%% +%% Description: +%% This function is used to start tracing at level Level and send +%% the result either to the file File, the port Port or to a +%% trace handler. +%% Note that it starts a tracer server. +%% When Destination is the atom io (or the tuple {io, Verbosity}), +%% all (printable) inets trace events (trace_ts events which has +%% Severity withing Limit) will be written to stdout using io:format. +%% +%%----------------------------------------------------------------- +enable(Level, Dest) -> + enable(Level, Dest, all). + +enable(Level, Dest, Service) -> + case valid_trace_service(Service) of + true -> + enable2(Level, Dest, Service); + false -> + {error, {invalid_service, Service}} + end. + +enable2(Level, File, Service) + when is_list(File) -> + case file:open(File, [write]) of + {ok, Fd} -> + HandleSpec = {fun handle_trace/2, {Service, Fd}}, + do_enable(Level, process, HandleSpec); + Err -> + Err + end; +enable2(Level, Port, _) when is_integer(Port) -> + do_enable(Level, port, dbg:trace_port(ip, Port)); +enable2(Level, io, Service) -> + HandleSpec = {fun handle_trace/2, {Service, standard_io}}, + do_enable(Level, process, HandleSpec); +enable2(Level, {Fun, _Data} = HandleSpec, _) when is_function(Fun) -> + do_enable(Level, process, HandleSpec). + +do_enable(Level, Type, HandleSpec) -> + case dbg:tracer(Type, HandleSpec) of + {ok, _} -> + set_level(Level), + ok; + Error -> + Error + end. + +valid_trace_service(all) -> + true; +valid_trace_service(Service) -> + lists:member(Service, [httpc, httpd, ftpc, tftp]). + + +%%----------------------------------------------------------------- +%% disable() -> void() +%% +%% Description: +%% This function is used to stop tracing. +%%----------------------------------------------------------------- + +disable() -> + %% This is to make handle_trace/2 close the output file (if the + %% event gets there before dbg closes) + inets_trace:report_event(100, "stop trace", stop_trace, [stop_trace]), + dbg:stop(). + + + +%%----------------------------------------------------------------- +%% set_level(Level) -> void() +%% +%% Parameters: +%% Level -> max | min | integer() +%% +%% Description: +%% This function is used to change the trace level when tracing has +%% already been started. +%%----------------------------------------------------------------- +set_level(Level) -> + set_level(Level, all). + +set_level(Level, Service) -> + Pat = make_pattern(?MODULE, Service, Level), + change_pattern(Pat). + +make_pattern(Mod, Service, Level) + when is_atom(Mod) andalso is_atom(Service) -> + case Level of + min -> + {Mod, Service, []}; + max -> + Head = ['$1', '_', '_', '_'], + Body = [], + Cond = [], + {Mod, Service, [{Head, Cond, Body}]}; + DetailLevel when is_integer(DetailLevel) -> + Head = ['$1', '_', '_', '_'], + Body = [], + Cond = [{ '=<', '$1', DetailLevel}], + {Mod, Service, [{Head, Cond, Body}]}; + _ -> + exit({bad_level, Level}) + end. + +change_pattern({Mod, Service, Pattern}) + when is_atom(Mod) andalso is_atom(Service) -> + MFA = {Mod, report_event, 4}, + case Pattern of + [] -> + try + error_to_exit(ctp, dbg:ctp(MFA)), + error_to_exit(p, dbg:p(all, clear)) + catch + exit:{Where, Reason} -> + {error, {Where, Reason}} + end; + List when is_list(List) -> + try + error_to_exit(ctp, dbg:ctp(MFA)), + error_to_exit(tp, dbg:tp(MFA, Pattern)), + error_to_exit(p, dbg:p(all, [call, timestamp])) + catch + exit:{Where, Reason} -> + {error, {Where, Reason}} + end + end. + +error_to_exit(_Where, {ok, _} = OK) -> + OK; +error_to_exit(Where, {error, Reason}) -> + exit({Where, Reason}). + + +%%----------------------------------------------------------------- +%% report_event(Severity, Label, Service, Content) +%% +%% Parameters: +%% Severity -> 0 =< integer() =< 100 +%% Label -> string() +%% Service -> httpd | httpc | ftp | tftp +%% Content -> [{tag, term()}] +%% +%% Description: +%% This function is used to generate trace events, that is, +%% put trace on this function. +%%----------------------------------------------------------------- + +report_event(Severity, Label, Service, Content) + when (is_integer(Severity) andalso + (Severity >= 0) andalso (100 >= Severity)) andalso + is_list(Label) andalso + is_atom(Service) andalso + is_list(Content) -> + hopefully_traced. + + +%% ---------------------------------------------------------------------- +%% handle_trace(Event, Fd) -> Verbosity +%% +%% Parameters: +%% Event -> The trace event +%% Fd -> standard_io | file_descriptor() | trace_port() +%% +%% Description: +%% This function is used to "receive" and pretty print the trace events. +%% Events are printed if: +%% - Verbosity is max +%% - Severity is =< Verbosity (e.g. Severity = 30, and Verbosity = 40) +%% Events are not printed if: +%% - Verbosity is min +%% - Severity is > Verbosity +%%----------------------------------------------------------------- + +handle_trace(_, closed_file = Fd) -> + Fd; +handle_trace({trace_ts, _Who, call, + {?MODULE, report_event, + [_Sev, "stop trace", stop_trace, [stop_trace]]}, + Timestamp}, + {_, standard_io} = Fd) -> + (catch io:format(standard_io, "stop trace at ~s~n", [format_timestamp(Timestamp)])), + Fd; +handle_trace({trace_ts, _Who, call, + {?MODULE, report_event, + [_Sev, "stop trace", stop_trace, [stop_trace]]}, + Timestamp}, + standard_io = Fd) -> + (catch io:format(Fd, "stop trace at ~s~n", [format_timestamp(Timestamp)])), + Fd; +handle_trace({trace_ts, _Who, call, + {?MODULE, report_event, + [_Sev, "stop trace", stop_trace, [stop_trace]]}, + Timestamp}, + {_Service, Fd}) -> + (catch io:format(Fd, "stop trace at ~s~n", [format_timestamp(Timestamp)])), + (catch file:close(Fd)), + closed_file; +handle_trace({trace_ts, _Who, call, + {?MODULE, report_event, + [_Sev, "stop trace", stop_trace, [stop_trace]]}, + Timestamp}, + Fd) -> + (catch io:format(Fd, "stop trace at ~s~n", [format_timestamp(Timestamp)])), + (catch file:close(Fd)), + closed_file; +handle_trace({trace_ts, Who, call, + {?MODULE, report_event, + [Sev, Label, Service, Content]}, Timestamp}, + Fd) -> + (catch print_inets_trace(Fd, Sev, Timestamp, Who, + Label, Service, Content)), + Fd; +handle_trace(Event, Fd) -> + (catch print_trace(Fd, Event)), + Fd. + + +print_inets_trace({Service, Fd}, + Sev, Timestamp, Who, Label, Service, Content) -> + do_print_inets_trace(Fd, Sev, Timestamp, Who, Label, Service, Content); +print_inets_trace({ServiceA, Fd}, + Sev, Timestamp, Who, Label, ServiceB, Content) + when (ServiceA =:= all) -> + do_print_inets_trace(Fd, Sev, Timestamp, Who, Label, ServiceB, Content); +print_inets_trace({ServiceA, _Fd}, + _Sev, _Timestamp, _Who, _Label, ServiceB, _Content) + when ServiceA =/= ServiceB -> + ok; +print_inets_trace(Fd, Sev, Timestamp, Who, Label, Service, Content) -> + do_print_inets_trace(Fd, Sev, Timestamp, Who, Label, Service, Content). + +do_print_inets_trace(Fd, Sev, Timestamp, Who, Label, Service, Content) -> + Ts = format_timestamp(Timestamp), + io:format(Fd, "[inets ~w trace ~w ~w ~s] ~s " + "~n Content: ~p" + "~n", + [Service, Sev, Who, Ts, Label, Content]). + +print_trace({_, Fd}, Event) -> + do_print_trace(Fd, Event); +print_trace(Fd, Event) -> + do_print_trace(Fd, Event). + +do_print_trace(Fd, {trace, Who, What, Where}) -> + io:format(Fd, "[trace]" + "~n Who: ~p" + "~n What: ~p" + "~n Where: ~p" + "~n", [Who, What, Where]); + +do_print_trace(Fd, {trace, Who, What, Where, Extra}) -> + io:format(Fd, "[trace]" + "~n Who: ~p" + "~n What: ~p" + "~n Where: ~p" + "~n Extra: ~p" + "~n", [Who, What, Where, Extra]); + +do_print_trace(Fd, {trace_ts, Who, What, Where, When}) -> + Ts = format_timestamp(When), + io:format(Fd, "[trace ~s]" + "~n Who: ~p" + "~n What: ~p" + "~n Where: ~p" + "~n", [Ts, Who, What, Where]); + +do_print_trace(Fd, {trace_ts, Who, What, Where, Extra, When}) -> + Ts = format_timestamp(When), + io:format(Fd, "[trace ~s]" + "~n Who: ~p" + "~n What: ~p" + "~n Where: ~p" + "~n Extra: ~p" + "~n", [Ts, Who, What, Where, Extra]); + +do_print_trace(Fd, {seq_trace, What, Where}) -> + io:format(Fd, "[seq trace]" + "~n What: ~p" + "~n Where: ~p" + "~n", [What, Where]); + +do_print_trace(Fd, {seq_trace, What, Where, When}) -> + Ts = format_timestamp(When), + io:format(Fd, "[seq trace ~s]" + "~n What: ~p" + "~n Where: ~p" + "~n", [Ts, What, Where]); + +do_print_trace(Fd, {drop, Num}) -> + io:format(Fd, "[drop trace] ~p~n", [Num]); + +do_print_trace(Fd, Trace) -> + io:format(Fd, "[trace] " + "~n ~p" + "~n", [Trace]). + + +format_timestamp({_N1, _N2, N3} = Now) -> + {Date, Time} = calendar:now_to_datetime(Now), + {YYYY,MM,DD} = Date, + {Hour,Min,Sec} = Time, + FormatDate = + io_lib:format("~.4w:~.2.0w:~.2.0w ~.2.0w:~.2.0w:~.2.0w 4~w", + [YYYY,MM,DD,Hour,Min,Sec,round(N3/1000)]), + lists:flatten(FormatDate). + + diff --git a/lib/inets/test/httpc_SUITE.erl b/lib/inets/test/httpc_SUITE.erl index 881266b70a..a116edef77 100644 --- a/lib/inets/test/httpc_SUITE.erl +++ b/lib/inets/test/httpc_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2011. All Rights Reserved. +%% Copyright Ericsson AB 2004-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -146,6 +146,20 @@ groups() -> ]. +init_per_group(ipv6 = _GroupName, Config) -> + case inets_test_lib:has_ipv6_support() of + {ok, _} -> + Config; + _ -> + {skip, "Host does not support IPv6"} + end; +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + %%-------------------------------------------------------------------- %% Function: init_per_suite(Config) -> Config %% Config - [tuple()] @@ -156,6 +170,9 @@ groups() -> %% variable, but should NOT alter/remove any existing entries. %%-------------------------------------------------------------------- init_per_suite(Config) -> + + ?PRINT_SYSTEM_INFO([]), + PrivDir = ?config(priv_dir, Config), DataDir = ?config(data_dir, Config), ServerRoot = filename:join(PrivDir, "server_root"), @@ -179,10 +196,11 @@ init_per_suite(Config) -> {ok, FileInfo} = file:read_file_info(Cgi), ok = file:write_file_info(Cgi, FileInfo#file_info{mode = 8#00755}), - [{server_root, ServerRoot}, - {doc_root, DocRoot}, - {local_port, ?IP_PORT}, - {local_ssl_port, ?SSL_PORT} | Config]. + [{has_ipv6_support, inets_test_lib:has_ipv6_support()}, + {server_root, ServerRoot}, + {doc_root, DocRoot}, + {local_port, ?IP_PORT}, + {local_ssl_port, ?SSL_PORT} | Config]. %%-------------------------------------------------------------------- @@ -198,6 +216,7 @@ end_per_suite(Config) -> application:stop(ssl), ok. + %%-------------------------------------------------------------------- %% Function: init_per_testcase(Case, Config) -> Config %% Case - atom() @@ -229,12 +248,12 @@ init_per_testcase(initial_server_connect = Case, Config) -> "~n ~p", [Case, App, ActualError]), SkipString = "Could not start " ++ atom_to_list(App), - {skip, SkipString}; + skip(SkipString); _:X -> SkipString = lists:flatten( io_lib:format("Failed starting apps: ~p", [X])), - {skip, SkipString} + skip(SkipString) end; init_per_testcase(Case, Config) -> @@ -244,6 +263,7 @@ init_per_testcase(Case, Timeout, Config) -> io:format(user, "~n~n*** INIT ~w:~w[~w] ***" "~n~n", [?MODULE, Case, Timeout]), + PrivDir = ?config(priv_dir, Config), application:stop(inets), Dog = test_server:timetrap(inets_test_lib:minutes(Timeout)), @@ -337,7 +357,8 @@ init_per_testcase(Case, Timeout, Config) -> inets:start(httpc, [{profile, Profile}, {data_dir, PrivDir}], stand_alone), - httpc:set_options([{ipfamily, inet6}], ProfilePid), + ok = httpc:set_options([{ipfamily, inet6}], + ProfilePid), tsp("httpc profile pid: ~p", [ProfilePid]), [{watchdog, Dog}, {profile, ProfilePid}| TmpConfig] catch @@ -346,27 +367,67 @@ init_per_testcase(Case, Timeout, Config) -> "~n ~p", [Case, App, ActualError]), SkipString = "Could not start " ++ atom_to_list(App), - {skip, SkipString}; + skip(SkipString); _:X -> SkipString = lists:flatten( io_lib:format("Failed starting apps: ~p", [X])), - {skip, SkipString} + skip(SkipString) end; _ -> + %% Try inet6fb4 on windows... + %% No need? Since it is set above? + + %% tsp("init_per_testcase -> allways try IPv6 on windows"), + %% ?RUN_ON_WINDOWS( + %% fun() -> + %% tsp("init_per_testcase:set_options_fun -> " + %% "set-option ipfamily to inet6fb4"), + %% Res = httpc:set_options([{ipfamily, inet6fb4}]), + %% tsp("init_per_testcase:set_options_fun -> " + %% "~n Res: ~p", [Res]), + %% Res + %% end), + TmpConfig2 = lists:keydelete(local_server, 1, TmpConfig), %% Will start inets + tsp("init_per_testcase -> try start server"), Server = start_http_server(PrivDir, IpConfFile), [{watchdog, Dog}, {local_server, Server} | TmpConfig2] end, + %% <IPv6> + %% Set default ipfamily to the same as the main server has by default + %% This makes the client try w/ ipv6 before falling back to ipv4, + %% as that is what the server is configured to do. + %% Note that this is required for the tests to run on *BSD w/ ipv6 enabled + %% as well as on Windows. The Linux behaviour of allowing ipv4 connects + %% to ipv6 sockets is not required or even encouraged. + + tsp("init_per_testcase -> Options before ipfamily set: ~n~p", + [httpc:get_options(all)]), + ok = httpc:set_options([{ipfamily, inet6fb4}]), + tsp("init_per_testcase -> Options after ipfamily set: ~n~p", + [httpc:get_options(all)]), + + %% Note that the IPv6 test case(s) *must* use inet6, + %% so this value will be overwritten (see "ipv6_" below). + %% </IPv6> + %% This will fail for the ipv6_ - cases (but that is ok) ProxyExceptions = ["localhost", ?IPV6_LOCAL_HOST], - httpc:set_options([{proxy, {{?PROXY, ?PROXY_PORT}, ProxyExceptions}}]), + tsp("init_per_testcase -> Options before proxy set: ~n~p", + [httpc:get_options(all)]), + ok = httpc:set_options([{proxy, {{?PROXY, ?PROXY_PORT}, ProxyExceptions}}]), + tsp("init_per_testcase -> Options after proxy set: ~n~p", + [httpc:get_options(all)]), inets:enable_trace(max, io, httpc), %% inets:enable_trace(max, io, all), %% snmp:set_trace([gen_tcp]), + tsp("init_per_testcase(~w) -> done when" + "~n NewConfig: ~p" + "~n~n", [Case, NewConfig]), NewConfig. @@ -405,6 +466,7 @@ end_per_testcase(http_save_to_file = Case, Config) -> end_per_testcase(Case, Config) -> io:format(user, "~n~n*** END ~w:~w ***~n~n", [?MODULE, Case]), + dbg:stop(), % ? case atom_to_list(Case) of "ipv6_" ++ _Rest -> tsp("end_per_testcase(~w) -> stop ssl", [Case]), @@ -449,29 +511,39 @@ http_options(doc) -> http_options(suite) -> []; http_options(Config) when is_list(Config) -> - {skip, "Not supported by httpd"}. + skip("Not supported by httpd"). http_head(doc) -> ["Test http head request against local server."]; http_head(suite) -> []; http_head(Config) when is_list(Config) -> - case ?config(local_server, Config) of - ok -> - Port = ?config(local_port, Config), - URL = ?URL_START ++ integer_to_list(Port) ++ "/dummy.html", - case httpc:request(head, {URL, []}, [], []) of - {ok, {{_,200,_}, [_ | _], []}} -> - ok; - {ok, WrongReply} -> - tsf({wrong_reply, WrongReply}); - Error -> - tsf({failed, Error}) - end; - _ -> - {skip, "Failed to start local http-server"} - end. + tsp("http_head -> entry with" + "~n Config: ~p", [Config]), + Method = head, + Port = ?config(local_port, Config), + URL = ?URL_START ++ integer_to_list(Port) ++ "/dummy.html", + Request = {URL, []}, + HttpOpts = [], + Opts = [], + VerifyResult = + fun({ok, {{_,200,_}, [_ | _], []}}) -> + ok; + ({ok, UnexpectedReply}) -> + tsp("http_head:verify_fun -> Unexpected Reply: " + "~n ~p", [UnexpectedReply]), + tsf({unexpected_reply, UnexpectedReply}); + ({error, Reason} = Error) -> + tsp("http_head:verify_fun -> Error reply: " + "~n Reason: ~p", [Reason]), + tsf({bad_reply, Error}) + end, + simple_request_and_verify(Config, + Method, Request, HttpOpts, Opts, VerifyResult). + + %%------------------------------------------------------------------------- + http_get(doc) -> ["Test http get request against local server"]; http_get(suite) -> @@ -488,7 +560,8 @@ http_get(Config) when is_list(Config) -> Request = {URL, []}, Timeout = timer:seconds(1), ConnTimeout = Timeout + timer:seconds(1), - HttpOptions1 = [{timeout, Timeout}, {connect_timeout, ConnTimeout}], + HttpOptions1 = [{timeout, Timeout}, + {connect_timeout, ConnTimeout}], Options1 = [], Body = case httpc:request(Method, Request, HttpOptions1, Options1) of @@ -516,14 +589,15 @@ http_get(Config) when is_list(Config) -> tsf({bad_reply, Error2}) end; _ -> - {skip, "Failed to start local http-server"} + skip("Failed to start local http-server") end. %%------------------------------------------------------------------------- + http_post(doc) -> - ["Test http post request against local server. We do in this case" - " only care about the client side of the the post. The server" - " script will not actually use the post data."]; + ["Test http post request against local server. We do in this case " + "only care about the client side of the the post. The server " + "script will not actually use the post data."]; http_post(suite) -> []; http_post(Config) when is_list(Config) -> @@ -551,7 +625,7 @@ http_post(Config) when is_list(Config) -> httpc:request(post, {URL, [{"expect","100-continue"}], "text/plain", "foobar"}, [], []); _ -> - {skip, "Failed to start local http-server"} + skip("Failed to start local http-server") end. %%------------------------------------------------------------------------- @@ -597,7 +671,7 @@ http_post_streaming(Config) when is_list(Config) -> "text/plain", {BodyFun, 10}}, [], []); _ -> - {skip, "Failed to start local http-server"} + skip("Failed to start local http-server") end. @@ -621,7 +695,7 @@ http_emulate_lower_versions(Config) when is_list(Config) -> httpc:request(get, {URL, []}, [{version, "HTTP/1.1"}], []), inets_test_lib:check_body(Body2); _-> - {skip, "Failed to start local http-server"} + skip("Failed to start local http-server") end. @@ -682,7 +756,7 @@ http_inets_pipe(Config) when is_list(Config) -> URL = ?URL_START ++ integer_to_list(Port) ++ "/dummy.html", test_pipeline(URL); _ -> - {skip, "Failed to start local http-server"} + skip("Failed to start local http-server") end. @@ -818,7 +892,7 @@ http_trace(Config) when is_list(Config) -> tsf({failed, Error}) end; _ -> - {skip, "Failed to start local http-server"} + skip("Failed to start local http-server") end. %%------------------------------------------------------------------------- http_async(doc) -> @@ -853,7 +927,7 @@ http_async(Config) when is_list(Config) -> ok end; _ -> - {skip, "Failed to start local http-server"} + skip("Failed to start local http-server") end. %%------------------------------------------------------------------------- @@ -874,7 +948,7 @@ http_save_to_file(Config) when is_list(Config) -> {ok, {{_,200,_}, [_ | _], Body}} = httpc:request(URL), Bin == Body; _ -> - {skip, "Failed to start local http-server"} + skip("Failed to start local http-server") end. @@ -904,7 +978,7 @@ http_save_to_file_async(Config) when is_list(Config) -> {ok, {{_,200,_}, [_ | _], Body}} = httpc:request(URL), Bin == Body; _ -> - {skip, "Failed to start local http-server"} + skip("Failed to start local http-server") end. %%------------------------------------------------------------------------- http_headers(doc) -> @@ -961,7 +1035,7 @@ http_headers(Config) when is_list(Config) -> ]}, [], []), ok; _ -> - {skip, "Failed to start local http-server"} + skip("Failed to start local http-server") end. %%------------------------------------------------------------------------- @@ -1096,9 +1170,9 @@ ssl_head(SslTag, Config) -> {ok, {{_,200, _}, [_ | _], []}} = httpc:request(head, {URL, []}, [{ssl, SSLConfig}], []); {ok, _} -> - {skip, "local http-server not started"}; + skip("local http-server not started"); _ -> - {skip, "SSL not started"} + skip("SSL not started") end. @@ -1136,13 +1210,24 @@ ssl_get(SslTag, Config) when is_list(Config) -> "~n URL: ~p" "~n SslTag: ~p" "~n SSLOptions: ~p", [URL, SslTag, SSLOptions]), - {ok, {{_,200, _}, [_ | _], Body = [_ | _]}} = - httpc:request(get, {URL, []}, [{ssl, SSLConfig}], []), - inets_test_lib:check_body(Body); + case httpc:request(get, {URL, []}, [{ssl, SSLConfig}], []) of + {ok, {{_,200, _}, [_ | _], Body = [_ | _]}} -> + inets_test_lib:check_body(Body), + ok; + {ok, {StatusLine, Headers, _Body}} -> + tsp("ssl_get -> unexpected result: " + "~n StatusLine: ~p" + "~n Headers: ~p", [StatusLine, Headers]), + tsf({unexpected_response, StatusLine, Headers}); + {error, Reason} -> + tsp("ssl_get -> request failed: " + "~n Reason: ~p", [Reason]), + tsf({request_failed, Reason}) + end; {ok, _} -> - {skip, "local http-server not started"}; + skip("local http-server not started"); _ -> - {skip, "SSL not started"} + skip("SSL not started") end. @@ -1191,9 +1276,9 @@ ssl_trace(SslTag, Config) when is_list(Config) -> tsf({failed, Error}) end; {ok, _} -> - {skip, "local http-server not started"}; + skip("local http-server not started"); _ -> - {skip, "SSL not started"} + skip("SSL not started") end. @@ -1208,8 +1293,8 @@ http_redirect(Config) when is_list(Config) -> "~n Config: ~p", [Config]), case ?config(local_server, Config) of ok -> - tsp("http_redirect -> set ipfamily option to inet"), - ok = httpc:set_options([{ipfamily, inet}]), + %% tsp("http_redirect -> set ipfamily option to inet"), + %% ok = httpc:set_options([{ipfamily, inet}]), tsp("http_redirect -> start dummy server inet"), {DummyServerPid, Port} = dummy_server(ipv4), @@ -1312,7 +1397,7 @@ http_redirect(Config) when is_list(Config) -> ok; _ -> - {skip, "Failed to start local http-server"} + skip("Failed to start local http-server") end. @@ -1449,7 +1534,7 @@ proxy_options(Config) when is_list(Config) -> tsf({unexpected_result, Unexpected}) end; Reason -> - {skip, Reason} + skip(Reason) end. @@ -1470,7 +1555,7 @@ proxy_head(Config) when is_list(Config) -> tsf({unexpected_result, Unexpected}) end; Reason -> - {skip, Reason} + skip(Reason) end. @@ -1489,7 +1574,7 @@ proxy_get(Config) when is_list(Config) -> tsf({unexpected_result, Unexpected}) end; Reason -> - {skip, Reason} + skip(Reason) end. %%------------------------------------------------------------------------- @@ -1530,12 +1615,13 @@ proxy_emulate_lower_versions(Config) when is_list(Config) -> end; Reason -> - {skip, Reason} + skip(Reason) end. pelv_get(Version) -> httpc:request(get, {?PROXY_URL, []}, [{version, Version}], []). + %%------------------------------------------------------------------------- proxy_trace(doc) -> ["Perform a TRACE request that goes through a proxy."]; @@ -1544,8 +1630,8 @@ proxy_trace(suite) -> proxy_trace(Config) when is_list(Config) -> %%{ok, {{_,200,_}, [_ | _], "TRACE " ++ _}} = %% httpc:request(trace, {?PROXY_URL, []}, [], []), - {skip, "HTTP TRACE is no longer allowed on the ?PROXY_URL server due " - "to security reasons"}. + skip("HTTP TRACE is no longer allowed on the ?PROXY_URL server due " + "to security reasons"). %%------------------------------------------------------------------------- @@ -1568,7 +1654,7 @@ proxy_post(Config) when is_list(Config) -> tsf({unexpected_result, Unexpected}) end; Reason -> - {skip, Reason} + skip(Reason) end. @@ -1593,7 +1679,7 @@ proxy_put(Config) when is_list(Config) -> tsf({unexpected_result, Unexpected}) end; Reason -> - {skip, Reason} + skip(Reason) end. @@ -1618,7 +1704,7 @@ proxy_delete(Config) when is_list(Config) -> tsf({unexpected_result, Unexpected}) end; Reason -> - {skip, Reason} + skip(Reason) end. @@ -1652,9 +1738,10 @@ proxy_headers(Config) when is_list(Config) -> ]}, [], []), ok; Reason -> - {skip, Reason} + skip(Reason) end. + %%------------------------------------------------------------------------- proxy_auth(doc) -> ["Test the code for sending of proxy authorization."]; @@ -1674,7 +1761,7 @@ proxy_auth(Config) when is_list(Config) -> tsf({unexpected_result, Unexpected}) end; Reason -> - {skip, Reason} + skip(Reason) end. @@ -1718,7 +1805,7 @@ proxy_page_does_not_exist(Config) when is_list(Config) -> httpc:request(get, {URL, []}, [], []), ok; Reason -> - {skip, Reason} + skip(Reason) end. @@ -1737,6 +1824,7 @@ proxy_https_not_supported(Config) when is_list(Config) -> tsf({unexpected_reason, Result}) end. + %%------------------------------------------------------------------------- http_stream(doc) -> @@ -1863,7 +1951,7 @@ proxy_stream(Config) when is_list(Config) -> Body == binary_to_list(StreamedBody); Reason -> - {skip, Reason} + skip(Reason) end. @@ -1886,7 +1974,7 @@ parse_url(Config) when is_list(Config) -> http_uri:parse("http://[2010:836B:4179::836B:4179]/foobar.html", [{foo, false}]), {error, - {malformed_url,"http://2010:836B:4179::836B:4179/foobar.html"}} = + {malformed_url, _, "http://2010:836B:4179::836B:4179/foobar.html"}} = http_uri:parse("http://2010:836B:4179::836B:4179/foobar.html"), %% ipv4 @@ -1902,8 +1990,8 @@ parse_url(Config) when is_list(Config) -> http_uri:parse("http://nisse:foobar@localhost:8888/foobar.html"), %% Scheme error - {error,no_scheme} = http_uri:parse("localhost/foobar.html"), - {error,{not_supported_scheme,localhost}} = + {error, no_scheme} = http_uri:parse("localhost/foobar.html"), + {error, {malformed_url, _, _}} = http_uri:parse("localhost:8888/foobar.html"), %% Query @@ -1966,7 +2054,7 @@ ipv6_essl(Config) when is_list(Config) -> ipv6(SocketType, Scheme, HTTPOptions, Extra, Config) -> %% Check if we are a IPv6 host - tsp("ipv6 -> verify ipv6 support", []), + tsp("ipv6 -> verify ipv6 support"), case inets_test_lib:has_ipv6_support(Config) of {ok, Addr} -> tsp("ipv6 -> ipv6 supported: ~p", [Addr]), @@ -1997,8 +2085,8 @@ ipv6(SocketType, Scheme, HTTPOptions, Extra, Config) -> end, ok; _ -> - tsp("ipv6 -> ipv6 not supported", []), - {skip, "Host does not support IPv6"} + tsp("ipv6 -> ipv6 not supported"), + skip("Host does not support IPv6") end. @@ -2355,7 +2443,7 @@ options(Config) when is_list(Config) -> = httpc:request(get, {URL, []}, [{timeout, infinity}], [{full_result, false}]); _ -> - {skip, "Failed to start local http-server"} + skip("Failed to start local http-server") end. @@ -2468,7 +2556,7 @@ proxy_not_modified_otp_6821(Config) when is_list(Config) -> undefined -> provocate_not_modified_bug(?PROXY_URL); Reason -> - {skip, Reason} + skip(Reason) end. @@ -2870,7 +2958,7 @@ otp_8106_pid(Config) when is_list(Config) -> ok; _ -> - {skip, "Failed to start local http-server"} + skip("Failed to start local http-server") end. @@ -2890,7 +2978,7 @@ otp_8106_fun(Config) when is_list(Config) -> ok; _ -> - {skip, "Failed to start local http-server"} + skip("Failed to start local http-server") end. @@ -2910,7 +2998,7 @@ otp_8106_mfa(Config) when is_list(Config) -> ok; _ -> - {skip, "Failed to start local http-server"} + skip("Failed to start local http-server") end. @@ -3059,7 +3147,7 @@ otp_8352(Config) when is_list(Config) -> ok; _ -> - {skip, "Failed to start local http-server"} + skip("Failed to start local http-server") end. @@ -3254,7 +3342,11 @@ create_config(FileName, ComType, Port, PrivDir, ServerRoot, DocRoot, " mod_include mod_dir mod_get mod_head" " mod_log mod_disk_log mod_trace", + %% BindAddress = "*|inet", % Force the use of IPv4 + BindAddress = "*", % This corresponds to using IpFamily inet6fb4 + HttpConfig = [ + cline(["BindAddress ", BindAddress]), cline(["Port ", integer_to_list(Port)]), cline(["ServerName ", "httpc_test"]), cline(["SocketType ", atom_to_list(ComType)]), @@ -3813,6 +3905,34 @@ pick_header(Headers, Name) -> Val end. + +%% ------------------------------------------------------------------------- + +simple_request_and_verify(Config, + Method, Request, HttpOpts, Opts, VerifyResult) + when (is_list(Config) andalso + is_atom(Method) andalso + is_list(HttpOpts) andalso + is_list(Opts) andalso + is_function(VerifyResult, 1)) -> + tsp("request_and_verify -> entry with" + "~n Method: ~p" + "~n Request: ~p" + "~n HttpOpts: ~p" + "~n Opts: ~p", [Method, Request, HttpOpts, Opts]), + case ?config(local_server, Config) of + ok -> + tsp("request_and_verify -> local-server running"), + Result = (catch httpc:request(Method, Request, HttpOpts, Opts)), + VerifyResult(Result); + _ -> + tsp("request_and_verify -> local-server *not* running - skip"), + hard_skip("Local http-server not running") + end. + + + + not_implemented_yet() -> exit(not_implemented_yet). @@ -3823,9 +3943,9 @@ p(F, A) -> io:format("~p ~w:" ++ F ++ "~n", [self(), ?MODULE | A]). tsp(F) -> - inets_test_lib:tsp(F). + inets_test_lib:tsp("[~w]" ++ F, [?MODULE]). tsp(F, A) -> - inets_test_lib:tsp(F, A). + inets_test_lib:tsp("[~w]" ++ F, [?MODULE|A]). tsf(Reason) -> test_server:fail(Reason). @@ -3864,6 +3984,8 @@ dummy_ssl_server_hang_loop(_) -> ok end. +hard_skip(Reason) -> + throw(skip(Reason)). skip(Reason) -> {skip, Reason}. diff --git a/lib/inets/test/httpd_SUITE.erl b/lib/inets/test/httpd_SUITE.erl index a4bb8f7159..41e4188e5f 100644 --- a/lib/inets/test/httpd_SUITE.erl +++ b/lib/inets/test/httpd_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2011. All Rights Reserved. +%% Copyright Ericsson AB 2005-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -224,7 +224,8 @@ all() -> ]. groups() -> - [{ip, [], + [ + {ip, [], [ip_mod_alias, ip_mod_actions, ip_mod_security, ip_mod_auth, ip_mod_auth_api, ip_mod_auth_mnesia_api, ip_mod_htaccess, ip_mod_cgi, ip_mod_esi, ip_mod_get, @@ -293,6 +294,14 @@ groups() -> [ticket_5775, ticket_5865, ticket_5913, ticket_6003, ticket_7304]}]. + +init_per_group(ipv6 = _GroupName, Config) -> + case inets_test_lib:has_ipv6_support() of + {ok, _} -> + Config; + _ -> + {skip, "Host does not support IPv6"} + end; init_per_group(_GroupName, Config) -> Config. @@ -314,6 +323,8 @@ init_per_suite(Config) -> "~n Config: ~p" "~n", [Config]), + ?PRINT_SYSTEM_INFO([]), + PrivDir = ?config(priv_dir, Config), SuiteTopDir = filename:join(PrivDir, ?MODULE), case file:make_dir(SuiteTopDir) of @@ -325,10 +336,11 @@ init_per_suite(Config) -> throw({error, {failed_creating_suite_top_dir, Error}}) end, - [{suite_top_dir, SuiteTopDir}, - {node, node()}, - {host, inets_test_lib:hostname()}, - {address, getaddr()} | Config]. + [{has_ipv6_support, inets_test_lib:has_ipv6_support()}, + {suite_top_dir, SuiteTopDir}, + {node, node()}, + {host, inets_test_lib:hostname()}, + {address, getaddr()} | Config]. %%-------------------------------------------------------------------- @@ -363,10 +375,9 @@ init_per_testcase(Case, Config) -> init_per_testcase2(Case, Config) -> - io:format(user, "~w:init_per_testcase2(~w) -> entry with" - "~n Config: ~p" - "~n", [?MODULE, Case, Config]), - + tsp("init_per_testcase2 -> entry with" + "~n Config: ~p", [Config]), + IpNormal = integer_to_list(?IP_PORT) ++ ".conf", IpHtaccess = integer_to_list(?IP_PORT) ++ "htaccess.conf", SslNormal = integer_to_list(?SSL_PORT) ++ ".conf", @@ -375,39 +386,33 @@ init_per_testcase2(Case, Config) -> DataDir = ?config(data_dir, Config), SuiteTopDir = ?config(suite_top_dir, Config), - io:format(user, "~w:init_per_testcase2(~w) -> " - "~n SuiteDir: ~p" - "~n DataDir: ~p" - "~n", [?MODULE, Case, SuiteTopDir, DataDir]), + tsp("init_per_testcase2 -> " + "~n SuiteDir: ~p" + "~n DataDir: ~p", [SuiteTopDir, DataDir]), TcTopDir = filename:join(SuiteTopDir, Case), ?line ok = file:make_dir(TcTopDir), - io:format(user, "~w:init_per_testcase2(~w) -> " - "~n TcTopDir: ~p" - "~n", [?MODULE, Case, TcTopDir]), + tsp("init_per_testcase2 -> " + "~n TcTopDir: ~p", [TcTopDir]), DataSrc = filename:join([DataDir, "server_root"]), ServerRoot = filename:join([TcTopDir, "server_root"]), - io:format(user, "~w:init_per_testcase2(~w) -> " - "~n DataSrc: ~p" - "~n ServerRoot: ~p" - "~n", [?MODULE, Case, DataSrc, ServerRoot]), + tsp("init_per_testcase2 -> " + "~n DataSrc: ~p" + "~n ServerRoot: ~p", [DataSrc, ServerRoot]), ok = file:make_dir(ServerRoot), ok = file:make_dir(filename:join([TcTopDir, "logs"])), NewConfig = [{tc_top_dir, TcTopDir}, {server_root, ServerRoot} | Config], - io:format(user, "~w:init_per_testcase2(~w) -> " - "copy DataSrc to ServerRoot~n", - [?MODULE, Case]), + tsp("init_per_testcase2 -> copy DataSrc to ServerRoot"), inets_test_lib:copy_dirs(DataSrc, ServerRoot), - io:format(user, "~w:init_per_testcase2(~w) -> fix cgi~n", - [?MODULE, Case]), + tsp("init_per_testcase2 -> fix cgi"), EnvCGI = filename:join([ServerRoot, "cgi-bin", "printenv.sh"]), {ok, FileInfo} = file:read_file_info(EnvCGI), ok = file:write_file_info(EnvCGI, @@ -427,16 +432,14 @@ init_per_testcase2(Case, Config) -> FileInfo1#file_info{mode = 8#00755}), %% To be used by IP test cases - io:format(user, "~w:init_per_testcase2(~w) -> ip testcase setups~n", - [?MODULE, Case]), + tsp("init_per_testcase2 -> ip testcase setups"), create_config([{port, ?IP_PORT}, {sock_type, ip_comm} | NewConfig], normal_access, IpNormal), create_config([{port, ?IP_PORT}, {sock_type, ip_comm} | NewConfig], mod_htaccess, IpHtaccess), %% To be used by SSL test cases - io:format(user, "~w:init_per_testcase2(~w) -> ssl testcase setups~n", - [?MODULE, Case]), + tsp("init_per_testcase2 -> ssl testcase setups"), SocketType = case atom_to_list(Case) of [X, $s, $s, $l | _] -> @@ -460,8 +463,7 @@ init_per_testcase2(Case, Config) -> %% when you run the whole test suite due to shortcomings %% of the test server. - io:format(user, "~w:init_per_testcase2(~w) -> " - "maybe generate IPv6 config file(s)", [?MODULE, Case]), + tsp("init_per_testcase2 -> maybe generate IPv6 config file(s)"), NewConfig2 = case atom_to_list(Case) of "ipv6_" ++ _ -> @@ -502,15 +504,15 @@ init_per_testcase2(Case, Config) -> NewConfig end, - io:format(user, "~w:init_per_testcase2(~w) -> done~n", - [?MODULE, Case]), + tsp("init_per_testcase2 -> done when" + "~n NewConfig2: ~p", [NewConfig2]), NewConfig2. init_per_testcase3(Case, Config) -> - io:format(user, "~w:init_per_testcase3(~w) -> entry with" - "~n Config: ~p", [?MODULE, Case, Config]), + tsp("init_per_testcase3(~w) -> entry with" + "~n Config: ~p", [Case, Config]), %% %% Create a new fresh node to be used by the server in this test-case @@ -532,12 +534,10 @@ init_per_testcase3(Case, Config) -> %% Set trace level case lists:reverse(atom_to_list(Case)) of "tset_emit" ++ _Rest -> % test-cases ending with time_test - io:format(user, "~w:init_per_testcase3(~w) -> disabling trace", - [?MODULE, Case]), + tsp("init_per_testcase3(~w) -> disabling trace", [Case]), inets:disable_trace(); _ -> - io:format(user, "~w:init_per_testcase3(~w) -> enabling trace", - [?MODULE, Case]), + tsp("init_per_testcase3(~w) -> enabling trace", [Case]), %% TraceLevel = 70, TraceLevel = max, TraceDest = io, @@ -545,8 +545,7 @@ init_per_testcase3(Case, Config) -> end, %% Start initialization - io:format(user, "~w:init_per_testcase3(~w) -> start init", - [?MODULE, Case]), + tsp("init_per_testcase3(~w) -> start init", [Case]), Dog = test_server:timetrap(inets_test_lib:minutes(10)), @@ -627,26 +626,32 @@ init_per_testcase3(Case, Config) -> end end, - case CaseRest of - {skip, _} = Skip -> - Skip; - "mod_auth_" ++ _ -> - start_mnesia(?config(node, Config)), - [{watchdog, Dog} | NewConfig]; - "mod_htaccess" -> - ServerRoot = ?config(server_root, Config), - Path = filename:join([ServerRoot, "htdocs"]), - catch remove_htaccess(Path), - create_htaccess_data(Path, ?config(address, Config)), - [{watchdog, Dog} | NewConfig]; - "range" -> - ServerRoot = ?config(server_root, Config), - Path = filename:join([ServerRoot, "htdocs"]), - create_range_data(Path), - [{watchdog, Dog} | NewConfig]; - _ -> - [{watchdog, Dog} | NewConfig] - end. + InitRes = + case CaseRest of + {skip, _} = Skip -> + Skip; + "mod_auth_" ++ _ -> + start_mnesia(?config(node, Config)), + [{watchdog, Dog} | NewConfig]; + "mod_htaccess" -> + ServerRoot = ?config(server_root, Config), + Path = filename:join([ServerRoot, "htdocs"]), + catch remove_htaccess(Path), + create_htaccess_data(Path, ?config(address, Config)), + [{watchdog, Dog} | NewConfig]; + "range" -> + ServerRoot = ?config(server_root, Config), + Path = filename:join([ServerRoot, "htdocs"]), + create_range_data(Path), + [{watchdog, Dog} | NewConfig]; + _ -> + [{watchdog, Dog} | NewConfig] + end, + + tsp("init_per_testcase3(~w) -> done when" + "~n InitRes: ~p", [Case, InitRes]), + + InitRes. %%-------------------------------------------------------------------- @@ -664,16 +669,14 @@ end_per_testcase(Case, Config) -> ok. end_per_testcase2(Case, Config) -> - io:format(user, "~w:end_per_testcase2(~w) -> entry with" - "~n Config: ~p~n", - [?MODULE, Case, Config]), + tsp("end_per_testcase2(~w) -> entry with" + "~n Config: ~p", [Case, Config]), application:unset_env(inets, services), application:stop(inets), application:stop(ssl), application:stop(crypto), % used by the new ssl (essl test cases) cleanup_mnesia(), - io:format(user, "~w:end_per_testcase2(~w) -> done~n", - [?MODULE, Case]), + tsp("end_per_testcase2(~w) -> done", [Case]), ok. @@ -2354,32 +2357,33 @@ create_config(Config, Access, FileName) -> true -> [] end, - ModOrder = case Access of - mod_htaccess -> - "Modules mod_alias mod_htaccess mod_auth " - "mod_security " - "mod_responsecontrol mod_trace mod_esi " - "mod_actions mod_cgi mod_include mod_dir " - "mod_range mod_get " - "mod_head mod_log mod_disk_log"; - _ -> - "Modules mod_alias mod_auth mod_security " - "mod_responsecontrol mod_trace mod_esi " - "mod_actions mod_cgi mod_include mod_dir " + ModOrder = + case Access of + mod_htaccess -> + "Modules mod_alias mod_htaccess mod_auth " + "mod_security " + "mod_responsecontrol mod_trace mod_esi " + "mod_actions mod_cgi mod_include mod_dir " + "mod_range mod_get " + "mod_head mod_log mod_disk_log"; + _ -> + "Modules mod_alias mod_auth mod_security " + "mod_responsecontrol mod_trace mod_esi " + "mod_actions mod_cgi mod_include mod_dir " "mod_range mod_get " - "mod_head mod_log mod_disk_log" - end, + "mod_head mod_log mod_disk_log" + end, -%% The test suite currently does not handle an explicit BindAddress. -%% They assume any has been used, that is Addr is always set to undefined! + %% The test suite currently does not handle an explicit BindAddress. + %% They assume any has been used, that is Addr is always set to undefined! -%% {ok, Hostname} = inet:gethostname(), -%% {ok, Addr} = inet:getaddr(Hostname, inet6), -%% AddrStr = make_ipv6(Addr), -%% BindAddress = lists:flatten(io_lib:format("~s|inet6", [AddrStr])), + %% {ok, Hostname} = inet:gethostname(), + %% {ok, Addr} = inet:getaddr(Hostname, inet6), + %% AddrStr = make_ipv6(Addr), + %% BindAddress = lists:flatten(io_lib:format("~s|inet6", [AddrStr])), - %% BindAddress = "*|inet", - BindAddress = "*", + BindAddress = "*|inet", + %% BindAddress = "*", HttpConfig = [ cline(["Port ", integer_to_list(Port)]), @@ -2770,10 +2774,10 @@ create_ipv6_config(Config, FileName, Ipv6Address) -> ok = file:close(Fd). -%% tsp(F) -> -%% inets_test_lib:tsp(F). +tsp(F) -> + inets_test_lib:tsp("[~w]" ++ F, [?MODULE]). tsp(F, A) -> - inets_test_lib:tsp(F, A). + inets_test_lib:tsp("[~w]" ++ F, [?MODULE|A]). tsf(Reason) -> inets_test_lib:tsf(Reason). diff --git a/lib/inets/test/httpd_basic_SUITE.erl b/lib/inets/test/httpd_basic_SUITE.erl index 4cd38f2ec4..7a476ea14a 100644 --- a/lib/inets/test/httpd_basic_SUITE.erl +++ b/lib/inets/test/httpd_basic_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2011. All Rights Reserved. +%% Copyright Ericsson AB 2007-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -20,6 +20,8 @@ -module(httpd_basic_SUITE). -include_lib("common_test/include/ct.hrl"). +-include("inets_test_lib.hrl"). + %% Note: This directive should only be used in test suites. -compile(export_all). @@ -184,6 +186,15 @@ escaped_url_in_error_body(doc) -> escaped_url_in_error_body(suite) -> []; escaped_url_in_error_body(Config) when is_list(Config) -> + %% <CONDITIONAL-SKIP> + %% This skip is due to a problem on windows with long path's + %% If a path is too long file:open fails with, for example, eio. + %% Until that problem is fixed, we skip this case... + Skippable = [win32], + Condition = fun() -> ?OS_BASED_SKIP(Skippable) end, + ?NON_PC_TC_MAYBE_SKIP(Config, Condition), + %% </CONDITIONAL-SKIP> + tsp("escaped_url_in_error_body -> entry"), HttpdConf = ?config(httpd_conf, Config), {ok, Pid} = inets:start(httpd, [{port, 0} | HttpdConf]), @@ -192,6 +203,7 @@ escaped_url_in_error_body(Config) when is_list(Config) -> _Address = proplists:get_value(bind_address, Info), %% Request 1 + tss(1000), tsp("escaped_url_in_error_body -> request 1"), URL1 = ?URL_START ++ integer_to_list(Port), %% Make sure the server is ok, by making a request for a valid page @@ -202,11 +214,12 @@ escaped_url_in_error_body(Config) when is_list(Config) -> {ok, {200, _}} -> %% Don't care about the the body, just that we get a ok response ok; - {ok, UnexpectedOK1} -> - tsf({unexpected_ok_1, UnexpectedOK1}) + {ok, {StatusCode1, Body1}} -> + tsf({unexpected_ok_1, StatusCode1, Body1}) end, %% Request 2 + tss(1000), tsp("escaped_url_in_error_body -> request 2"), %% Make sure the server is ok, by making a request for a valid page case httpc:request(get, {URL1 ++ "/dummy.html", []}, @@ -216,11 +229,12 @@ escaped_url_in_error_body(Config) when is_list(Config) -> {ok, {200, _}} -> %% Don't care about the the body, just that we get a ok response ok; - {ok, UnexpectedOK2} -> - tsf({unexpected_ok_2, UnexpectedOK2}) + {ok, {StatusCode2, Body2}} -> + tsf({unexpected_ok_2, StatusCode2, Body2}) end, %% Request 3 + tss(1000), tsp("escaped_url_in_error_body -> request 3"), %% Ask for a non-existing page(1) Path = "/<b>this_is_bold<b>", @@ -238,10 +252,11 @@ escaped_url_in_error_body(Config) when is_list(Config) -> tsf({unexpected_path_3, HTMLEncodedPath, BadPath3}) end; {ok, UnexpectedOK3} -> - tsf({unexpected_ok_1, UnexpectedOK3}) + tsf({unexpected_ok_3, UnexpectedOK3}) end, %% Request 4 + tss(1000), tsp("escaped_url_in_error_body -> request 4"), %% Ask for a non-existing page(2) case httpc:request(get, {URL2, []}, @@ -253,11 +268,12 @@ escaped_url_in_error_body(Config) when is_list(Config) -> HTMLEncodedPath -> ok; BadPath4 -> - tsf({unexpected_path_2, HTMLEncodedPath, BadPath4}) + tsf({unexpected_path_4, HTMLEncodedPath, BadPath4}) end; {ok, UnexpectedOK4} -> tsf({unexpected_ok_4, UnexpectedOK4}) end, + tss(1000), tsp("escaped_url_in_error_body -> stop inets"), inets:stop(httpd, Pid), tsp("escaped_url_in_error_body -> done"), @@ -277,7 +293,12 @@ tsp(F, A) -> inets_test_lib:tsp(F, A). tsf(Reason) -> - test_server:fail(Reason). + inets_test_lib:tsf(Reason). + +tss(Time) -> + inets_test_lib:tss(Time). + + skip(Reason) -> diff --git a/lib/inets/test/httpd_mod.erl b/lib/inets/test/httpd_mod.erl index 5016cdb9e6..cb1214b7fb 100644 --- a/lib/inets/test/httpd_mod.erl +++ b/lib/inets/test/httpd_mod.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2011. All Rights Reserved. +%% Copyright Ericsson AB 2005-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -39,14 +39,10 @@ %% Test cases starts here. %%------------------------------------------------------------------------- alias(Type, Port, Host, Node) -> -%% io:format(user, "~w:alias -> entry with" -%% "~n Type: ~p" -%% "~n Port: ~p" -%% "~n Host: ~p" -%% "~n Node: ~p" -%% "~n", [?MODULE, Type, Port, Host, Node]), - - ok = httpd_test_lib:verify_request(Type, Host, Port, Node, + %% This is very crude, but... + tsp("alias -> Has IPv6 support: ~p", [inets_test_lib:has_ipv6_support()]), + Opts = [], + ok = httpd_test_lib:verify_request(Type, Host, Port, Opts, Node, "GET /pics/icon.sheet.gif " "HTTP/1.0\r\n\r\n", [{statuscode, 200}, @@ -55,7 +51,7 @@ alias(Type, Port, Host, Node) -> {header, "Date"}, {version, "HTTP/1.0"}]), - ok = httpd_test_lib:verify_request(Type, Host, Port, Node, + ok = httpd_test_lib:verify_request(Type, Host, Port, Opts, Node, "GET / HTTP/1.0\r\n\r\n", [{statuscode, 200}, {header, "Content-Type","text/html"}, @@ -63,7 +59,7 @@ alias(Type, Port, Host, Node) -> {header, "Date"}, {version, "HTTP/1.0"}]), - ok = httpd_test_lib:verify_request(Type,Host,Port,Node, + ok = httpd_test_lib:verify_request(Type, Host, Port, Opts, Node, "GET /misc/ HTTP/1.0\r\n\r\n", [{statuscode, 200}, {header, "Content-Type","text/html"}, @@ -71,8 +67,8 @@ alias(Type, Port, Host, Node) -> {header, "Date"}, {version, "HTTP/1.0"}]), - %% Check redirection if trailing slash is missing. - ok = httpd_test_lib:verify_request(Type,Host,Port,Node, + %% Check redirection if trailing slash is missing. + ok = httpd_test_lib:verify_request(Type, Host, Port, Opts, Node, "GET /misc HTTP/1.0\r\n\r\n", [{statuscode, 301}, {header, "Location"}, @@ -1032,9 +1028,10 @@ check_lists_members1(L1,L2) -> %% tsp(F) -> -%% tsp(F, []). -%% tsp(F, A) -> -%% test_server:format("~p ~p:" ++ F ++ "~n", [self(), ?MODULE | A]). +%% inets_test_lib:tsp(F). +tsp(F, A) -> + inets_test_lib:tsp(F, A). + tsf(Reason) -> test_server:fail(Reason). diff --git a/lib/inets/test/httpd_test_lib.erl b/lib/inets/test/httpd_test_lib.erl index 2f5867559a..3e1213376d 100644 --- a/lib/inets/test/httpd_test_lib.erl +++ b/lib/inets/test/httpd_test_lib.erl @@ -79,19 +79,19 @@ %%-------------------------------------------------------------------- %% API %%------------------------------------------------------------------ + verify_request(SocketType, Host, Port, Node, RequestStr, Options) -> - verify_request(SocketType, Host, Port, Node, RequestStr, - Options, 30000). + verify_request(SocketType, Host, Port, Node, RequestStr, Options, 30000). + verify_request(SocketType, Host, Port, TranspOpts, Node, RequestStr, Options) when is_list(TranspOpts) -> - verify_request(SocketType, Host, Port, TranspOpts, Node, RequestStr, - Options, 30000); + verify_request(SocketType, Host, Port, TranspOpts, Node, RequestStr, Options, 30000); + verify_request(SocketType, Host, Port, Node, RequestStr, Options, TimeOut) when (is_integer(TimeOut) orelse (TimeOut =:= infinity)) -> - verify_request(SocketType, Host, Port, [], Node, RequestStr, - Options, TimeOut). -verify_request(SocketType, Host, Port, TranspOpts, Node, RequestStr, - Options, TimeOut) -> + verify_request(SocketType, Host, Port, [], Node, RequestStr, Options, TimeOut). + +verify_request(SocketType, Host, Port, TranspOpts, Node, RequestStr, Options, TimeOut) -> tsp("verify_request -> entry with" "~n SocketType: ~p" "~n Host: ~p" @@ -101,7 +101,7 @@ verify_request(SocketType, Host, Port, TranspOpts, Node, RequestStr, "~n Options: ~p" "~n TimeOut: ~p", [SocketType, Host, Port, TranspOpts, Node, Options, TimeOut]), - case (catch inets_test_lib:connect_bin(SocketType, Host, Port, TranspOpts)) of + try inets_test_lib:connect_bin(SocketType, Host, Port, TranspOpts) of {ok, Socket} -> tsp("verify_request -> connected - now send message"), SendRes = inets_test_lib:send(SocketType, Socket, RequestStr), @@ -117,25 +117,37 @@ verify_request(SocketType, Host, Port, TranspOpts, Node, RequestStr, case request(State#state{request = RequestStr, socket = Socket}, TimeOut) of {error, Reason} -> - tsp("request failed: " + tsp("verify_request -> request failed: " "~n Reason: ~p", [Reason]), {error, Reason}; NewState -> - tsp("validate reply: " + tsp("verify_request -> validate reply: " "~n NewState: ~p", [NewState]), ValidateResult = validate(RequestStr, NewState, Options, Node, Port), - tsp("validation result: " + tsp("verify_request -> validation result: " "~n ~p", [ValidateResult]), inets_test_lib:close(SocketType, Socket), ValidateResult end; ConnectError -> - tsp("verify_request -> connect failed: " + tsp("verify_request -> connect error: " "~n ~p" "~n", [ConnectError]), - tsf({connect_failure, ConnectError}) + tsf({connect_error, ConnectError, + [SocketType, Host, Port, TranspOpts]}) + catch + T:E -> + tsp("verify_request -> connect failed: " + "~n E: ~p" + "~n T: ~p" + "~n", [E, T]), + tsf({connect_failure, + [{type, T}, + {error, E}, + {stacktrace, erlang:get_stacktrace()}, + {args, [SocketType, Host, Port, TranspOpts]}]}) end. request(#state{mfa = {Module, Function, Args}, diff --git a/lib/inets/test/inets_test_lib.erl b/lib/inets/test/inets_test_lib.erl index bbed35e1f8..c94be796cd 100644 --- a/lib/inets/test/inets_test_lib.erl +++ b/lib/inets/test/inets_test_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2011. All Rights Reserved. +%% Copyright Ericsson AB 2001-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -31,42 +31,48 @@ send/3, close/2]). -export([copy_file/3, copy_files/2, copy_dirs/2, del_dirs/1]). -export([info/4, log/4, debug/4, print/4]). --export([tsp/1, tsp/2, tsf/1]). +-export([tsp/1, tsp/2, tsf/1, tss/1]). -export([check_body/1]). -export([millis/0, millis_diff/2, hours/1, minutes/1, seconds/1, sleep/1]). --export([oscmd/1, has_ipv6_support/1]). +-export([oscmd/1, has_ipv6_support/0, has_ipv6_support/1, print_system_info/1]). +-export([run_on_os/2, run_on_windows/1]). -export([ensure_started/1]). -export([non_pc_tc_maybe_skip/4, os_based_skip/1, skip/3, fail/3]). -export([flush/0]). -export([start_node/1, stop_node/1]). + %% -- Misc os command and stuff +has_ipv6_support() -> + tsp("has_ipv6_support -> no ipv6_hosts config"), + {ok, Hostname} = inet:gethostname(), + case inet:getaddrs(Hostname, inet6) of + {ok, [Addr|_]} when is_tuple(Addr) andalso + (element(1, Addr) =/= 0) -> + %% We actually need to test that the addr can be used, + %% this is done by attempting to create a (tcp) + %% listen socket + tsp("has_ipv6_support -> check Addr: ~p", [Addr]), + case (catch gen_tcp:listen(0, [inet6, {ip, Addr}])) of + {ok, LSock} -> + tsp("has_ipv6_support -> we are ipv6 host"), + gen_tcp:close(LSock), + {ok, Addr}; + _ -> + undefined + end; + _ -> + undefined + end. + has_ipv6_support(Config) -> case lists:keysearch(ipv6_hosts, 1, Config) of false -> %% Do a basic check to se if %% our own host has a working IPv6 address... - tsp("has_ipv6_support -> no ipv6_hosts config"), - {ok, Hostname} = inet:gethostname(), - case inet:getaddrs(Hostname, inet6) of - {ok, [Addr|_]} when is_tuple(Addr) andalso - (element(1, Addr) =/= 0) -> - %% We actually need to test that the addr can be used, - %% this is done by attempting to create a (tcp) - %% listen socket - tsp("has_ipv6_support -> check Addr: ~p", [Addr]), - case (catch gen_tcp:listen(0, [inet6, {ip, Addr}])) of - {ok, LSock} -> - tsp("has_ipv6_support -> we are ipv6 host"), - gen_tcp:close(LSock), - {ok, Addr}; - _ -> - undefined - end; - _ -> - undefined - end; + has_ipv6_support(); + {value, {_, Hosts}} when is_list(Hosts) -> %% Check if our host is in the list of *known* IPv6 hosts tsp("has_ipv6_support -> Hosts: ~p", [Hosts]), @@ -88,6 +94,49 @@ has_ipv6_support(Config) -> oscmd(Cmd) -> string:strip(os:cmd(Cmd), right, $\n). + +print_system_info([]) -> + do_print_system_info("System Info"); +print_system_info(Prefix) when is_list(Prefix) -> + NewPrefix = lists:flatten(io_lib:format("~s: System Info", [Prefix])), + do_print_system_info(NewPrefix). + +do_print_system_info(Prefix) -> + tsp("~s => " + "~n" + "~n OS Type: ~p" + "~n OS version: ~p" + "~n Sys Arch: ~p" + "~n CPU Topology: ~p" + "~n Num logical procs: ~p" + "~n SMP support: ~p" + "~n Num schedulers: ~p" + "~n Scheduler bindings: ~p" + "~n Wordsize: ~p" + "~n~n", [Prefix, + os:type(), os:version(), + erlang:system_info(system_architecture), + erlang:system_info(cpu_topology), + erlang:system_info(logical_processors), + erlang:system_info(smp_support), + erlang:system_info(schedulers), + erlang:system_info(scheduler_bindings), + erlang:system_info(wordsize)]), + ok. + + +run_on_windows(Fun) -> + run_on_os(windows, Fun). + +run_on_os(windows, Fun) -> + case os:type() of + {win32, _} -> + Fun(); + _ -> + ok + end. + + %% -- Misc node operation wrapper functions -- start_node(Name) -> @@ -156,6 +205,17 @@ do_ensure_started(App, Start) when is_function(Start) -> end. +ensure_loaded(App) -> + case application:load(App) of + ok -> + ok; + {error, {already_loaded,inets}} -> + ok; + Error -> + Error + end. + + %% ---------------------------------------------------------------- %% HTTPD starter functions @@ -165,8 +225,9 @@ start_http_server(Conf) -> start_http_server(Conf, ?HTTP_DEFAULT_SSL_KIND). start_http_server(Conf, essl = _SslTag) -> - tsp("start_http_server(essl) -> entry - try start crypto and public_key"), + tsp("start_http_server(essl) -> try start crypto"), application:start(crypto), + tsp("start_http_server(essl) -> try start public_key"), application:start(public_key), do_start_http_server(Conf); start_http_server(Conf, SslTag) -> @@ -177,23 +238,32 @@ do_start_http_server(Conf) -> tsp("do_start_http_server -> entry with" "~n Conf: ~p" "~n", [Conf]), - application:load(inets), - case application:set_env(inets, services, [{httpd, Conf}]) of + tsp("do_start_http_server -> load inets"), + case ensure_loaded(inets) of ok -> - tsp("start_http_server -> httpd conf stored in inets app env"), - case application:start(inets) of + tsp("do_start_http_server -> inets loaded - now set_env for httpd"), + case application:set_env(inets, services, [{httpd, Conf}]) of ok -> - tsp("start_http_server -> inets started"), - ok; - Error1 -> - tsp("<ERROR> Failed starting application: " - "~n Error1: ~p", [Error1]), - Error1 + tsp("do_start_http_server -> " + "httpd conf stored in inets app env"), + case (catch application:start(inets)) of + ok -> + tsp("do_start_http_server -> inets started"), + ok; + Error1 -> + tsp("<ERROR> Failed starting application: " + "~n Error1: ~p", [Error1]), + tsf({failed_starting_inets, Error1}) + end; + Error2 -> + tsp("<ERROR> Failed set application env: " + "~n Error: ~p", [Error2]), + tsf({failed_set_env, Error2}) end; - Error2 -> - tsp("<ERROR> Failed set application env: " - "~n Error: ~p", [Error2]), - Error2 + {error, Reason} -> + tsp("do_start_http_server -> failed loading inets" + "~n Reason: ~p", [Reason]), + tsf({failed_loading_inets, Reason}) end. start_http_server_ssl(FileName) -> @@ -213,6 +283,7 @@ do_start_http_server_ssl(FileName) -> catch do_start_http_server(FileName). + %% ---------------------------------------------------------------------- %% print functions %% @@ -257,20 +328,49 @@ copy_files(FromDir, ToDir) -> copy_dirs(FromDirRoot, ToDirRoot) -> - {ok, Files} = file:list_dir(FromDirRoot), - lists:foreach( - fun(FileOrDir) -> - %% Check if it's a directory or a file - case filelib:is_dir(filename:join(FromDirRoot, FileOrDir)) of - true -> - FromDir = filename:join([FromDirRoot, FileOrDir]), - ToDir = filename:join([ToDirRoot, FileOrDir]), - ok = file:make_dir(ToDir), - copy_dirs(FromDir, ToDir); - false -> - copy_file(FileOrDir, FromDirRoot, ToDirRoot) - end - end, Files). + case file:list_dir(FromDirRoot) of + {ok, Files} -> + lists:foreach( + fun(FileOrDir) -> + %% Check if it's a directory or a file + case filelib:is_dir(filename:join(FromDirRoot, + FileOrDir)) of + true -> + FromDir = filename:join([FromDirRoot, FileOrDir]), + ToDir = filename:join([ToDirRoot, FileOrDir]), + case file:make_dir(ToDir) of + ok -> + copy_dirs(FromDir, ToDir); + {error, Reason} -> + tsp("<ERROR> Failed creating directory: " + "~n ToDir: ~p" + "~n Reason: ~p" + "~nwhen" + "~n ToDirRoot: ~p" + "~n ToDirRoot file info: ~p", + [ToDir, + Reason, + ToDirRoot, + file:read_file_info(ToDirRoot)]), + tsf({failed_copy_dir, ToDir, Reason}) + end; + false -> + copy_file(FileOrDir, FromDirRoot, ToDirRoot) + end + end, Files); + {error, Reason} -> + tsp("<ERROR> Failed get directory file list: " + "~n FromDirRoot: ~p" + "~n Reason: ~p" + "~nwhen" + "~n FromDirRoot file info: ~p", + [FromDirRoot, + Reason, + file:read_file_info(FromDirRoot)]), + tsf({failed_list_dir, FromDirRoot, Reason}) + end. + + del_dirs(Dir) -> case file:list_dir(Dir) of @@ -394,56 +494,80 @@ connect_byte(ip_comm, Host, Port, Opts0) -> connect(ip_comm, Host, Port, Opts). -connect(ssl, Host, Port, Opts) -> +%% This always falls back on IPV4, but tries IPV6 first. +connect(Proto, Host, Port, Opts0) -> + Opts = Opts0 -- [inet, inet6], + connect(Proto, Host, Port, Opts ++ [inet6], inet6). + +connect(ssl, Host, Port, Opts, Type) -> tsp("connect(ssl) -> entry with" "~n Host: ~p" "~n Port: ~p" - "~n Opts: ~p", [Host, Port, Opts]), + "~n Opts: ~p" + "~n Type: ~p", [Host, Port, Opts, Type]), ssl:start(), - %% Does not support ipv6 in old ssl + %% We ignore this option for ssl... + %% ...maybe we should really treat this in the same way as ip_comm... case ssl:connect(Host, Port, Opts) of {ok, Socket} -> {ok, Socket}; + {error, Reason} when Type =:= inet6 -> + tsp("connect(ssl) -> failed connecting with inet6: " + "~n Reason: ~p" + "~n trying inet", [Reason]), + connect(ssl, Host, Port, Opts -- [inet6], inet); {error, Reason} -> - {error, Reason}; + tsp("connect(ssl) -> failed connecting: " + "~n Reason: ~p", [Reason]), + {error, Reason}; Error -> Error end; -connect(ip_comm, Host, Port, Opts) -> +connect(ip_comm, Host, Port, Opts, Type) -> tsp("connect(ip_comm) -> entry with" "~n Host: ~p" "~n Port: ~p" - "~n Opts: ~p", [Host, Port, Opts]), - case gen_tcp:connect(Host,Port, Opts) of + "~n Opts: ~p" + "~n Type: ~p", [Host, Port, Opts, Type]), + + case gen_tcp:connect(Host, Port, Opts) of {ok, Socket} -> tsp("connect success"), {ok, Socket}; - {error, nxdomain} -> - tsp("connect error nxdomain when opts: ~p", [Opts]), - connect(ip_comm, Host, Port, lists:delete(inet6, Opts)); - {error, eafnosupport} -> - tsp("connect error eafnosupport when opts: ~p", [Opts]), - connect(ip_comm, Host, Port, lists:delete(inet6, Opts)); - {error, econnreset} -> - tsp("connect error econnreset when opts: ~p", [Opts]), - connect(ip_comm, Host, Port, lists:delete(inet6, Opts)); - {error, enetunreach} -> - tsp("connect error eafnosupport when opts: ~p", [Opts]), - connect(ip_comm, Host, Port, lists:delete(inet6, Opts)); - {error, {enfile,_}} -> - tsp("connect error enfile when opts: ~p", [Opts]), - {error, enfile}; + + {error, nxdomain} when Type =:= inet6 -> + tsp("connect error nxdomain when" + "~n Opts: ~p", [Opts]), + connect(ip_comm, Host, Port, Opts -- [inet6], inet); + {error, eafnosupport} when Type =:= inet6 -> + tsp("connect error eafnosupport when" + "~n Opts: ~p", [Opts]), + connect(ip_comm, Host, Port, Opts -- [inet6], inet); + {error, econnreset} when Type =:= inet6 -> + tsp("connect error econnreset when" + "~n Opts: ~p", [Opts]), + connect(ip_comm, Host, Port, Opts -- [inet6], inet); + {error, enetunreach} when Type =:= inet6 -> + tsp("connect error eafnosupport when" + "~n Opts: ~p", [Opts]), + connect(ip_comm, Host, Port, Opts -- [inet6], inet); + {error, econnrefused} when Type =:= inet6 -> + tsp("connect error econnrefused when" + "~n Opts: ~p", [Opts]), + connect(ip_comm, Host, Port, Opts -- [inet6], inet); + Error -> - tsp("Unexpected error: " + tsp("connect(ip_conn) -> Fatal connect error: " "~n Error: ~p" "~nwhen" "~n Host: ~p" "~n Port: ~p" "~n Opts: ~p" - "~n", [Error, Host, Port, Opts]), + "~n Type: ~p" + "~n", [Error, Host, Port, Opts, Type]), Error end. - + send(ssl, Socket, Data) -> ssl:send(Socket, Data); @@ -509,12 +633,15 @@ tsp(F) -> tsp(F, []). tsp(F, A) -> Timestamp = formated_timestamp(), - test_server:format("*** ~s ~p ~p ~w:" ++ F ++ "~n", - [Timestamp, node(), self(), ?MODULE | A]). + test_server:format("*** ~s ~p ~p " ++ F ++ "~n", + [Timestamp, node(), self() | A]). tsf(Reason) -> test_server:fail(Reason). +tss(Time) -> + test_server:sleep(Time). + formated_timestamp() -> format_timestamp( os:timestamp() ). diff --git a/lib/inets/test/inets_test_lib.hrl b/lib/inets/test/inets_test_lib.hrl index c578398c55..6a86b1b764 100644 --- a/lib/inets/test/inets_test_lib.hrl +++ b/lib/inets/test/inets_test_lib.hrl @@ -50,6 +50,11 @@ -define(OSCMD(Cmd), inets_test_lib:oscmd(Cmd)). +-define(PRINT_SYSTEM_INFO(P), inets_test_lib:print_system_info(P)). + +-define(RUN_ON_OS(OS, FUN), inets_test_lib:run_on_os(OS, FUN)). +-define(RUN_ON_WINDOWS(FUN), inets_test_lib:run_on_windows(FUN)). + %% - Test case macros - diff --git a/lib/inets/vsn.mk b/lib/inets/vsn.mk index 77eb43a7ed..488947c3a1 100644 --- a/lib/inets/vsn.mk +++ b/lib/inets/vsn.mk @@ -18,7 +18,7 @@ # %CopyrightEnd% APPLICATION = inets -INETS_VSN = 5.8.1 +INETS_VSN = 5.9 PRE_VSN = APP_VSN = "$(APPLICATION)-$(INETS_VSN)$(PRE_VSN)" diff --git a/lib/kernel/doc/src/gen_tcp.xml b/lib/kernel/doc/src/gen_tcp.xml index 8a5d40bb16..9f362841ce 100644 --- a/lib/kernel/doc/src/gen_tcp.xml +++ b/lib/kernel/doc/src/gen_tcp.xml @@ -235,7 +235,9 @@ do_recv(Sock, Bs) -> <p>Returns <c>{ok, <anno>Socket</anno>}</c> if a connection is established, or <c>{error, closed}</c> if <c><anno>ListenSocket</anno></c> is closed, or <c>{error, timeout}</c> if no connection is established - within the specified time. May also return a POSIX error + within the specified time, + or <c>{error, system_limit}</c> if all available ports in the + Erlang emulator are in use. May also return a POSIX error value if something else goes wrong, see inet(3) for possible error values.</p> <p>Packets can be sent to the returned socket <c><anno>Socket</anno></c> diff --git a/lib/kernel/doc/src/inet.xml b/lib/kernel/doc/src/inet.xml index 1a05b4ba99..86950b3ecc 100644 --- a/lib/kernel/doc/src/inet.xml +++ b/lib/kernel/doc/src/inet.xml @@ -149,7 +149,7 @@ fe80::204:acff:fe17:bf38 <fsummary>Return a descriptive string for an error reason</fsummary> <desc> <p>Returns a diagnostic error string. See the section below - for possible <c><anno>Posix</anno></c> values and the corresponding + for possible Posix values and the corresponding strings.</p> </desc> </func> diff --git a/lib/kernel/src/disk_log.erl b/lib/kernel/src/disk_log.erl index fb9415d440..f5f972c112 100644 --- a/lib/kernel/src/disk_log.erl +++ b/lib/kernel/src/disk_log.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2011. All Rights Reserved. +%% Copyright Ericsson AB 1997-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -1034,10 +1034,9 @@ sync_loop(From, S) -> -define(MAX_LOOK_AHEAD, 64*1024). %% Inlined. -log_loop(S, Pids, _Bins, _Sync, _Sz) when S#state.cache_error =/= ok -> +log_loop(#state{cache_error = CE}=S, Pids, _Bins, _Sync, _Sz) when CE =/= ok -> loop(cache_error(S, Pids)); -log_loop(#state{messages = []}=S, Pids, Bins, Sync, Sz) - when Sz > ?MAX_LOOK_AHEAD -> +log_loop(#state{}=S, Pids, Bins, Sync, Sz) when Sz > ?MAX_LOOK_AHEAD -> loop(log_end(S, Pids, Bins, Sync)); log_loop(#state{messages = []}=S, Pids, Bins, Sync, Sz) -> receive @@ -1046,8 +1045,7 @@ log_loop(#state{messages = []}=S, Pids, Bins, Sync, Sz) -> after 0 -> loop(log_end(S, Pids, Bins, Sync)) end; -log_loop(S, Pids, Bins, Sync, Sz) -> - [M | Ms] = S#state.messages, +log_loop(#state{messages = [M | Ms]}=S, Pids, Bins, Sync, Sz) -> S1 = S#state{messages = Ms}, log_loop(M, Pids, Bins, Sync, Sz, S1, get(log)). diff --git a/lib/kernel/src/erts_debug.erl b/lib/kernel/src/erts_debug.erl index 7d6a5ade94..16a773898d 100644 --- a/lib/kernel/src/erts_debug.erl +++ b/lib/kernel/src/erts_debug.erl @@ -53,6 +53,11 @@ size(Tuple, Seen0, Sum0) when is_tuple(Tuple) -> Sum = Sum0 + 1 + tuple_size(Tuple), tuple_size(1, tuple_size(Tuple), Tuple, Seen, Sum) end; +size(Fun, Seen0, Sum) when is_function(Fun) -> + case remember_term(Fun, Seen0) of + seen -> {Sum,Seen0}; + Seen -> fun_size(Fun, Seen, Sum) + end; size(Term, Seen0, Sum) -> case erts_debug:flat_size(Term) of 0 -> {Sum,Seen0}; @@ -68,6 +73,21 @@ tuple_size(I, Sz, _, Seen, Sum) when I > Sz -> tuple_size(I, Sz, Tuple, Seen0, Sum0) -> {Sum,Seen} = size(element(I, Tuple), Seen0, Sum0), tuple_size(I+1, Sz, Tuple, Seen, Sum). + +fun_size(Fun, Seen, Sum) -> + case erlang:fun_info(Fun, type) of + {type,external} -> + {Sum + erts_debug:flat_size(Fun),Seen}; + {type,local} -> + Sz = erts_debug:flat_size(fun() -> ok end), + {env,Env} = erlang:fun_info(Fun, env), + fun_size_1(Env, Seen, Sum+Sz+length(Env)) + end. + +fun_size_1([H|T], Seen0, Sum0) -> + {Sum,Seen} = size(H, Seen0, Sum0), + fun_size_1(T, Seen, Sum); +fun_size_1([], Seen, Sum) -> {Sum,Seen}. remember_term(Term, Seen) -> case gb_trees:lookup(Term, Seen) of diff --git a/lib/kernel/src/gen_tcp.erl b/lib/kernel/src/gen_tcp.erl index 4d6c7f5f1d..56d0451e44 100644 --- a/lib/kernel/src/gen_tcp.erl +++ b/lib/kernel/src/gen_tcp.erl @@ -175,7 +175,7 @@ try_connect([], _Port, _Opts, _Timer, _Mod, Err) -> Port :: inet:port_number(), Options :: [listen_option()], ListenSocket :: socket(), - Reason :: inet:posix(). + Reason :: system_limit | inet:posix(). listen(Port, Opts) -> Mod = mod(Opts, undefined), @@ -194,7 +194,7 @@ listen(Port, Opts) -> -spec accept(ListenSocket) -> {ok, Socket} | {error, Reason} when ListenSocket :: socket(), Socket :: socket(), - Reason :: closed | timeout | inet:posix(). + Reason :: closed | timeout | system_limit | inet:posix(). accept(S) -> case inet_db:lookup_socket(S) of @@ -208,7 +208,7 @@ accept(S) -> ListenSocket :: socket(), Timeout :: timeout(), Socket :: socket(), - Reason :: closed | timeout | inet:posix(). + Reason :: closed | timeout | system_limit | inet:posix(). accept(S, Time) when is_port(S) -> case inet_db:lookup_socket(S) of diff --git a/lib/kernel/src/inet.erl b/lib/kernel/src/inet.erl index 49f64a9236..4de3c1c6b1 100644 --- a/lib/kernel/src/inet.erl +++ b/lib/kernel/src/inet.erl @@ -1218,11 +1218,13 @@ port_list(Name) -> %% utils %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --spec format_error(Posix) -> string() when - Posix :: posix(). +-spec format_error(Reason) -> string() when + Reason :: posix() | system_limit. format_error(exbadport) -> "invalid port state"; format_error(exbadseq) -> "bad command sequence"; +format_error(system_limit) -> + "a system limit was hit, probably not enough ports"; format_error(Tag) -> erl_posix_msg:message(Tag). diff --git a/lib/kernel/test/code_SUITE.erl b/lib/kernel/test/code_SUITE.erl index 99b0cd2ffb..4dfa92a755 100644 --- a/lib/kernel/test/code_SUITE.erl +++ b/lib/kernel/test/code_SUITE.erl @@ -1441,6 +1441,9 @@ filter_app("netconf",_) -> % Safe has the same kind of error in the .app file as ic filter_app("safe",_) -> false; +% Comte cannot be started in the "usual" way +filter_app("comte",_) -> + false; % OS_mon does not find it's port program when running cerl filter_app("os_mon",true) -> false; diff --git a/lib/kernel/test/gen_tcp_misc_SUITE.erl b/lib/kernel/test/gen_tcp_misc_SUITE.erl index 3da4b07c05..d9bba0dbb0 100644 --- a/lib/kernel/test/gen_tcp_misc_SUITE.erl +++ b/lib/kernel/test/gen_tcp_misc_SUITE.erl @@ -39,7 +39,8 @@ accept_timeouts_in_order/1,accept_timeouts_in_order2/1, accept_timeouts_in_order3/1,accept_timeouts_mixed/1, killing_acceptor/1,killing_multi_acceptors/1,killing_multi_acceptors2/1, - several_accepts_in_one_go/1,active_once_closed/1, send_timeout/1, send_timeout_active/1, + several_accepts_in_one_go/1, accept_system_limit/1, + active_once_closed/1, send_timeout/1, send_timeout_active/1, otp_7731/1, zombie_sockets/1, otp_7816/1, otp_8102/1, otp_9389/1]). @@ -71,7 +72,7 @@ all() -> accept_timeouts_in_order, accept_timeouts_in_order2, accept_timeouts_in_order3, accept_timeouts_mixed, killing_acceptor, killing_multi_acceptors, - killing_multi_acceptors2, several_accepts_in_one_go, + killing_multi_acceptors2, several_accepts_in_one_go, accept_system_limit, active_once_closed, send_timeout, send_timeout_active, otp_7731, zombie_sockets, otp_7816, otp_8102, otp_9389]. @@ -1837,6 +1838,54 @@ wait_until_accepting(Proc,N) -> end. +accept_system_limit(suite) -> + []; +accept_system_limit(doc) -> + ["Check that accept returns {error, system_limit} " + "(and not {error, enfile}) when running out of ports"]; +accept_system_limit(Config) when is_list(Config) -> + ?line {ok, LS} = gen_tcp:listen(0, []), + ?line {ok, TcpPort} = inet:port(LS), + ?line Connector = spawn_link(fun () -> connector(TcpPort) end), + ?line ok = acceptor(LS, false, []), + ?line Connector ! stop, + ok. + +acceptor(LS, GotSL, A) -> + case gen_tcp:accept(LS, 1000) of + {ok, S} -> + acceptor(LS, GotSL, [S|A]); + {error, system_limit} -> + acceptor(LS, true, A); + {error, timeout} when GotSL -> + ok; + {error, timeout} -> + error + end. + +connector(TcpPort) -> + ManyPorts = open_ports([]), + ConnF = fun (Port) -> + case catch gen_tcp:connect({127,0,0,1}, TcpPort, []) of + {ok, Sock} -> + Sock; + _Error -> + port_close(Port) + end + end, + R = [ConnF(Port) || Port <- lists:sublist(ManyPorts, 10)], + receive stop -> R end. + +open_ports(L) -> + case catch open_port({spawn_driver, "ram_file_drv"}, []) of + Port when is_port(Port) -> + open_ports([Port|L]); + {'EXIT', {system_limit, _}} -> + {L1, L2} = lists:split(5, L), + [port_close(Port) || Port <- L1], + L2 + end. + active_once_closed(suite) -> []; diff --git a/lib/kernel/test/sendfile_SUITE.erl b/lib/kernel/test/sendfile_SUITE.erl index 6d0848ee05..03704b0c04 100644 --- a/lib/kernel/test/sendfile_SUITE.erl +++ b/lib/kernel/test/sendfile_SUITE.erl @@ -26,7 +26,9 @@ all() -> [t_sendfile_small - ,t_sendfile_big + ,t_sendfile_big_all + ,t_sendfile_big_size + ,t_sendfile_many_small ,t_sendfile_partial ,t_sendfile_offset ,t_sendfile_sendafter @@ -38,20 +40,25 @@ all() -> ]. init_per_suite(Config) -> - Priv = ?config(priv_dir, Config), - SFilename = filename:join(Priv, "sendfile_small.html"), - {ok, DS} = file:open(SFilename,[write,raw]), - file:write(DS,"yo baby yo"), - file:sync(DS), - file:close(DS), - BFilename = filename:join(Priv, "sendfile_big.html"), - {ok, DB} = file:open(BFilename,[write,raw]), - [file:write(DB,[<<0:(10*8*1024*1024)>>]) || _I <- lists:seq(1,51)], - file:sync(DB), - file:close(DB), - [{small_file, SFilename}, - {file_opts,[raw,binary]}, - {big_file, BFilename}|Config]. + case {os:type(),os:version()} of + {{unix,sunos}, {5,8,_}} -> + {skip, "Solaris 8 not supported for now"}; + _ -> + Priv = ?config(priv_dir, Config), + SFilename = filename:join(Priv, "sendfile_small.html"), + {ok, DS} = file:open(SFilename,[write,raw]), + file:write(DS,"yo baby yo"), + file:sync(DS), + file:close(DS), + BFilename = filename:join(Priv, "sendfile_big.html"), + {ok, DB} = file:open(BFilename,[write,raw]), + [file:write(DB,[<<0:(10*8*1024*1024)>>]) || _I <- lists:seq(1,51)], + file:sync(DB), + file:close(DB), + [{small_file, SFilename}, + {file_opts,[raw,binary]}, + {big_file, BFilename}|Config] + end. end_per_suite(Config) -> file:delete(proplists:get_value(big_file, Config)). @@ -91,7 +98,34 @@ t_sendfile_small(Config) when is_list(Config) -> ok = sendfile_send(Send). -t_sendfile_big(Config) when is_list(Config) -> +t_sendfile_many_small(Config) when is_list(Config) -> + Filename = proplists:get_value(small_file, Config), + FileOpts = proplists:get_value(file_opts, Config, []), + + error_logger:add_report_handler(?MODULE,[self()]), + + Send = fun(Sock) -> + {Size,_} = sendfile_file_info(Filename), + N = 10000, + {ok,D} = file:open(Filename,[read|FileOpts]), + [begin + {ok,Size} = file:sendfile(D,Sock,0,0,[]) + end || _I <- lists:seq(1,N)], + file:close(D), + Size*N + end, + + ok = sendfile_send({127,0,0,1}, Send, 0), + + receive + {stolen,Reason} -> + exit(Reason) + after 200 -> + ok + end. + + +t_sendfile_big_all(Config) when is_list(Config) -> Filename = proplists:get_value(big_file, Config), Send = fun(Sock) -> @@ -103,6 +137,20 @@ t_sendfile_big(Config) when is_list(Config) -> ok = sendfile_send({127,0,0,1}, Send, 0). +t_sendfile_big_size(Config) -> + Filename = proplists:get_value(big_file, Config), + FileOpts = proplists:get_value(file_opts, Config, []), + + SendAll = fun(Sock) -> + {ok, #file_info{size = Size}} = + file:read_file_info(Filename), + {ok,D} = file:open(Filename,[read|FileOpts]), + {ok, Size} = file:sendfile(D, Sock,0,Size,[]), + Size + end, + + ok = sendfile_send({127,0,0,1}, SendAll, 0). + t_sendfile_partial(Config) -> Filename = proplists:get_value(small_file, Config), FileOpts = proplists:get_value(file_opts, Config, []), @@ -310,6 +358,10 @@ sendfile_server(ClientPid, Orig) -> -define(SENDFILE_TIMEOUT, 10000). sendfile_do_recv(Sock, Bs) -> + TimeoutMul = case os:type() of + {win32, _} -> 6; + _ -> 1 + end, receive stop when Bs /= 0,is_integer(Bs) -> gen_tcp:close(Sock), @@ -333,7 +385,7 @@ sendfile_do_recv(Sock, Bs) -> {tcp_closed, Sock} when is_integer(Bs) -> ct:log("Stopped due to close"), {ok, Bs} - after ?SENDFILE_TIMEOUT -> + after ?SENDFILE_TIMEOUT * TimeoutMul -> ct:log("Sendfile timeout"), timeout end. diff --git a/lib/kernel/test/zlib_SUITE.erl b/lib/kernel/test/zlib_SUITE.erl index 74bafe8935..e0fd0f5d19 100644 --- a/lib/kernel/test/zlib_SUITE.erl +++ b/lib/kernel/test/zlib_SUITE.erl @@ -73,6 +73,7 @@ suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> [{group, api}, {group, examples}, {group, func}, smp, + otp_9981, otp_7359]. groups() -> @@ -964,6 +965,24 @@ otp_7359_def_inf(Data,{DefSize,InfSize}) -> ?line ok = zlib:close(ZInf), ok. +otp_9981(Config) when is_list(Config) -> + Ports = lists:sort(erlang:ports()), + Invalid = <<"My invalid data">>, + catch zlib:compress(invalid), + Ports = lists:sort(erlang:ports()), + catch zlib:uncompress(Invalid), + Ports = lists:sort(erlang:ports()), + catch zlib:zip(invalid), + Ports = lists:sort(erlang:ports()), + catch zlib:unzip(Invalid), + Ports = lists:sort(erlang:ports()), + catch zlib:gzip(invalid), + Ports = lists:sort(erlang:ports()), + catch zlib:gunzip(Invalid), + Ports = lists:sort(erlang:ports()), + ok. + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Helps with testing directly %%%%%%%%%%%%% diff --git a/lib/megaco/doc/src/notes.xml b/lib/megaco/doc/src/notes.xml index d9c575885f..393064fbb5 100644 --- a/lib/megaco/doc/src/notes.xml +++ b/lib/megaco/doc/src/notes.xml @@ -4,7 +4,7 @@ <chapter> <header> <copyright> - <year>2000</year><year>2011</year> + <year>2000</year><year>2012</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -36,6 +36,75 @@ section is the version number of Megaco.</p> + <section><title>Megaco 3.16.0.1</title> + + <p>Version 3.16.0.1 supports code replacement in runtime from/to + version 3.16, 3.15.1.1, 3.15.1 and 3.15.</p> + + <section> + <title>Improvements and new features</title> + +<!-- + <p>-</p> +--> + + <list type="bulleted"> + <item> + <p>Fixed some faulty test cases. </p> +<!-- + <p>Own Id: OTP-9795</p> +--> + </item> + + <item> + <p>Removed use of deprecated system flag, + <c>scheduler_bind_type</c>, in the measurement tool + <c>mstone1</c>. </p> + <p>Own Id: OTP-9949</p> + </item> + + </list> + + </section> + + <section> + <title>Fixed bugs and malfunctions</title> + + <p>-</p> + + <!-- + <list type="bulleted"> + <item> + <p>Fixing miscellaneous things detected by dialyzer. </p> + <p>Own Id: OTP-9075</p> + </item> + + </list> + --> + + </section> + + <section> + <title>Incompatibilities</title> + <p>-</p> + +<!-- + <list type="bulleted"> + <item> + <p>Due to the change in the flex driver API, + we may no longer be able to build and/or use + the flex driver without reentrant support. </p> + <p>Own Id: OTP-9795</p> + </item> + + </list> +--> + + </section> + + </section> <!-- 3.16.0.1 --> + + <section><title>Megaco 3.16</title> <p>Version 3.16 supports code replacement in runtime from/to @@ -50,7 +119,7 @@ <list type="bulleted"> <item> - <p>Minor improvemnts to the emasurement tool mstone1. </p> + <p>Minor improvements to the measurement tool <c>mstone1</c>. </p> <p>Own Id: OTP-9604</p> </item> diff --git a/lib/megaco/examples/meas/meas.sh.skel.src b/lib/megaco/examples/meas/meas.sh.skel.src index c7bd6cdd2a..ecf463b9c6 100644 --- a/lib/megaco/examples/meas/meas.sh.skel.src +++ b/lib/megaco/examples/meas/meas.sh.skel.src @@ -2,7 +2,7 @@ # %CopyrightBegin% # -# Copyright Ericsson AB 2007-2011. All Rights Reserved. +# Copyright Ericsson AB 2007-2012. All Rights Reserved. # # The contents of this file are subject to the Erlang Public License, # Version 1.1, (the "License"); you may not use this file except in @@ -32,6 +32,7 @@ STOP="-s init stop" ERL="erl \ -noshell \ + +sbt tnnps \ -pa $MEAS_HOME \ $MEAS_DEFAULT \ $STOP" diff --git a/lib/megaco/examples/meas/megaco_codec_mstone1.erl b/lib/megaco/examples/meas/megaco_codec_mstone1.erl index 9ab7822df8..2133cd633c 100644 --- a/lib/megaco/examples/meas/megaco_codec_mstone1.erl +++ b/lib/megaco/examples/meas/megaco_codec_mstone1.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% Copyright Ericsson AB 2005-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -191,7 +191,6 @@ mstone_init(MessagePackage, Factor, Codecs, DrvInclude) -> do_mstone(MessagePackage, Factor, Codecs, DrvInclude) -> io:format("~n", []), - ?LIB:set_default_sched_bind(), ?LIB:display_os_info(), ?LIB:display_system_info(), ?LIB:display_app_info(), diff --git a/lib/megaco/examples/meas/megaco_codec_mstone2.erl b/lib/megaco/examples/meas/megaco_codec_mstone2.erl index f3588f2e3d..54b889345f 100644 --- a/lib/megaco/examples/meas/megaco_codec_mstone2.erl +++ b/lib/megaco/examples/meas/megaco_codec_mstone2.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2006-2009. All Rights Reserved. +%% Copyright Ericsson AB 2006-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -40,7 +40,7 @@ %% When the finished timer expires, it will stop respawing %% the worker processes, and instead just wait for them all %% to finish. -%% The test is finished by printing the statistics. +%% The test is finishes by printing the statistics. %% - A worker process for each codec combination. %% This process is spawned by the loader process. It receives %% at start a list of messages. It shall decode and then @@ -162,7 +162,6 @@ parse_message_package(BadMessagePackage) -> mstone_init(MessagePackage, DrvInclude) -> io:format("~n", []), - ?LIB:set_default_sched_bind(), ?LIB:display_os_info(), ?LIB:display_system_info(), ?LIB:display_app_info(), diff --git a/lib/megaco/examples/meas/megaco_codec_mstone_lib.erl b/lib/megaco/examples/meas/megaco_codec_mstone_lib.erl index 040af9826b..ca8016d65f 100644 --- a/lib/megaco/examples/meas/megaco_codec_mstone_lib.erl +++ b/lib/megaco/examples/meas/megaco_codec_mstone_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2006-2010. All Rights Reserved. +%% Copyright Ericsson AB 2006-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -30,7 +30,6 @@ -compile({no_auto_import,[error/1]}). -export([start_flex_scanner/0, stop_flex_scanner/1, expanded_messages/2, expanded_messages/3, - set_default_sched_bind/0, display_os_info/0, display_system_info/0, display_alloc_info/0, @@ -70,16 +69,6 @@ detect_version(Codec, Conf, Bin) -> %%---------------------------------------------------------------------- %% -%% S c h e d u l e r b i n d t y p e -%% -%%---------------------------------------------------------------------- - -set_default_sched_bind() -> - (catch erlang:system_flag(scheduler_bind_type, default_bind)). - - -%%---------------------------------------------------------------------- -%% %% D i s p l a y O s I n f o %% %%---------------------------------------------------------------------- diff --git a/lib/megaco/examples/meas/mstone1.sh.skel.src b/lib/megaco/examples/meas/mstone1.sh.skel.src index 54a6c61a58..b1935acef6 100644 --- a/lib/megaco/examples/meas/mstone1.sh.skel.src +++ b/lib/megaco/examples/meas/mstone1.sh.skel.src @@ -3,7 +3,7 @@ # # %CopyrightBegin% # -# Copyright Ericsson AB 2007-2011. All Rights Reserved. +# Copyright Ericsson AB 2007-2012. All Rights Reserved. # # The contents of this file are subject to the Erlang Public License, # Version 1.1, (the "License"); you may not use this file except in @@ -55,6 +55,15 @@ Options: flex scanner will be used nd - only codec config(s) without drivers will be used od - only codec config(s) with drivers will be used + -sbt <bind-type> Set scheduler bind type. See erl man page for more info. + tnnps - Thread no node processor spread (default) + u - Unbound + ns - No spread + ts - Thread spread + ps - Processor spread + s - Spread + nnts - No node thread spread + nnps - No node processor spread -- everything after this is just passed on to erl. " @@ -67,6 +76,7 @@ MODULE=megaco_codec_mstone1 STARTF="start" FACTOR="" MSG_PACK=time_test +SBT="+sbt tnnps" while test $# != 0; do # echo "DBG: Value = $1" @@ -107,6 +117,17 @@ while test $# != 0; do exit 0 esac;; + -sbt) + case $2 in + tnnps|u|ns|ts|ps|s|nnts|nnps) + SBT="+sbt $2"; + shift ; shift ;; + *) + echo "unknown scheduler bind type: $2"; + echo "$usage" ; + exit 0 + esac;; + -f) if [ "x$SCHED" != "x" ]; then echo "option(s) -s and -f cannot both be given" ; @@ -177,6 +198,7 @@ if [ $TYPE = factor ]; then ERL="erl \ -noshell \ + $SBT \ $PHS \ $ATP \ $SMP_OPTS \ @@ -218,6 +240,7 @@ elif [ $TYPE = sched ]; then ERL="erl \ -noshell \ + $SBT \ $PHS \ $ATP \ $SMP_OPTS \ diff --git a/lib/megaco/src/app/megaco.appup.src b/lib/megaco/src/app/megaco.appup.src index 3c9740818a..7f89fa8bc2 100644 --- a/lib/megaco/src/app/megaco.appup.src +++ b/lib/megaco/src/app/megaco.appup.src @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2011. All Rights Reserved. +%% Copyright Ericsson AB 2001-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -142,10 +142,17 @@ %% | %% v %% 3.16 +%% | +%% v +%% 3.16.0.1 %% %% {"%VSN%", [ + {"3.16", + [ + ] + }, {"3.15.1.1", [ {restart_application, megaco} @@ -163,6 +170,10 @@ } ], [ + {"3.16", + [ + ] + }, {"3.15.1.1", [ {restart_application, megaco} diff --git a/lib/megaco/test/megaco_mess_test.erl b/lib/megaco/test/megaco_mess_test.erl index 8bafab1aba..663ac8c329 100644 --- a/lib/megaco/test/megaco_mess_test.erl +++ b/lib/megaco/test/megaco_mess_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2011. All Rights Reserved. +%% Copyright Ericsson AB 1999-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -324,9 +324,6 @@ min(M) -> timer:minutes(M). %% Test server callbacks -% init_per_testcase(pending_ack = Case, Config) -> -% put(dbg,true), -% megaco_test_lib:init_per_testcase(Case, Config); init_per_testcase(otp_7189 = Case, Config) -> C = lists:keydelete(tc_timeout, 1, Config), megaco_test_lib:init_per_testcase(Case, [{tc_timeout, min(2)} |C]); @@ -337,9 +334,6 @@ init_per_testcase(Case, Config) -> C = lists:keydelete(tc_timeout, 1, Config), megaco_test_lib:init_per_testcase(Case, [{tc_timeout, min(1)} |C]). -% end_per_testcase(pending_ack = Case, Config) -> -% erase(dbg), -% megaco_test_lib:end_per_testcase(Case, Config); end_per_testcase(Case, Config) -> megaco_test_lib:end_per_testcase(Case, Config). @@ -434,6 +428,7 @@ connect(suite) -> connect(doc) -> []; connect(Config) when is_list(Config) -> + %% ?SKIP("Needs a re-write..."), ?ACQUIRE_NODES(1, Config), PrelMid = preliminary_mid, MgMid = ipv4_mid(4711), @@ -457,16 +452,25 @@ connect(Config) when is_list(Config) -> ?VERIFY(bad_send_mod, megaco:conn_info(PrelCH, send_mod)), SC = service_change_request(), case megaco:call(PrelCH, [SC], []) of - {error, - {send_message_failed, - {'EXIT', {undef, [{bad_send_mod, send_message, [sh, _]} | _]}}}} -> + {_Version, + {error, + {send_message_failed, + {'EXIT', {undef, [{bad_send_mod, send_message, [sh, _]} | _]}}}} + } -> + %% R14B and previous + ?LOG("expected send failure (1)", []), ok; %% As of R15, we also get some extra info (e.g. line numbers) - {error, - {send_message_failed, - {'EXIT', {undef, [{bad_send_mod, send_message, [sh, _], _} | _]}}}} -> + {_Version, + {error, + {send_message_failed, + {'EXIT', {undef, [{bad_send_mod, send_message, [sh, _], _} | _]}}}} + } -> + %% R15B and later + ?LOG("expected send failure (2)", []), ok; + Unexpected -> ?ERROR(Unexpected) end, diff --git a/lib/megaco/vsn.mk b/lib/megaco/vsn.mk index bb6f5f554a..11a951a23e 100644 --- a/lib/megaco/vsn.mk +++ b/lib/megaco/vsn.mk @@ -2,7 +2,7 @@ # %CopyrightBegin% # -# Copyright Ericsson AB 1997-2011. All Rights Reserved. +# Copyright Ericsson AB 1997-2012. All Rights Reserved. # # The contents of this file are subject to the Erlang Public License, # Version 1.1, (the "License"); you may not use this file except in @@ -18,6 +18,6 @@ # %CopyrightEnd% APPLICATION = megaco -MEGACO_VSN = 3.16 +MEGACO_VSN = 3.16.0.1 PRE_VSN = APP_VSN = "$(APPLICATION)-$(MEGACO_VSN)$(PRE_VSN)" diff --git a/lib/observer/src/observer_perf_wx.erl b/lib/observer/src/observer_perf_wx.erl index 0de9785fb9..fa867e12f6 100644 --- a/lib/observer/src/observer_perf_wx.erl +++ b/lib/observer/src/observer_perf_wx.erl @@ -278,7 +278,7 @@ collect_data(?IO_W, {N, Q}) -> end. mem_types() -> - [total, processes, system, atom, binary, code, ets]. + [total, processes, atom, binary, code, ets]. lmax([]) -> 0; lmax(List) -> diff --git a/lib/snmp/doc/src/notes.xml b/lib/snmp/doc/src/notes.xml index 704ff0a20f..2d045faa0f 100644 --- a/lib/snmp/doc/src/notes.xml +++ b/lib/snmp/doc/src/notes.xml @@ -34,6 +34,88 @@ <section> + <title>SNMP Development Toolkit 4.22</title> + <p>Version 4.22 supports code replacement in runtime from/to + version 4.21.7 4.21.6 4.21.5, 4.21.4, 4.21.3, 4.21.2, 4.21.1 and 4.21. </p> + + <section> + <title>Improvements and new features</title> +<!-- + <p>-</p> +--> + + <list type="bulleted"> + <item> + <p>[compiler] The table information the MIB compiler provides with + augmented tables has been extended with <c>nbr_of_cols</c>, + <c>first_accessible</c> and <c>not_accessible</c>. </p> + <p>Own Id: OTP-9969</p> + </item> + + <item> + <p>Added the <c>log_to_io</c> audit-trail-log converter function + to the api modules of both the + <seealso marker="snmpm#log_to_io">manager</seealso> + and + <seealso marker="snmpa#log_to_io">agent</seealso>. </p> + <p>Own Id: OTP-9940</p> + </item> + + <item> + <p>[manager] Introduced a new transport module, + <c>snmpm_net_if_mt</c>, + which handles all incomming and outgoing + traffic in newly created processes. The message/request is + processed and then the process exits. </p> + <p>Own Id: OTP-9876</p> + </item> + + <item> + <p>[agent] Documenting previously existing but undocumented function, + <seealso marker="snmp_generic#get_table_info">snmp_generic:get_table_info/2</seealso>. </p> + <p>Own Id: OTP-9942</p> + </item> + + <item> + <p>[agent] Improve error handling while reading agent config files. + Some files contain mandatory information and is therefor themself + mandatory. </p> + <p>Own Id: OTP-9943</p> + </item> + </list> + + </section> + + <section> + <title>Fixed Bugs and Malfunctions</title> + <p>-</p> + + <!-- + <list type="bulleted"> + <item> + <p>[agent] Simultaneous + <seealso marker="snmpa#backup">snmpa:backup/1,2</seealso> + calls can interfere. + The master agent did not check if a backup was already in + progress when a backup request was accepted. </p> + <p>Own Id: OTP-9884</p> + <p>Aux Id: Seq 11995</p> + </item> + + </list> + --> + + </section> + + <section> + <title>Incompatibilities</title> + <p>-</p> + </section> + + </section> <!-- 4.22 --> + + + <section> <title>SNMP Development Toolkit 4.21.7</title> <p>Version 4.21.7 supports code replacement in runtime from/to version 4.21.6, 4.21.5, 4.21.4, 4.21.3, 4.21.2, 4.21.1, 4.21, 4.20.1 and @@ -47,14 +129,14 @@ <list type="bulleted"> <item> <p>[agent] DoS attack using GET-BULK with large value of - MaxRepetitions. - A preventive method has been implementing by simply - limit the number of varbinds that can be included in - a Get-BULK response message. This is specified by the - new config option, - <seealso marker="snmp_app#agent_gb_max_vbs">gb_max_vbs</seealso>. - </p> - <p>Own Id: OTP-9700</p> + MaxRepetitions. + A preventive method has been implementing by simply + limit the number of varbinds that can be included in + a Get-BULK response message. This is specified by the + new config option, + <seealso marker="snmp_app#agent_gb_max_vbs">gb_max_vbs</seealso>. + </p> + <p>Own Id: OTP-9700</p> </item> </list> @@ -63,7 +145,7 @@ </section> <section> - <title>Reported Fixed Bugs and Malfunctions</title> + <title>Fixed Bugs and Malfunctions</title> <!-- <p>-</p> --> @@ -71,10 +153,10 @@ <list type="bulleted"> <item> <p>[agent] Simultaneous - <seealso marker="snmpa#backup">snmpa:backup/1,2</seealso> - calls can interfere. - The master agent did not check if a backup was already in - progress when a backup request was accepted. </p> + <seealso marker="snmpa#backup">snmpa:backup/1,2</seealso> + calls can interfere. + The master agent did not check if a backup was already in + progress when a backup request was accepted. </p> <p>Own Id: OTP-9884</p> <p>Aux Id: Seq 11995</p> </item> @@ -106,14 +188,14 @@ <list type="bulleted"> <item> <p>[agent] DoS attack using GET-BULK with large value of - MaxRepetitions. - A preventive method has been implementing by simply - limit the number of varbinds that can be included in - a Get-BULK response message. This is specified by the - new config option, - <seealso marker="snmp_app#agent_gb_max_vbs">gb_max_vbs</seealso>. - </p> - <p>Own Id: OTP-9700</p> + MaxRepetitions. + A preventive method has been implementing by simply + limit the number of varbinds that can be included in + a Get-BULK response message. This is specified by the + new config option, + <seealso marker="snmp_app#agent_gb_max_vbs">gb_max_vbs</seealso>. + </p> + <p>Own Id: OTP-9700</p> </item> </list> @@ -121,7 +203,7 @@ </section> <section> - <title>Reported Fixed Bugs and Malfunctions</title> + <title>Fixed Bugs and Malfunctions</title> <!-- <p>-</p> --> @@ -129,12 +211,12 @@ <list type="bulleted"> <item> <p>[agent] Mib server cache gclimit update function incorrectly calls - age update function. - The gclimit update function, - <seealso marker="snmpa#update_mibs_cache_gclimit">update_mibs_cache_gclimit/1</seealso>, - <em>incorrectly</em> called the age update function, - <seealso marker="snmpa#update_mibs_cache_age">update_mibs_cache_age/2</seealso>. </p> - <p>Johan Claesson</p> + age update function. + The gclimit update function, + <seealso marker="snmpa#update_mibs_cache_gclimit">update_mibs_cache_gclimit/1</seealso>, + <em>incorrectly</em> called the age update function, + <seealso marker="snmpa#update_mibs_cache_age">update_mibs_cache_age/2</seealso>. </p> + <p>Johan Claesson</p> <p>Own Id: OTP-9868</p> </item> diff --git a/lib/snmp/doc/src/snmp.xml b/lib/snmp/doc/src/snmp.xml index af0833f005..3e6610891f 100644 --- a/lib/snmp/doc/src/snmp.xml +++ b/lib/snmp/doc/src/snmp.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="iso-8859-1" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> <header> <copyright> - <year>1996</year><year>2009</year> + <year>1996</year><year>2012</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -391,6 +391,30 @@ version of the protocol data unit. There is a new line between <c>Vsn</c> and <c>PDU</c>.</p> + <marker id="log_to_io"></marker> + </desc> + </func> + + <func> + <name>log_to_io(LogDir, Mibs, LogName, LogFile) -> ok | {error, Reason}</name> + <name>log_to_io(LogDir, Mibs, LogName, LogFile, Start) -> ok | {error, Reason}</name> + <name>log_to_io(LogDir, Mibs, LogName, LogFile, Start, Stop) -> ok | {error, Reason}</name> + <fsummary>Convert an Audit Trail Log to text format</fsummary> + <type> + <v>LogDir = string()</v> + <v>Mibs = [MibName]</v> + <v>MibName = string()</v> + <v>LogName = string()</v> + <v>LogFile = string()</v> + <v>Start = Stop = null | datetime() | {local_time,datetime()} | {universal_time,datetime()} </v> + <v>Reason = term()</v> + </type> + <desc> + <p>Converts an Audit Trail Log to a readable format and + prints it on stdio. See + <seealso marker="snmp#log_to_txt">log_to_txt</seealso> + above for more info.</p> + <marker id="change_log_size"></marker> </desc> </func> diff --git a/lib/snmp/doc/src/snmp_app.xml b/lib/snmp/doc/src/snmp_app.xml index f6abe783b3..d11eaa2771 100644 --- a/lib/snmp/doc/src/snmp_app.xml +++ b/lib/snmp/doc/src/snmp_app.xml @@ -35,8 +35,8 @@ <appsummary>The SNMP Application</appsummary> <description> <p>This chapter describes the <c>snmp</c> - application in OTP. The SNMP application provides the following - services:</p> + application in OTP. The SNMP application provides the following + services:</p> <list type="bulleted"> <item> <p>a multilingual extensible SNMP agent</p> @@ -589,16 +589,16 @@ {no_reuse, no_reuse()} | {filter, manager_net_if_filter_options()} </c></p> <p>These options are actually specific to the used module. - The ones shown here are applicable to the default - <c>manager_net_if_module()</c>.</p> + The ones shown here are applicable to the default + <c>manager_net_if_module()</c>.</p> <p>For defaults see the options in <c>manager_net_if_option()</c>.</p> </item> <marker id="manager_ni_module"></marker> <tag><c><![CDATA[manager_net_if_module() = atom() <optional>]]></c></tag> <item> - <p>Module which handles the network interface part for the - SNMP manager. Must implement the + <p>The module which handles the network interface part for the + SNMP manager. It must implement the <seealso marker="snmpm_network_interface">snmpm_network_interface</seealso> behaviour.</p> <p>Default is <c>snmpm_net_if</c>.</p> </item> diff --git a/lib/snmp/doc/src/snmp_config.xml b/lib/snmp/doc/src/snmp_config.xml index 0a49b7a62e..b756f3da7d 100644 --- a/lib/snmp/doc/src/snmp_config.xml +++ b/lib/snmp/doc/src/snmp_config.xml @@ -586,18 +586,18 @@ {no_reuse, no_reuse()} | {filter, manager_net_if_filter_options()}</c></p> <p>These options are actually specific to the used module. - The ones shown here are applicable to the default - <c>manager_net_if_module()</c>.</p> + The ones shown here are applicable to the default + <c>manager_net_if_module()</c>. </p> <p>For defaults see the options in <c>manager_net_if_option()</c>.</p> </item> <marker id="manager_ni_module"></marker> <tag><c><![CDATA[manager_net_if_module() = atom() <optional>]]></c></tag> <item> - <p>Module which handles the network interface part for the - SNMP manager. Must implement the - <seealso marker="snmpm_network_interface">snmpm_network_interface</seealso> behaviour.</p> - <p>Default is <c>snmpm_net_if</c>.</p> + <p>The module which handles the network interface part for the + SNMP manager. It must implement the + <seealso marker="snmpm_network_interface">snmpm_network_interface</seealso> behaviour. </p> + <p>Default is <c>snmpm_net_if</c>. </p> </item> <marker id="manager_ni_filter_opts"></marker> diff --git a/lib/snmp/doc/src/snmp_generic.xml b/lib/snmp/doc/src/snmp_generic.xml index 77f3cefaa2..79a22323d9 100644 --- a/lib/snmp/doc/src/snmp_generic.xml +++ b/lib/snmp/doc/src/snmp_generic.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="iso-8859-1" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> <header> <copyright> - <year>1996</year><year>2009</year> + <year>1996</year><year>2012</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -34,15 +34,16 @@ <module>snmp_generic</module> <modulesummary>Generic Functions for Implementing SNMP Objects in a Database</modulesummary> <description> - <p>The module <c>snmp_generic</c> contains generic functions for implementing tables - (and variables) using the SNMP built-in database or Mnesia. These - default functions are used if no instrumentation function is - provided for a managed object in a MIB. Sometimes, it might be - necessary to customize the behaviour of the default functions. For - example, in some situations a trap should be sent if a row is - deleted or modified, or some hardware is to be informed, when - information is changed. - </p> + <marker id="description"></marker> + <p>The module <c>snmp_generic</c> contains generic functions for + implementing tables (and variables) using the SNMP built-in database + or Mnesia. These default functions are used if no instrumentation + function is provided for a managed object in a MIB. Sometimes, + it might be necessary to customize the behaviour of the default + functions. For example, in some situations a trap should be sent + if a row is deleted or modified, or some hardware is to be informed, + when information is changed. </p> + <p>The overall structure is shown in the following figure:</p> <pre> +---------------+ @@ -93,6 +94,7 @@ </description> <section> + <marker id="data_types"></marker> <title>DATA TYPES</title> <p>In the functions defined below, the following types are used:</p> <code type="none"> @@ -118,7 +120,10 @@ value() = term() case of a <c>set</c> operation. </p> </item> </taglist> + + <marker id="get_status_col2"></marker> </section> + <funcs> <func> <name>get_status_col(Name, Cols)</name> @@ -136,8 +141,11 @@ value() = term() <p>This function can be used in instrumentation functions for <c>is_set_ok</c>, <c>undo</c> or <c>set</c> to check if the status column of a table is modified.</p> + + <marker id="get_index_types"></marker> </desc> </func> + <func> <name>get_index_types(Name)</name> <fsummary>Get the index types of <c>Name</c></fsummary> @@ -147,9 +155,36 @@ value() = term() <desc> <p>Gets the index types of <c>Name</c></p> <p>This function can be used in instrumentation functions to - retrieve the index types part of the table info.</p> + retrieve the index types part of the table info.</p> + + <marker id="get_table_info"></marker> </desc> </func> + + <func> + <name>get_table_info(Name, Item) -> table_info_result()</name> + <fsummary>Get table info item of MIB table <c>Name</c></fsummary> + <type> + <v>Name = name()</v> + <v>Item = table_item() | all</v> + <v>table_item() = nbr_of_cols | defvals | status_col | not_accessible | + index_types | first_accessible | first_own_index</v> + <v>table_info_result() = Value | [{table_item(), Value}]</v> + <v>Value = term()</v> + </type> + <desc> + <p>Get a specific table info item or, if <c>Item</c> has the + value <c>all</c>, a two tuple list (property list) is instead + returned with all the items and their respctive values of the + given table. </p> + + <p>This function can be used in instrumentation functions to + retrieve a given part of the table info.</p> + + <marker id="table_func"></marker> + </desc> + </func> + <func> <name>table_func(Op1, NameDb)</name> <name>table_func(Op2, RowIndex, Cols, NameDb) -> Ret</name> @@ -190,8 +225,11 @@ value() = term() <p>The function returns according to the specification of an instrumentation function. </p> + + <marker id="table_get_elements"></marker> </desc> </func> + <func> <name>table_get_elements(NameDb, RowIndex, Cols) -> Values</name> <fsummary>Get elements in a table row</fsummary> @@ -204,8 +242,11 @@ value() = term() <desc> <p>Returns a list with values for all columns in <c>Cols</c>. If a column is undefined, its value is <c>noinit</c>.</p> + + <marker id="table_next"></marker> </desc> </func> + <func> <name>table_next(NameDb, RestOid) -> RowIndex | endOfTable</name> <fsummary>Find the next row in the table</fsummary> @@ -217,8 +258,11 @@ value() = term() <desc> <p>Finds the indices of the next row in the table. <c>RestOid</c> does not have to specify an existing row.</p> + + <marker id="table_row_exists"></marker> </desc> </func> + <func> <name>table_row_exists(NameDb, RowIndex) -> bool()</name> <fsummary>Check if a row in a table exists</fsummary> @@ -228,8 +272,11 @@ value() = term() </type> <desc> <p>Checks if a row in a table exists.</p> + + <marker id="table_set_elements"></marker> </desc> </func> + <func> <name>table_set_elements(NameDb, RowIndex, Cols) -> bool()</name> <fsummary>Set elements in a table row</fsummary> @@ -246,8 +293,11 @@ value() = term() <c>mnesia:write</c> to store the values. This means that this function must be called from within a transaction (<c>mnesia:transaction/1</c> or <c>mnesia:dirty/1</c>).</p> + + <marker id="variable_func"></marker> </desc> </func> + <func> <name>variable_func(Op1, NameDb)</name> <name>variable_func(Op2, Val, NameDb) -> Ret</name> @@ -268,8 +318,11 @@ value() = term() the database. </p> <p>The function returns according to the specification of an instrumentation function. </p> + + <marker id="variable_get"></marker> </desc> </func> + <func> <name>variable_get(NameDb) -> {value, Value} | undefined</name> <fsummary>Get the value of a variable</fsummary> @@ -279,8 +332,11 @@ value() = term() </type> <desc> <p>Gets the value of a variable.</p> + + <marker id="variable_set"></marker> </desc> </func> + <func> <name>variable_set(NameDb, NewVal) -> true | false</name> <fsummary>Set a value for a variable</fsummary> @@ -299,6 +355,7 @@ value() = term() </funcs> <section> + <marker id="example"></marker> <title>Example</title> <p>The following example shows an implementation of a table which is stored in Mnesia, but with some checks performed at set-request diff --git a/lib/snmp/doc/src/snmp_manager_netif.xml b/lib/snmp/doc/src/snmp_manager_netif.xml index 2738ca76c1..169e20d10b 100644 --- a/lib/snmp/doc/src/snmp_manager_netif.xml +++ b/lib/snmp/doc/src/snmp_manager_netif.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="iso-8859-1" ?> <!DOCTYPE chapter SYSTEM "chapter.dtd"> <chapter> <header> <copyright> - <year>2004</year><year>2009</year> + <year>2004</year><year>2012</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -35,31 +35,34 @@ <image file="snmp_manager_netif_1.gif"> <icaption>The Purpose of Manager Net if</icaption> </image> + <p>The Network Interface (Net if) process delivers SNMP PDUs to the - manager server, and receives SNMP PDUs from the manager server. - The most common behaviour of a Net if process is that is receives - request PDU from the manager server, encodes the PDU into bytes - and transmits the bytes onto the network to an agent. When the - reply from the agent is received by the Net if process, which it - decodes into an SNMP PDU, which it sends to the manager server. - </p> + manager server, and receives SNMP PDUs from the manager server. + The most common behaviour of a Net if process is that is receives + request PDU from the manager server, encodes the PDU into bytes + and transmits the bytes onto the network to an agent. When the + reply from the agent is received by the Net if process, which it + decodes into an SNMP PDU, which it sends to the manager server. </p> + <p>However, that simple behaviour can be modified in numerous - ways. For example, the Net if process can apply some kind of - encrypting/decrypting scheme on the bytes. - </p> - <p>It is also possible to write your own Net if process. The default - Net if process is implemented in the module <c>snmpm_net_if</c> and - it uses UDP as the transport protocol. - </p> - <p>This section describes how to write a Net if process. - </p> + ways. For example, the Net if process can apply some kind of + encrypting/decrypting scheme on the bytes. </p> + + <p>The snmp application provides two different modules, + <c>snmpm_net_if</c> (the default) and <c>snmpm_net_if_mt</c>, + both uses the UDP as the transport protocol. The difference + between the two modules is that the latter is "multi-threaded", + i.e. for each message/request a new process is created that + process the message/request and then exits. </p> + + <p>It is also possible to write your own Net if process, + this section describes how to write a Net if processdo that.</p> <section> <marker id="mandatory_functions"></marker> <title>Mandatory Functions</title> <p>A Net if process must implement the SNMP manager - <seealso marker="snmpm_network_interface">network interface behaviour</seealso>. - </p> + <seealso marker="snmpm_network_interface">network interface behaviour</seealso>. </p> </section> <section> diff --git a/lib/snmp/doc/src/snmpa.xml b/lib/snmp/doc/src/snmpa.xml index 2322af28cc..86fde03205 100644 --- a/lib/snmp/doc/src/snmpa.xml +++ b/lib/snmp/doc/src/snmpa.xml @@ -501,6 +501,7 @@ notification_delivery_info() = #snmpa_notification_delivery_info{} </func> <func> + <name>log_to_txt(LogDir)</name> <name>log_to_txt(LogDir, Mibs)</name> <name>log_to_txt(LogDir, Mibs, OutFile) -> ok | {error, Reason}</name> <name>log_to_txt(LogDir, Mibs, OutFile, LogName) -> ok | {error, Reason}</name> @@ -528,6 +529,37 @@ notification_delivery_info() = #snmpa_notification_delivery_info{} See <seealso marker="snmp#log_to_txt">snmp:log_to_txt</seealso> for more info.</p> + <marker id="log_to_io"></marker> + </desc> + </func> + + <func> + <name>log_to_io(LogDir) -> ok | {error, Reason}</name> + <name>log_to_io(LogDir, Mibs) -> ok | {error, Reason}</name> + <name>log_to_io(LogDir, Mibs, LogName) -> ok | {error, Reason}</name> + <name>log_to_io(LogDir, Mibs, LogName, LogFile) -> ok | {error, Reason}</name> + <name>log_to_io(LogDir, Mibs, LogName, LogFile, Start) -> ok | {error, Reason}</name> + <name>log_to_io(LogDir, Mibs, LogName, LogFile, Start, Stop) -> ok | {error, Reason}</name> + <fsummary>Convert an Audit Trail Log to text format</fsummary> + <type> + <v>LogDir = string()</v> + <v>Mibs = [MibName]</v> + <v>MibName = string()</v> + <v>LogName = string()</v> + <v>LogFile = string()</v> + <v>Start = Stop = null | datetime() | {local_time,datetime()} | {universal_time,datetime()} </v> + <v>Reason = disk_log_open_error() | file_open_error() | term()</v> + <v>disk_log_open_error() = {LogName, term()}</v> + <v>file_open_error() = {OutFile, term()}</v> + </type> + <desc> + <p>Converts an Audit Trail Log to a readable format and + prints it on stdio. + <c>LogName</c> defaults to "snmpa_log". + <c>LogFile</c> defaults to "snmpa.log". + See <seealso marker="snmp#log_to_io">snmp:log_to_io</seealso> + for more info.</p> + <marker id="change_log_size"></marker> </desc> </func> diff --git a/lib/snmp/doc/src/snmpm.xml b/lib/snmp/doc/src/snmpm.xml index c36a1b2a24..9bbb6cdbdb 100644 --- a/lib/snmp/doc/src/snmpm.xml +++ b/lib/snmp/doc/src/snmpm.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>2004</year><year>2011</year> + <year>2004</year><year>2012</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -1237,6 +1237,38 @@ priv_key = [integer()] (length is 16 if priv = usmDESPrivProtocol | usmAesCfb1 See <seealso marker="snmp#log_to_txt">snmp:log_to_txt</seealso> for more info.</p> + <marker id="log_to_io"></marker> + </desc> + </func> + + <func> + <name>log_to_io(LogDir) -> ok | {error, Reason}</name> + <name>log_to_io(LogDir, Mibs) -> ok | {error, Reason}</name> + <name>log_to_io(LogDir, Mibs) -> ok | {error, Reason}</name> + <name>log_to_io(LogDir, Mibs, LogName) -> ok | {error, Reason}</name> + <name>log_to_io(LogDir, Mibs, LogName, LogFile) -> ok | {error, Reason}</name> + <name>log_to_io(LogDir, Mibs, LogName, LogFile, Start) -> ok | {error, Reason}</name> + <name>log_to_io(LogDir, Mibs, LogName, LogFile, Start, Stop) -> ok | {error, Reason}</name> + <fsummary>Convert an Audit Trail Log to text format</fsummary> + <type> + <v>LogDir = string()</v> + <v>Mibs = [MibName]</v> + <v>MibName = string()</v> + <v>LogName = string()</v> + <v>LogFile = string()</v> + <v>Start = Stop = null | datetime() | {local_time,datetime()} | {universal_time,datetime()} </v> + <v>Reason = disk_log_open_error() | file_open_error() | term()</v> + <v>disk_log_open_error() = {LogName, term()}</v> + <v>file_open_error() = {OutFile, term()}</v> + </type> + <desc> + <p>Converts an Audit Trail Log to a readable format and + prints it on stdio. + <c>LogName</c> defaults to "snmpm_log". + <c>LogFile</c> defaults to "snmpm.log". + See <seealso marker="snmp#log_to_io">snmp:log_to_io</seealso> + for more info.</p> + <marker id="change_log_size"></marker> </desc> </func> diff --git a/lib/snmp/doc/src/snmpm_network_interface_filter.xml b/lib/snmp/doc/src/snmpm_network_interface_filter.xml index ea1e183848..5f80cec94e 100644 --- a/lib/snmp/doc/src/snmpm_network_interface_filter.xml +++ b/lib/snmp/doc/src/snmpm_network_interface_filter.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="iso-8859-1" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> <header> <copyright> - <year>2007</year><year>2009</year> + <year>2007</year><year>2012</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -72,9 +72,10 @@ </list> <p>Note that the network interface filter is something which is used by the network interface implementation provided by the application - (<c>snmpm_net_if</c>). The default filter accepts all messages.</p> + (<c>snmpm_net_if</c> and <c>snmpm_net_if_mt</c>). + The default filter accepts all messages.</p> <p>A network interface filter can e.g. be used during testing or for load - regulation. </p> + regulation. </p> </description> <section> diff --git a/lib/snmp/examples/ex2/snmp_ex2_manager.erl b/lib/snmp/examples/ex2/snmp_ex2_manager.erl index ff873327bc..1b247d713d 100644 --- a/lib/snmp/examples/ex2/snmp_ex2_manager.erl +++ b/lib/snmp/examples/ex2/snmp_ex2_manager.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2006-2010. All Rights Reserved. +%% Copyright Ericsson AB 2006-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -39,7 +39,7 @@ %% Manager callback API: -export([handle_error/3, - handle_agent/4, + handle_agent/5, handle_pdu/4, handle_trap/3, handle_inform/3, @@ -265,16 +265,17 @@ handle_snmp_callback(handle_error, {ReqId, Reason}) -> "~n Reason: ~p" "~n", [ReqId, Reason]), ok; -handle_snmp_callback(handle_agent, {Addr, Port, SnmpInfo}) -> +handle_snmp_callback(handle_agent, {Addr, Port, Type, SnmpInfo}) -> {ES, EI, VBs} = SnmpInfo, io:format("*** UNKNOWN AGENT ***" "~n Address: ~p" "~n Port: ~p" + "~n Type: ~p" "~n SNMP Info: " "~n Error Status: ~w" "~n Error Index: ~w" "~n Varbinds: ~p" - "~n", [Addr, Port, ES, EI, VBs]), + "~n", [Addr, Port, Type, ES, EI, VBs]), ok; handle_snmp_callback(handle_pdu, {TargetName, ReqId, SnmpResponse}) -> {ES, EI, VBs} = SnmpResponse, @@ -382,8 +383,8 @@ handle_error(ReqId, Reason, Server) when is_pid(Server) -> ignore. -handle_agent(Addr, Port, SnmpInfo, Server) when is_pid(Server) -> - report_callback(Server, handle_agent, {Addr, Port, SnmpInfo}), +handle_agent(Addr, Port, Type, SnmpInfo, Server) when is_pid(Server) -> + report_callback(Server, handle_agent, {Addr, Port, Type, SnmpInfo}), ignore. diff --git a/lib/snmp/include/snmp_types.hrl b/lib/snmp/include/snmp_types.hrl index 4adb24361c..fce087347f 100644 --- a/lib/snmp/include/snmp_types.hrl +++ b/lib/snmp/include/snmp_types.hrl @@ -78,23 +78,36 @@ %%----------------------------------------------------------------- %% TableInfo - stored in snmp_symbolic_store for use by the -%% generic table functions. +%% generic table functions. For an ordinary table, the +%% types will be the following: %% nbr_of_cols is an integer +%% pos_integer() %% defvals is a list of {Col, Defval}, ordered by column %% number +%% [{Col :: integer(), Defval :: term()}] %% status_col is an integer +%% pos_integer() %% not_accessible a sorted list of columns (> first_accessible) %% that are 'not-accessible' -%% indextypes is a list of #asn1_type for the index-columns, -%% ordered by column number -%% first_accessible is an integer, the first non-accessible -%% column +%% [pos_integer()] +%% index_types is a list of #asn1_type for the index-columns, +%% ordered by column number or an "augment"-tuple +%% [asn1_type()] +%% first_accessible is an integer, the first accessible column +%% pos_integer() %% first_own_index is an integer. 0 if there is no such index for %% this table. %% This is not the same as the last integer in the oid! %% Example: If a table has one own index (oid.1), one %% column (oid.2) and one imported index then %% first_own_index will be 2. +%% non_neg_integer() +%% For a augmented table, it will instead look like this: +%% index_types {augments, {atom(), asn1_type()}} +%% nbr_of_cols pos_integer() +%% not_accessible [pos_integer()] +%% first_accessible pos_integer() +%% %%----------------------------------------------------------------- -record(table_info, @@ -192,7 +205,7 @@ %%---------------------------------------------------------------------- -record(mib, {misc = [], - mib_format_version = "3.2", + mib_format_version = "3.3", name = "", module_identity, %% Not in SMIv1, and only with +module_identity mes = [], diff --git a/lib/snmp/src/agent/snmp_community_mib.erl b/lib/snmp/src/agent/snmp_community_mib.erl index 77307aa7ad..d7d41aca31 100644 --- a/lib/snmp/src/agent/snmp_community_mib.erl +++ b/lib/snmp/src/agent/snmp_community_mib.erl @@ -28,6 +28,7 @@ -export([add_community/5, add_community/6, delete_community/1]). -export([check_community/1]). +-include("snmpa_internal.hrl"). -include("SNMP-COMMUNITY-MIB.hrl"). -include("SNMP-TARGET-MIB.hrl"). -include("SNMPv2-TC.hrl"). @@ -120,10 +121,17 @@ init_tabs(Comms) -> read_community_config_files(Dir) -> ?vdebug("read community config file",[]), - Gen = fun(_) -> ok end, - Filter = fun(Comms) -> Comms end, - Check = fun(Entry) -> check_community(Entry) end, - [Comms] = + FileName = "community.conf", + Gen = fun(D, Reason) -> + warning_msg("failed reading config file ~s" + "~n Config Dir: ~s" + "~n Reason: ~p", + [FileName, D, Reason]), + ok + end, + Filter = fun(Comms) -> Comms end, + Check = fun(Entry) -> check_community(Entry) end, + [Comms] = snmp_conf:read_files(Dir, [{Gen, Filter, Check, "community.conf"}]), Comms. @@ -601,5 +609,8 @@ set_sname(_) -> %% Keep it, if already set. error(Reason) -> throw({error, Reason}). +warning_msg(F, A) -> + ?snmpa_warning("[COMMUNITY-MIB]: " ++ F, A). + config_err(F, A) -> snmpa_error:config_err("[COMMUNITY-MIB]: " ++ F, A). diff --git a/lib/snmp/src/agent/snmp_framework_mib.erl b/lib/snmp/src/agent/snmp_framework_mib.erl index 0d7866d94d..cc191bd956 100644 --- a/lib/snmp/src/agent/snmp_framework_mib.erl +++ b/lib/snmp/src/agent/snmp_framework_mib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2010. All Rights Reserved. +%% Copyright Ericsson AB 1999-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -115,7 +115,9 @@ do_configure(Dir) -> read_internal_config_files(Dir) -> ?vdebug("read context config file",[]), - Gen = fun(D) -> convert_context(D) end, + Gen = fun(D, Reason) -> + convert_context(D, Reason) + end, Filter = fun(Contexts) -> Contexts end, Check = fun(Entry) -> check_context(Entry) end, [Ctxs] = snmp_conf:read_files(Dir, [{Gen, Filter, Check, "context.conf"}]), @@ -123,10 +125,17 @@ read_internal_config_files(Dir) -> read_agent(Dir) -> - ?vdebug("read agent config file",[]), - Check = fun(Entry) -> check_agent(Entry) end, - File = filename:join(Dir, "agent.conf"), - Agent = snmp_conf:read(File, Check), + ?vdebug("read agent config file", []), + FileName = "agent.conf", + Check = fun(Entry) -> check_agent(Entry) end, + File = filename:join(Dir, FileName), + Agent = + try + snmp_conf:read(File, Check) + catch + throw:{error, Reason} -> + error({failed_reading_config_file, Dir, FileName, Reason}) + end, sort_agent(Agent). @@ -146,9 +155,9 @@ sort_agent(L) -> %%----------------------------------------------------------------- %% Generate a context.conf file. %%----------------------------------------------------------------- -convert_context(Dir) -> +convert_context(Dir, _Reason) -> config_err("missing context.conf file => generating a default file", []), - File = filename:join(Dir,"context.conf"), + File = filename:join(Dir, "context.conf"), case file:open(File, [write]) of {ok, Fid} -> ok = io:format(Fid, "~s\n", [context_header()]), @@ -165,7 +174,7 @@ context_header() -> io_lib:format("%% This file was automatically generated by " "snmp_config v~s ~w-~2.2.0w-~2.2.0w " "~2.2.0w:~2.2.0w:~2.2.0w\n", - [?version,Y,Mo,D,H,Mi,S]). + [?version, Y, Mo, D, H, Mi, S]). %%----------------------------------------------------------------- diff --git a/lib/snmp/src/agent/snmp_notification_mib.erl b/lib/snmp/src/agent/snmp_notification_mib.erl index 720ac749b8..37e09f5d3e 100644 --- a/lib/snmp/src/agent/snmp_notification_mib.erl +++ b/lib/snmp/src/agent/snmp_notification_mib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2011. All Rights Reserved. +%% Copyright Ericsson AB 1998-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -27,6 +27,7 @@ -export([add_notify/3, delete_notify/1]). -export([check_notify/1]). +-include("snmpa_internal.hrl"). -include("SNMP-NOTIFICATION-MIB.hrl"). -include("SNMPv2-TC.hrl"). -include("snmp_tables.hrl"). @@ -104,7 +105,14 @@ do_reconfigure(Dir) -> read_notify_config_files(Dir) -> ?vdebug("read notify config file",[]), - Gen = fun(_) -> ok end, + FileName = "notify.conf", + Gen = fun(D, Reason) -> + info_msg("failed reading config file ~s" + "~n Config Dir: ~s" + "~n Reason: ~p", + [FileName, D, Reason]), + ok + end, Filter = fun(Notifs) -> Notifs end, Check = fun(Entry) -> check_notify(Entry) end, [Notifs] = @@ -112,7 +120,7 @@ read_notify_config_files(Dir) -> Notifs. check_notify({Name, Tag, Type}) -> - snmp_conf:check_string(Name,{gt,0}), + snmp_conf:check_string(Name, {gt, 0}), snmp_conf:check_string(Tag), {ok, Val} = snmp_conf:check_atom(Type, [{trap, 1}, {inform, 2}]), Notify = {Name, Tag, Val, @@ -451,12 +459,15 @@ set_sname() -> set_sname(get(sname)). set_sname(undefined) -> - put(sname,conf); + put(sname, conf); set_sname(_) -> %% Keep it, if already set. ok. error(Reason) -> throw({error, Reason}). +info_msg(F, A) -> + ?snmpa_info("[NOTIFICATION-MIB]: " ++ F, A). + config_err(F, A) -> snmpa_error:config_err("[NOTIFICATION-MIB]: " ++ F, A). diff --git a/lib/snmp/src/agent/snmp_standard_mib.erl b/lib/snmp/src/agent/snmp_standard_mib.erl index b6834d278c..ca93546923 100644 --- a/lib/snmp/src/agent/snmp_standard_mib.erl +++ b/lib/snmp/src/agent/snmp_standard_mib.erl @@ -143,20 +143,35 @@ do_reconfigure(Dir) -> %% Func: read_standard/1 %% Args: Dir is the directory with trailing dir_separator where %% the configuration files can be found. -%% Purpose: Reads th standard configuration file. +%% Purpose: Reads the standard configuration file. %% Returns: A list of standard variables %% Fails: If an error occurs, the process will die with Reason %% configuration_error. +%% This file is mandatory, as it contains mandatory +%% config options for which there are no default values. %%----------------------------------------------------------------- read_standard(Dir) -> ?vdebug("check standard config file",[]), - Gen = fun(_) -> ok end, - Filter = fun(Standard) -> sort_standard(Standard) end, - Check = fun(Entry) -> check_standard(Entry) end, + FileName = "standard.conf", + Gen = fun(D, Reason) -> + throw({error, {failed_reading_config_file, + D, FileName, + list_dir(Dir), Reason}}) + end, + Filter = fun(Standard) -> sort_standard(Standard) end, + Check = fun(Entry) -> check_standard(Entry) end, [Standard] = - snmp_conf:read_files(Dir, [{Gen, Filter, Check, "standard.conf"}]), + snmp_conf:read_files(Dir, [{Gen, Filter, Check, FileName}]), Standard. +list_dir(Dir) -> + case file:list_dir(Dir) of + {ok, Files} -> + Files; + Error -> + Error + end. + %%----------------------------------------------------------------- %% Make sure that each mandatory standard attribute is present, and @@ -548,6 +563,7 @@ snmp_set_serial_no(set, NewVal) -> snmp_generic:variable_func(set, (NewVal + 1) rem 2147483648, {snmpSetSerialNo, volatile}). + %%----------------------------------------------------------------- %% This is the instrumentation function for sysOrTable %%----------------------------------------------------------------- @@ -588,4 +604,4 @@ error(Reason) -> throw({error, Reason}). config_err(F, A) -> - snmpa_error:config_err("[STANDARD-MIB]: " ++ F, A). + snmpa_error:config_err("[STANDARD-MIB] " ++ F, A). diff --git a/lib/snmp/src/agent/snmp_target_mib.erl b/lib/snmp/src/agent/snmp_target_mib.erl index a45db89c09..b01d536caa 100644 --- a/lib/snmp/src/agent/snmp_target_mib.erl +++ b/lib/snmp/src/agent/snmp_target_mib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2011. All Rights Reserved. +%% Copyright Ericsson AB 1998-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -132,12 +132,12 @@ do_reconfigure(Dir) -> read_target_config_files(Dir) -> - ?vdebug("check target address config file",[]), - TAGen = fun(_D) -> ok end, + ?vdebug("check target address and parameter config file(s)",[]), + TAGen = fun(_D, _Reason) -> ok end, TAFilter = fun(Addr) -> Addr end, TACheck = fun(Entry) -> check_target_addr(Entry) end, - TPGen = fun(_D) -> ok end, + TPGen = fun(_D, _Reason) -> ok end, TPFilter = fun(Params) -> Params end, TPCheck = fun(Entry) -> check_target_params(Entry) end, diff --git a/lib/snmp/src/agent/snmp_user_based_sm_mib.erl b/lib/snmp/src/agent/snmp_user_based_sm_mib.erl index 69cebc858b..2e801622e7 100644 --- a/lib/snmp/src/agent/snmp_user_based_sm_mib.erl +++ b/lib/snmp/src/agent/snmp_user_based_sm_mib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2010. All Rights Reserved. +%% Copyright Ericsson AB 1999-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -136,7 +136,7 @@ do_reconfigure(Dir) -> read_usm_config_files(Dir) -> ?vdebug("read usm config file",[]), - Gen = fun(D) -> generate_usm(D) end, + Gen = fun(D, Reason) -> generate_usm(D, Reason) end, Filter = fun(Usms) -> Usms end, Check = fun(Entry) -> check_usm(Entry) end, [Usms] = @@ -144,7 +144,7 @@ read_usm_config_files(Dir) -> Usms. -generate_usm(Dir) -> +generate_usm(Dir, _Reason) -> info_msg("Incomplete configuration. Generating empty usm.conf.", []), USMFile = filename:join(Dir, "usm.conf"), ok = file:write_file(USMFile, list_to_binary([])). diff --git a/lib/snmp/src/agent/snmp_view_based_acm_mib.erl b/lib/snmp/src/agent/snmp_view_based_acm_mib.erl index 2cee91b081..479a44795f 100644 --- a/lib/snmp/src/agent/snmp_view_based_acm_mib.erl +++ b/lib/snmp/src/agent/snmp_view_based_acm_mib.erl @@ -115,7 +115,7 @@ do_reconfigure(Dir) -> read_vacm_config_files(Dir) -> ?vdebug("read vacm config file",[]), - Gen = fun(_) -> ok end, + Gen = fun(_D, _Reason) -> ok end, Filter = fun(Vacms) -> Sec2Group = [X || {vacmSecurityToGroup, X} <- Vacms], Access = [X || {vacmAccess, X} <- Vacms], diff --git a/lib/snmp/src/agent/snmpa.erl b/lib/snmp/src/agent/snmpa.erl index c400aaddf7..b45a47ec6b 100644 --- a/lib/snmp/src/agent/snmpa.erl +++ b/lib/snmp/src/agent/snmpa.erl @@ -83,8 +83,11 @@ -export([add_agent_caps/2, del_agent_caps/1, get_agent_caps/0]). %% Audit Trail Log functions --export([log_to_txt/2, log_to_txt/3, log_to_txt/4, +-export([log_to_txt/1, + log_to_txt/2, log_to_txt/3, log_to_txt/4, log_to_txt/5, log_to_txt/6, log_to_txt/7, + log_to_io/1, log_to_io/2, log_to_io/3, + log_to_io/4, log_to_io/5, log_to_io/6, log_info/0, change_log_size/1, get_log_type/0, get_log_type/1, @@ -780,6 +783,8 @@ get_agent_caps() -> %%% Audit Trail Log functions %%%----------------------------------------------------------------- +log_to_txt(LogDir) -> + log_to_txt(LogDir, []). log_to_txt(LogDir, Mibs) -> OutFile = "snmpa_log.txt", LogName = ?audit_trail_log_name, @@ -800,6 +805,23 @@ log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Start, Stop) -> snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Start, Stop). +log_to_io(LogDir) -> + log_to_io(LogDir, []). +log_to_io(LogDir, Mibs) -> + LogName = ?audit_trail_log_name, + LogFile = ?audit_trail_log_file, + snmp:log_to_io(LogDir, Mibs, LogName, LogFile). +log_to_io(LogDir, Mibs, LogName) -> + LogFile = ?audit_trail_log_file, + snmp:log_to_io(LogDir, Mibs, LogName, LogFile). +log_to_io(LogDir, Mibs, LogName, LogFile) -> + snmp:log_to_io(LogDir, Mibs, LogName, LogFile). +log_to_io(LogDir, Mibs, LogName, LogFile, Start) -> + snmp:log_to_io(LogDir, Mibs, LogName, LogFile, Start). +log_to_io(LogDir, Mibs, LogName, LogFile, Start, Stop) -> + snmp:log_to_io(LogDir, Mibs, LogName, LogFile, Start, Stop). + + log_info() -> LogName = ?audit_trail_log_name, snmp_log:info(LogName). diff --git a/lib/snmp/src/agent/snmpa_agent.erl b/lib/snmp/src/agent/snmpa_agent.erl index 9cc986cf47..9d30e332f1 100644 --- a/lib/snmp/src/agent/snmpa_agent.erl +++ b/lib/snmp/src/agent/snmpa_agent.erl @@ -1281,7 +1281,7 @@ handle_call({backup, BackupDir}, From, #state{backup = undefined} = S) -> ?vtrace("backup server: ~p", [BackupServer]), {noreply, S#state{backup = {BackupServer, From}}}; -handle_call({backup, _BackupDir}, From, #state{backup = Backup} = S) -> +handle_call({backup, _BackupDir}, _From, #state{backup = Backup} = S) -> ?vinfo("backup already in progress: ~p", [Backup]), {reply, {error, backup_in_progress}, S}; diff --git a/lib/snmp/src/agent/snmpa_local_db.erl b/lib/snmp/src/agent/snmpa_local_db.erl index 1ec8dd3874..2c0cad807a 100644 --- a/lib/snmp/src/agent/snmpa_local_db.erl +++ b/lib/snmp/src/agent/snmpa_local_db.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2011. All Rights Reserved. +%% Copyright Ericsson AB 1996-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -515,7 +515,7 @@ handle_call({backup, BackupDir}, From, {reply, Error, State} end; -handle_call({backup, _BackupDir}, From, #state{backup = Backup} = S) -> +handle_call({backup, _BackupDir}, _From, #state{backup = Backup} = S) -> ?vinfo("backup already in progress: ~p", [Backup]), {reply, {error, backup_in_progress}, S}; diff --git a/lib/snmp/src/agent/snmpa_mib.erl b/lib/snmp/src/agent/snmpa_mib.erl index 574467d38f..575a018c0c 100644 --- a/lib/snmp/src/agent/snmpa_mib.erl +++ b/lib/snmp/src/agent/snmpa_mib.erl @@ -580,7 +580,7 @@ handle_call({backup, BackupDir}, From, {reply, Error, State} end; -handle_call({backup, _BackupDir}, From, #state{backup = Backup} = S) -> +handle_call({backup, _BackupDir}, _From, #state{backup = Backup} = S) -> ?vinfo("backup already in progress: ~p", [Backup]), {reply, {error, backup_in_progress}, S}; diff --git a/lib/snmp/src/app/snmp.app.src b/lib/snmp/src/app/snmp.app.src index a880a14696..b11c1ef934 100644 --- a/lib/snmp/src/app/snmp.app.src +++ b/lib/snmp/src/app/snmp.app.src @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -91,6 +91,7 @@ snmpm_mpd, snmpm_net_if, snmpm_net_if_filter, + snmpm_net_if_mt, snmpm_network_interface, snmpm_network_interface_filter, snmpm_server, diff --git a/lib/snmp/src/app/snmp.appup.src b/lib/snmp/src/app/snmp.appup.src index c8e5eec6db..8360d88c94 100644 --- a/lib/snmp/src/app/snmp.appup.src +++ b/lib/snmp/src/app/snmp.appup.src @@ -22,66 +22,181 @@ %% ----- U p g r a d e ------------------------------------------------------- [ + {"4.21.7", + [ + {load_module, snmp_config, soft_purge, soft_purge, []}, + {load_module, snmp_conf, soft_purge, soft_purge, []}, + {load_module, snmp_community_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_framework_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_notification_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_standard_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_target_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, [snmp_conf]}, + + {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, + {load_module, snmpa, soft_purge, soft_purge, [snmp]}, + {load_module, snmpm, soft_purge, soft_purge, [snmp]}, + {load_module, snmp_log, soft_purge, soft_purge, []}, + {load_module, snmp_verbosity, soft_purge, soft_purge, []}, + {load_module, snmpm_mpd, soft_purge, soft_purge, []}, + + {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, + {update, snmpa_mib, soft, soft_purge, soft_purge, []}, + {update, snmpa_agent, soft, soft_purge, soft_purge, []}, + + {add_module, snmpm_net_if_mt} + ] + }, {"4.21.6", [ + {load_module, snmp_config, soft_purge, soft_purge, []}, + {load_module, snmp_conf, soft_purge, soft_purge, []}, + {load_module, snmp_community_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_framework_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_notification_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_standard_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_target_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, [snmp_conf]}, + + {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, + {load_module, snmpa, soft_purge, soft_purge, [snmp]}, + {load_module, snmpm, soft_purge, soft_purge, [snmp]}, + {load_module, snmp_log, soft_purge, soft_purge, []}, + {load_module, snmp_verbosity, soft_purge, soft_purge, []}, + {load_module, snmpm_mpd, soft_purge, soft_purge, []}, + {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, {update, snmpa_mib, soft, soft_purge, soft_purge, []}, - {update, snmpa_agent, soft, soft_purge, soft_purge, []} + {update, snmpa_agent, soft, soft_purge, soft_purge, []}, + + {add_module, snmpm_net_if_mt} ] }, {"4.21.5", [ - {load_module, snmpa, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, [snmpa_mib_lib]}, + {load_module, snmp_config, soft_purge, soft_purge, []}, + {load_module, snmp_conf, soft_purge, soft_purge, []}, + {load_module, snmp_community_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_framework_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_notification_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_standard_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, [snmp_conf]}, + + {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, + {load_module, snmpm, soft_purge, soft_purge, [snmp]}, + {load_module, snmp_log, soft_purge, soft_purge, []}, + {load_module, snmp_verbosity, soft_purge, soft_purge, []}, + {load_module, snmpm_mpd, soft_purge, soft_purge, []}, + + {load_module, snmpa, soft_purge, soft_purge, [snmp]}, + {load_module, snmp_target_mib, soft_purge, soft_purge, + [snmp_conf, snmpa_mib_lib]}, {load_module, snmpa_mib_lib, soft_purge, soft_purge, []}, {load_module, snmpa_trap, soft_purge, soft_purge, []}, {load_module, snmpa_vacm, soft_purge, soft_purge, []}, {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, {update, snmpa_mib, soft, soft_purge, soft_purge, []}, {update, snmpa_supervisor, soft, soft_purge, soft_purge, []}, - {update, snmpa_agent, soft, soft_purge, soft_purge, []} + {update, snmpa_agent, soft, soft_purge, soft_purge, []}, + + {add_module, snmpm_net_if_mt} ] }, {"4.21.4", [ - {load_module, snmpa, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, [snmpa_mib_lib]}, + {load_module, snmp_config, soft_purge, soft_purge, []}, + {load_module, snmp_conf, soft_purge, soft_purge, []}, + {load_module, snmp_community_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_framework_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_notification_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_standard_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, [snmp_conf]}, + + {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, + {load_module, snmpm, soft_purge, soft_purge, [snmp]}, + {load_module, snmp_log, soft_purge, soft_purge, []}, + {load_module, snmp_verbosity, soft_purge, soft_purge, []}, + {load_module, snmpm_mpd, soft_purge, soft_purge, []}, + + {load_module, snmpa, soft_purge, soft_purge, [snmp]}, + {load_module, snmp_target_mib, soft_purge, soft_purge, + [snmp_conf, snmpa_mib_lib]}, {load_module, snmpa_mib_lib, soft_purge, soft_purge, []}, {load_module, snmpa_trap, soft_purge, soft_purge, []}, {update, snmpa_supervisor, soft, soft_purge, soft_purge, []}, {load_module, snmp_generic_mnesia, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, + {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, + [snmp_conf]}, {load_module, snmpa_vacm, soft_purge, soft_purge, []}, {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, {update, snmpa_mib, soft, soft_purge, soft_purge, []}, - {update, snmpa_agent, soft, soft_purge, soft_purge, []} + {update, snmpa_agent, soft, soft_purge, soft_purge, []}, + + {add_module, snmpm_net_if_mt} ] }, {"4.21.3", [ - {load_module, snmpa, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, [snmpa_mib_lib]}, + {load_module, snmp_config, soft_purge, soft_purge, []}, + {load_module, snmp_conf, soft_purge, soft_purge, []}, + {load_module, snmp_community_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_framework_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_notification_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_standard_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, [snmp_conf]}, + + {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, + {load_module, snmpm, soft_purge, soft_purge, [snmp]}, + {load_module, snmp_log, soft_purge, soft_purge, []}, + {load_module, snmp_verbosity, soft_purge, soft_purge, []}, + {load_module, snmpm_mpd, soft_purge, soft_purge, []}, + + {load_module, snmpa, soft_purge, soft_purge, [snmp]}, + {load_module, snmp_target_mib, soft_purge, soft_purge, + [snmp_conf, snmpa_mib_lib]}, {load_module, snmpa_mib_lib, soft_purge, soft_purge, []}, {load_module, snmpa_trap, soft_purge, soft_purge, []}, {update, snmpa_supervisor, soft, soft_purge, soft_purge, []}, {load_module, snmp_generic_mnesia, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, + {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, + [snmp_conf]}, {load_module, snmpa_vacm, soft_purge, soft_purge, []}, {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, {update, snmpa_mib, soft, soft_purge, soft_purge, []}, - {update, snmpa_agent, soft, soft_purge, soft_purge, []} + {update, snmpa_agent, soft, soft_purge, soft_purge, []}, + + {add_module, snmpm_net_if_mt} ] }, {"4.21.2", [ - {load_module, snmpa, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, [snmpa_mib_lib]}, + {load_module, snmp_config, soft_purge, soft_purge, []}, + {load_module, snmp_conf, soft_purge, soft_purge, []}, + {load_module, snmp_community_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_framework_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_notification_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_standard_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, [snmp_conf]}, + + {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, + {load_module, snmpm, soft_purge, soft_purge, [snmp]}, + {load_module, snmp_log, soft_purge, soft_purge, []}, + {load_module, snmp_verbosity, soft_purge, soft_purge, []}, + {load_module, snmpm_mpd, soft_purge, soft_purge, []}, + + {load_module, snmpa, soft_purge, soft_purge, [snmp]}, + {load_module, snmp_target_mib, soft_purge, soft_purge, + [snmp_conf, snmpa_mib_lib]}, {load_module, snmpa_mib_lib, soft_purge, soft_purge, []}, {update, snmpa_supervisor, soft, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, + {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, + [snmp_conf]}, {load_module, snmpa_vacm, soft_purge, soft_purge, []}, {load_module, snmpa_mpd, soft_purge, soft_purge, []}, {load_module, snmpa_set_lib, soft_purge, soft_purge, []}, @@ -89,17 +204,35 @@ {load_module, snmp_generic_mnesia, soft_purge, soft_purge, []}, {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, {update, snmpa_mib, soft, soft_purge, soft_purge, []}, - {update, snmpa_agent, soft, soft_purge, soft_purge, []} + {update, snmpa_agent, soft, soft_purge, soft_purge, []}, + + {add_module, snmpm_net_if_mt} ] }, {"4.21.1", [ - {load_module, snmpa, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, [snmpa_mib_lib]}, + {load_module, snmp_config, soft_purge, soft_purge, []}, + {load_module, snmp_conf, soft_purge, soft_purge, []}, + {load_module, snmp_community_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_framework_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_notification_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_standard_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, [snmp_conf]}, + + {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, + {load_module, snmpm, soft_purge, soft_purge, [snmp]}, + {load_module, snmp_log, soft_purge, soft_purge, []}, + {load_module, snmp_verbosity, soft_purge, soft_purge, []}, + {load_module, snmpm_mpd, soft_purge, soft_purge, []}, + + {load_module, snmpa, soft_purge, soft_purge, [snmp]}, + {load_module, snmp_target_mib, soft_purge, soft_purge, + [snmp_conf, snmpa_mib_lib]}, {load_module, snmpa_mib_lib, soft_purge, soft_purge, []}, {update, snmpa_supervisor, soft, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, + {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, + [snmp_conf]}, {load_module, snmpa_vacm, soft_purge, soft_purge, []}, {load_module, snmpa_mpd, soft_purge, soft_purge, []}, {load_module, snmpa_set_lib, soft_purge, soft_purge, []}, @@ -108,91 +241,46 @@ {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, {update, snmpa_mib, soft, soft_purge, soft_purge, []}, {update, snmpa_agent, soft, soft_purge, soft_purge, []}, - {update, snmp_note_store, soft, soft_purge, soft_purge, []} + {update, snmp_note_store, soft, soft_purge, soft_purge, []}, + + {add_module, snmpm_net_if_mt} ] }, {"4.21", [ - {load_module, snmpa, soft_purge, soft_purge, []}, + {load_module, snmp_config, soft_purge, soft_purge, []}, + {load_module, snmp_conf, soft_purge, soft_purge, []}, + {load_module, snmp_community_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_framework_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_notification_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_standard_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, [snmp_conf]}, + + {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, + {load_module, snmpm, soft_purge, soft_purge, [snmp]}, + {load_module, snmp_log, soft_purge, soft_purge, []}, + {load_module, snmp_verbosity, soft_purge, soft_purge, []}, + {load_module, snmpm_mpd, soft_purge, soft_purge, []}, + + {load_module, snmpa, soft_purge, soft_purge, [snmp]}, {load_module, snmpa_mib_lib, soft_purge, soft_purge, []}, {update, snmpa_supervisor, soft, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, + {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, + [snmp_conf]}, {load_module, snmpa_vacm, soft_purge, soft_purge, []}, {load_module, snmpa_mpd, soft_purge, soft_purge, []}, {load_module, snmpa_set_lib, soft_purge, soft_purge, []}, {load_module, snmpa_trap, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, [snmpa_mib_lib]}, + {load_module, snmp_target_mib, soft_purge, soft_purge, + [snmp_conf, snmpa_mib_lib]}, {load_module, snmp_generic_mnesia, soft_purge, soft_purge, []}, {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, {update, snmpa_mib, soft, soft_purge, soft_purge, []}, {update, snmpa_agent, soft, soft_purge, soft_purge, []}, - {update, snmp_note_store, soft, soft_purge, soft_purge, []} - ] - }, - {"4.20.1", - [ - {load_module, snmpa, soft_purge, soft_purge, []}, - {load_module, snmpa_mib_lib, soft_purge, soft_purge, []}, - {update, snmpa_supervisor, soft, soft_purge, soft_purge, []}, - - {load_module, snmpa_vacm, soft_purge, soft_purge, []}, - {load_module, snmpa_set_lib, soft_purge, soft_purge, []}, - {load_module, snmpa_trap, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, [snmpa_mib_lib]}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, - {load_module, snmpm, soft_purge, soft_purge, - [snmpm_server, snmpm_config, snmp_config]}, - {load_module, snmp_conf, soft_purge, soft_purge, []}, - {load_module, snmp_config, soft_purge, soft_purge, []}, - {load_module, snmpm_mpd, soft_purge, soft_purge, - [snmp_conf, snmp_config, snmpm_config]}, - {load_module, snmpa_mpd, soft_purge, soft_purge, - [snmp_conf, snmp_config]}, - {load_module, snmpa_conf, soft_purge, soft_purge, [snmp_config]}, - {update, snmp_note_store, soft, soft_purge, soft_purge, []}, - {load_module, snmp_generic_mnesia, soft_purge, soft_purge, []}, - {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, - {update, snmpa_mib, soft, soft_purge, soft_purge, []}, - {update, snmpa_agent, soft, soft_purge, soft_purge, [snmpa_mpd]}, - {update, snmpm_config, soft, soft_purge, soft_purge, [snmp_conf]}, - {update, snmpm_server, soft, soft_purge, soft_purge, - [snmpm_net_if, snmpm_mpd, snmpm_config]}, - {update, snmpm_net_if, soft, soft_purge, soft_purge, - [snmp_conf, snmpm_mpd, snmpm_config]} - ] - }, - {"4.20", - [ - {load_module, snmpa, soft_purge, soft_purge, []}, - {load_module, snmpa_mib_lib, soft_purge, soft_purge, []}, - {update, snmpa_supervisor, soft, soft_purge, soft_purge, []}, + {update, snmp_note_store, soft, soft_purge, soft_purge, []}, - {load_module, snmpa_vacm, soft_purge, soft_purge, []}, - {load_module, snmpa_set_lib, soft_purge, soft_purge, []}, - {load_module, snmpa_trap, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, - [snmpa_mib_lib, snmp_conf]}, - {load_module, snmpm, soft_purge, soft_purge, - [snmpm_server, snmpm_config, snmp_config]}, - {load_module, snmp_conf, soft_purge, soft_purge, []}, - {load_module, snmp_config, soft_purge, soft_purge, []}, - {load_module, snmpm_mpd, soft_purge, soft_purge, - [snmp_conf, snmp_config, snmpm_config]}, - {load_module, snmpa_mpd, soft_purge, soft_purge, - [snmp_conf, snmp_config]}, - {load_module, snmpa_conf, soft_purge, soft_purge, [snmp_config]}, - {update, snmp_note_store, soft, soft_purge, soft_purge, []}, - {load_module, snmp_generic_mnesia, soft_purge, soft_purge, []}, - {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, - {update, snmpa_mib, soft, soft_purge, soft_purge, []}, - {update, snmpa_agent, soft, soft_purge, soft_purge, [snmpa_mpd]}, - {update, snmpm_config, soft, soft_purge, soft_purge, [snmp_conf]}, - {update, snmpm_server, soft, soft_purge, soft_purge, - [snmpm_net_if, snmpm_mpd, snmpm_config]}, - {update, snmpm_net_if, soft, soft_purge, soft_purge, - [snmp_conf, snmpm_mpd, snmpm_config]} + {add_module, snmpm_net_if_mt} ] } ], @@ -200,66 +288,181 @@ %% ------D o w n g r a d e --------------------------------------------------- [ + {"4.21.7", + [ + {load_module, snmp_config, soft_purge, soft_purge, []}, + {load_module, snmp_conf, soft_purge, soft_purge, []}, + {load_module, snmp_community_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_framework_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_notification_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_standard_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_target_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, [snmp_conf]}, + + {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, + {load_module, snmpa, soft_purge, soft_purge, [snmp]}, + {load_module, snmpm, soft_purge, soft_purge, [snmp]}, + {load_module, snmp_log, soft_purge, soft_purge, []}, + {load_module, snmp_verbosity, soft_purge, soft_purge, []}, + {load_module, snmpm_mpd, soft_purge, soft_purge, []}, + + {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, + {update, snmpa_mib, soft, soft_purge, soft_purge, []}, + {update, snmpa_agent, soft, soft_purge, soft_purge, []}, + + {remove, {snmpm_net_if_mt, soft_purge, soft_purge}} + ] + }, {"4.21.6", [ + {load_module, snmp_config, soft_purge, soft_purge, []}, + {load_module, snmp_conf, soft_purge, soft_purge, []}, + {load_module, snmp_community_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_framework_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_notification_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_standard_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_target_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, [snmp_conf]}, + + {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, + {load_module, snmpa, soft_purge, soft_purge, [snmp]}, + {load_module, snmpm, soft_purge, soft_purge, [snmp]}, + {load_module, snmp_log, soft_purge, soft_purge, []}, + {load_module, snmp_verbosity, soft_purge, soft_purge, []}, + {load_module, snmpm_mpd, soft_purge, soft_purge, []}, + {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, {update, snmpa_mib, soft, soft_purge, soft_purge, []}, - {update, snmpa_agent, soft, soft_purge, soft_purge, []} + {update, snmpa_agent, soft, soft_purge, soft_purge, []}, + + {remove, {snmpm_net_if_mt, soft_purge, soft_purge}} ] }, {"4.21.5", [ - {load_module, snmpa, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, [snmpa_mib_lib]}, + {load_module, snmp_config, soft_purge, soft_purge, []}, + {load_module, snmp_conf, soft_purge, soft_purge, []}, + {load_module, snmp_community_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_framework_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_notification_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_standard_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, [snmp_conf]}, + + {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, + {load_module, snmpm, soft_purge, soft_purge, [snmp]}, + {load_module, snmp_log, soft_purge, soft_purge, []}, + {load_module, snmp_verbosity, soft_purge, soft_purge, []}, + {load_module, snmpm_mpd, soft_purge, soft_purge, []}, + + {load_module, snmpa, soft_purge, soft_purge, [snmp]}, + {load_module, snmp_target_mib, soft_purge, soft_purge, + [snmp_conf, snmpa_mib_lib]}, {load_module, snmpa_mib_lib, soft_purge, soft_purge, []}, {load_module, snmpa_trap, soft_purge, soft_purge, []}, {load_module, snmpa_vacm, soft_purge, soft_purge, []}, {update, snmpa_supervisor, soft, soft_purge, soft_purge, []}, {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, {update, snmpa_mib, soft, soft_purge, soft_purge, []}, - {update, snmpa_agent, soft, soft_purge, soft_purge, []} + {update, snmpa_agent, soft, soft_purge, soft_purge, []}, + + {remove, {snmpm_net_if_mt, soft_purge, soft_purge}} ] }, {"4.21.4", [ - {load_module, snmpa, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, [snmpa_mib_lib]}, + {load_module, snmp_config, soft_purge, soft_purge, []}, + {load_module, snmp_conf, soft_purge, soft_purge, []}, + {load_module, snmp_community_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_framework_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_notification_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_standard_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, [snmp_conf]}, + + {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, + {load_module, snmpm, soft_purge, soft_purge, [snmp]}, + {load_module, snmp_log, soft_purge, soft_purge, []}, + {load_module, snmp_verbosity, soft_purge, soft_purge, []}, + {load_module, snmpm_mpd, soft_purge, soft_purge, []}, + + {load_module, snmpa, soft_purge, soft_purge, [snmp]}, + {load_module, snmp_target_mib, soft_purge, soft_purge, + [snmp_conf, snmpa_mib_lib]}, {load_module, snmpa_mib_lib, soft_purge, soft_purge, []}, {load_module, snmpa_trap, soft_purge, soft_purge, []}, {update, snmpa_supervisor, soft, soft_purge, soft_purge, []}, {load_module, snmp_generic_mnesia, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, + {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, + [snmp_conf]}, {load_module, snmpa_vacm, soft_purge, soft_purge, []}, {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, {update, snmpa_mib, soft, soft_purge, soft_purge, []}, - {update, snmpa_agent, soft, soft_purge, soft_purge, []} + {update, snmpa_agent, soft, soft_purge, soft_purge, []}, + + {remove, {snmpm_net_if_mt, soft_purge, soft_purge}} ] }, {"4.21.3", [ - {load_module, snmpa, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, [snmpa_mib_lib]}, + {load_module, snmp_config, soft_purge, soft_purge, []}, + {load_module, snmp_conf, soft_purge, soft_purge, []}, + {load_module, snmp_community_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_framework_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_notification_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_standard_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, [snmp_conf]}, + + {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, + {load_module, snmpm, soft_purge, soft_purge, [snmp]}, + {load_module, snmp_log, soft_purge, soft_purge, []}, + {load_module, snmp_verbosity, soft_purge, soft_purge, []}, + {load_module, snmpm_mpd, soft_purge, soft_purge, []}, + + {load_module, snmpa, soft_purge, soft_purge, [snmp]}, + {load_module, snmp_target_mib, soft_purge, soft_purge, + [snmp_conf, snmpa_mib_lib]}, {load_module, snmpa_mib_lib, soft_purge, soft_purge, []}, {load_module, snmpa_trap, soft_purge, soft_purge, []}, {update, snmpa_supervisor, soft, soft_purge, soft_purge, []}, {load_module, snmp_generic_mnesia, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, + {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, + [snmp_conf]}, {load_module, snmpa_vacm, soft_purge, soft_purge, []}, {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, {update, snmpa_mib, soft, soft_purge, soft_purge, []}, - {update, snmpa_agent, soft, soft_purge, soft_purge, []} + {update, snmpa_agent, soft, soft_purge, soft_purge, []}, + + {remove, {snmpm_net_if_mt, soft_purge, soft_purge}} ] }, {"4.21.2", [ - {load_module, snmpa, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, [snmpa_mib_lib]}, + {load_module, snmp_config, soft_purge, soft_purge, []}, + {load_module, snmp_conf, soft_purge, soft_purge, []}, + {load_module, snmp_community_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_framework_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_notification_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_standard_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, [snmp_conf]}, + + {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, + {load_module, snmpm, soft_purge, soft_purge, [snmp]}, + {load_module, snmp_log, soft_purge, soft_purge, []}, + {load_module, snmp_verbosity, soft_purge, soft_purge, []}, + {load_module, snmpm_mpd, soft_purge, soft_purge, []}, + + {load_module, snmpa, soft_purge, soft_purge, [snmp]}, + {load_module, snmp_target_mib, soft_purge, soft_purge, + [snmp_conf, snmpa_mib_lib]}, {load_module, snmpa_mib_lib, soft_purge, soft_purge, []}, {update, snmpa_supervisor, soft, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, + {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, + [snmp_conf]}, {load_module, snmpa_vacm, soft_purge, soft_purge, []}, {load_module, snmpa_mpd, soft_purge, soft_purge, []}, {load_module, snmpa_set_lib, soft_purge, soft_purge, []}, @@ -267,17 +470,35 @@ {load_module, snmp_generic_mnesia, soft_purge, soft_purge, []}, {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, {update, snmpa_mib, soft, soft_purge, soft_purge, []}, - {update, snmpa_agent, soft, soft_purge, soft_purge, []} + {update, snmpa_agent, soft, soft_purge, soft_purge, []}, + + {remove, {snmpm_net_if_mt, soft_purge, soft_purge}} ] }, {"4.21.1", [ - {load_module, snmpa, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, [snmpa_mib_lib]}, + {load_module, snmp_config, soft_purge, soft_purge, []}, + {load_module, snmp_conf, soft_purge, soft_purge, []}, + {load_module, snmp_community_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_framework_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_notification_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_standard_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, [snmp_conf]}, + + {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, + {load_module, snmpm, soft_purge, soft_purge, [snmp]}, + {load_module, snmp_log, soft_purge, soft_purge, []}, + {load_module, snmp_verbosity, soft_purge, soft_purge, []}, + {load_module, snmpm_mpd, soft_purge, soft_purge, []}, + + {load_module, snmpa, soft_purge, soft_purge, [snmp]}, + {load_module, snmp_target_mib, soft_purge, soft_purge, + [snmp_conf, snmpa_mib_lib]}, {load_module, snmpa_mib_lib, soft_purge, soft_purge, []}, {update, snmpa_supervisor, soft, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, + {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, + [snmp_conf]}, {load_module, snmpa_vacm, soft_purge, soft_purge, []}, {load_module, snmpa_mpd, soft_purge, soft_purge, []}, {load_module, snmpa_set_lib, soft_purge, soft_purge, []}, @@ -286,90 +507,46 @@ {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, {update, snmpa_mib, soft, soft_purge, soft_purge, []}, {update, snmpa_agent, soft, soft_purge, soft_purge, []}, - {update, snmp_note_store, soft, soft_purge, soft_purge, []} + {update, snmp_note_store, soft, soft_purge, soft_purge, []}, + + {remove, {snmpm_net_if_mt, soft_purge, soft_purge}} ] }, {"4.21", [ - {load_module, snmpa, soft_purge, soft_purge, []}, + {load_module, snmp_config, soft_purge, soft_purge, []}, + {load_module, snmp_conf, soft_purge, soft_purge, []}, + {load_module, snmp_community_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_framework_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_notification_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_standard_mib, soft_purge, soft_purge, [snmp_conf]}, + {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, [snmp_conf]}, + + {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, + {load_module, snmpm, soft_purge, soft_purge, [snmp]}, + {load_module, snmp_log, soft_purge, soft_purge, []}, + {load_module, snmp_verbosity, soft_purge, soft_purge, []}, + {load_module, snmpm_mpd, soft_purge, soft_purge, []}, + + {load_module, snmpa, soft_purge, soft_purge, [snmp]}, {load_module, snmpa_mib_lib, soft_purge, soft_purge, []}, {update, snmpa_supervisor, soft, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, + {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, + [snmp_conf]}, {load_module, snmpa_vacm, soft_purge, soft_purge, []}, {load_module, snmpa_mpd, soft_purge, soft_purge, []}, {load_module, snmpa_set_lib, soft_purge, soft_purge, []}, {load_module, snmpa_trap, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, []}, + {load_module, snmp_target_mib, soft_purge, soft_purge, + [snmp_conf, snmpa_mib_lib]}, {load_module, snmp_generic_mnesia, soft_purge, soft_purge, []}, {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, {update, snmpa_mib, soft, soft_purge, soft_purge, []}, {update, snmpa_agent, soft, soft_purge, soft_purge, []}, - {update, snmp_note_store, soft, soft_purge, soft_purge, []} - ] - }, - {"4.20.1", - [ - {load_module, snmpa, soft_purge, soft_purge, []}, - {load_module, snmpa_mib_lib, soft_purge, soft_purge, []}, - {update, snmpa_supervisor, soft, soft_purge, soft_purge, []}, - - {load_module, snmpa_vacm, soft_purge, soft_purge, []}, - {load_module, snmpa_set_lib, soft_purge, soft_purge, []}, - {load_module, snmpa_trap, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, - {load_module, snmpm, soft_purge, soft_purge, - [snmpm_server, snmpm_config, snmp_config]}, - {load_module, snmp_conf, soft_purge, soft_purge, []}, - {load_module, snmp_config, soft_purge, soft_purge, []}, - {load_module, snmpm_mpd, soft_purge, soft_purge, - [snmp_conf, snmp_config, snmpm_config]}, - {load_module, snmpa_mpd, soft_purge, soft_purge, - [snmp_conf, snmp_config]}, - {load_module, snmpa_conf, soft_purge, soft_purge, [snmp_config]}, {update, snmp_note_store, soft, soft_purge, soft_purge, []}, - {load_module, snmp_generic_mnesia, soft_purge, soft_purge, []}, - {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, - {update, snmpa_mib, soft, soft_purge, soft_purge, []}, - {update, snmpa_agent, soft, soft_purge, soft_purge, [snmpa_mpd]}, - {update, snmpm_config, soft, soft_purge, soft_purge, [snmp_conf]}, - {update, snmpm_server, soft, soft_purge, soft_purge, - [snmpm_net_if, snmpm_mpd, snmpm_config]}, - {update, snmpm_net_if, soft, soft_purge, soft_purge, - [snmp_conf, snmpm_mpd, snmpm_config]} - ] - }, - {"4.20", - [ - {load_module, snmpa, soft_purge, soft_purge, []}, - {load_module, snmpa_mib_lib, soft_purge, soft_purge, []}, - {update, snmpa_supervisor, soft, soft_purge, soft_purge, []}, - {load_module, snmpa_vacm, soft_purge, soft_purge, []}, - {load_module, snmpa_set_lib, soft_purge, soft_purge, []}, - {load_module, snmpa_trap, soft_purge, soft_purge, []}, - {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, - {load_module, snmp_target_mib, soft_purge, soft_purge, [snmp_conf]}, - {load_module, snmpm, soft_purge, soft_purge, - [snmpm_server, snmpm_config, snmp_config]}, - {load_module, snmp_conf, soft_purge, soft_purge, []}, - {load_module, snmp_config, soft_purge, soft_purge, []}, - {load_module, snmpm_mpd, soft_purge, soft_purge, - [snmp_conf, snmp_config, snmpm_config]}, - {load_module, snmpa_mpd, soft_purge, soft_purge, - [snmp_conf, snmp_config]}, - {load_module, snmpa_conf, soft_purge, soft_purge, [snmp_config]}, - {update, snmp_note_store, soft, soft_purge, soft_purge, []}, - {load_module, snmp_generic_mnesia, soft_purge, soft_purge, []}, - {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, - {update, snmpa_mib, soft, soft_purge, soft_purge, []}, - {update, snmpa_agent, soft, soft_purge, soft_purge, [snmpa_mpd]}, - {update, snmpm_config, soft, soft_purge, soft_purge, [snmp_conf]}, - {update, snmpm_server, soft, soft_purge, soft_purge, - [snmpm_net_if, snmpm_mpd, snmpm_config]}, - {update, snmpm_net_if, soft, soft_purge, soft_purge, - [snmp_conf, snmpm_mpd, snmpm_config]} + {remove, {snmpm_net_if_mt, soft_purge, soft_purge}} ] } ] diff --git a/lib/snmp/src/app/snmp.erl b/lib/snmp/src/app/snmp.erl index 3e0f05e604..fc03757e3f 100644 --- a/lib/snmp/src/app/snmp.erl +++ b/lib/snmp/src/app/snmp.erl @@ -50,6 +50,7 @@ read_mib/1, log_to_txt/5, log_to_txt/6, log_to_txt/7, + log_to_io/4, log_to_io/5, log_to_io/6, change_log_size/2, octet_string_to_bits/1, bits_to_octet_string/1, @@ -843,6 +844,12 @@ log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Start) -> log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Start, Stop) -> snmp_log:log_to_txt(LogName, LogFile, LogDir, Mibs, OutFile, Start, Stop). +log_to_io(LogDir, Mibs, LogName, LogFile) -> + snmp_log:log_to_io(LogName, LogFile, LogDir, Mibs). +log_to_io(LogDir, Mibs, LogName, LogFile, Start) -> + snmp_log:log_to_io(LogName, LogFile, LogDir, Mibs, Start). +log_to_io(LogDir, Mibs, LogName, LogFile, Start, Stop) -> + snmp_log:log_to_io(LogName, LogFile, LogDir, Mibs, Start, Stop). change_log_size(LogName, NewSize) -> snmp_log:change_size(LogName, NewSize). diff --git a/lib/snmp/src/compile/snmpc_lib.erl b/lib/snmp/src/compile/snmpc_lib.erl index 38bb8f3ac6..6e833b6c44 100644 --- a/lib/snmp/src/compile/snmpc_lib.erl +++ b/lib/snmp/src/compile/snmpc_lib.erl @@ -704,23 +704,29 @@ check_trap_name(EnterpriseName, Line, MEs) -> %% This information is needed to be able to create default instrumentation %% functions for tables. %%---------------------------------------------------------------------- -make_table_info(Line, _TableName, {augments,SrcTableEntry}, ColumnMEs) -> +make_table_info(Line, TableName, {augments, SrcTableEntry}, ColumnMEs) -> ColMEs = lists:keysort(#me.oid, ColumnMEs), - %% Nbr_of_Cols = length(ColMEs), + Nbr_of_Cols = length(ColMEs), MEs = ColMEs ++ (get(cdata))#cdata.mes, - Aug = case lookup(SrcTableEntry,MEs) of + Aug = case lookup(SrcTableEntry, MEs) of false -> print_error("Cannot AUGMENT the non-existing table entry ~p", - [SrcTableEntry],Line), + [SrcTableEntry], Line), {augments, error}; - {value,ME} -> - {augments, {SrcTableEntry,translate_type(ME#me.asn1_type)}} + {value, ME} -> + {augments, {SrcTableEntry, translate_type(ME#me.asn1_type)}} end, - #table_info{index_types = Aug}; -make_table_info(Line, TableName, {indexes,[]}, _ColumnMEs) -> + FirstNonIdxCol = augments_first_non_index_column(ColMEs), + NoAccs = list_not_accessible(FirstNonIdxCol, ColMEs), + FirstAcc = first_accessible(TableName, ColMEs), + #table_info{nbr_of_cols = Nbr_of_Cols, + first_accessible = FirstAcc, + not_accessible = NoAccs, + index_types = Aug}; +make_table_info(Line, TableName, {indexes, []}, _ColumnMEs) -> print_error("Table ~w lacks indexes.", [TableName],Line), #table_info{}; -make_table_info(Line, TableName, {indexes,Indexes}, ColumnMEs) -> +make_table_info(Line, TableName, {indexes, Indexes}, ColumnMEs) -> ColMEs = lists:keysort(#me.oid, ColumnMEs), NonImpliedIndexes = lists:map(fun non_implied_name/1, Indexes), test_read_create_access(ColMEs, Line, dummy), @@ -860,11 +866,17 @@ get_asn1_type(ColumnName, MEs, Line) -> end. test_index_positions(Line, Indexes, ColMEs) -> - TLI = lists:filter(fun (IndexName) -> - is_table_local_index(IndexName,ColMEs) end, - Indexes), + IsTLI = fun(IndexName) -> is_table_local_index(IndexName, ColMEs) end, + TLI = lists:filter(IsTLI, Indexes), test_index_positions_impl(Line, TLI, ColMEs). +%% An table that augments another cannot conatin any index, +%% so the first non-index column is always the first column. +augments_first_non_index_column([]) -> + none; +augments_first_non_index_column([#me{oid=Col}|_ColMEs]) -> + Col. + %% Returns the first non-index column | none test_index_positions_impl(_Line, [], []) -> none; test_index_positions_impl(_Line, [], [#me{oid=Col}|_ColMEs]) -> diff --git a/lib/snmp/src/manager/depend.mk b/lib/snmp/src/manager/depend.mk index 0e7e9e3df7..2e7783c8ed 100644 --- a/lib/snmp/src/manager/depend.mk +++ b/lib/snmp/src/manager/depend.mk @@ -2,7 +2,7 @@ # %CopyrightBegin% # -# Copyright Ericsson AB 2004-2009. All Rights Reserved. +# Copyright Ericsson AB 2004-2012. All Rights Reserved. # # The contents of this file are subject to the Erlang Public License, # Version 1.1, (the "License"); you may not use this file except in @@ -49,6 +49,13 @@ $(EBIN)/snmpm_net_if.$(EMULATOR): \ snmpm_net_if.erl \ snmpm_network_interface.erl +$(EBIN)/snmpm_net_if_mt.$(EMULATOR): \ + ../../include/snmp_types.hrl \ + ../misc/snmp_debug.hrl \ + ../misc/snmp_verbosity.hrl \ + snmpm_net_if_mt.erl \ + snmpm_network_interface.erl + $(EBIN)/snmpm_server.$(EMULATOR): \ ../../include/snmp_types.hrl \ ../../include/STANDARD-MIB.hrl \ diff --git a/lib/snmp/src/manager/modules.mk b/lib/snmp/src/manager/modules.mk index 79f3dd65d9..d46545ea3f 100644 --- a/lib/snmp/src/manager/modules.mk +++ b/lib/snmp/src/manager/modules.mk @@ -2,7 +2,7 @@ # %CopyrightBegin% # -# Copyright Ericsson AB 2004-2009. All Rights Reserved. +# Copyright Ericsson AB 2004-2012. All Rights Reserved. # # The contents of this file are subject to the Erlang Public License, # Version 1.1, (the "License"); you may not use this file except in @@ -31,6 +31,7 @@ MODULES = \ snmpm_mpd \ snmpm_misc_sup \ snmpm_net_if \ + snmpm_net_if_mt \ snmpm_net_if_filter \ snmpm_server \ snmpm_server_sup \ diff --git a/lib/snmp/src/manager/snmpm.erl b/lib/snmp/src/manager/snmpm.erl index 6d2ac8d747..89eaee9f80 100644 --- a/lib/snmp/src/manager/snmpm.erl +++ b/lib/snmp/src/manager/snmpm.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2011. All Rights Reserved. +%% Copyright Ericsson AB 2004-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -75,8 +75,11 @@ %% %% Logging + log_to_txt/1, log_to_txt/2, log_to_txt/3, log_to_txt/4, log_to_txt/5, log_to_txt/6, log_to_txt/7, + log_to_io/1, log_to_io/2, log_to_io/3, + log_to_io/4, log_to_io/5, log_to_io/6, change_log_size/1, get_log_type/0, set_log_type/1, @@ -1371,6 +1374,9 @@ cancel_async_request(UserId, ReqId) -> %%%----------------------------------------------------------------- %%% Audit Trail Log functions (for backward compatibility) %%%----------------------------------------------------------------- + +log_to_txt(LogDir) -> + log_to_txt(LogDir, []). log_to_txt(LogDir, Mibs) -> OutFile = "snmpm_log.txt", LogName = ?audit_trail_log_name, @@ -1391,6 +1397,23 @@ log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Start, Stop) -> snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Start, Stop). +log_to_io(LogDir) -> + log_to_io(LogDir, []). +log_to_io(LogDir, Mibs) -> + LogName = ?audit_trail_log_name, + LogFile = ?audit_trail_log_file, + snmp:log_to_io(LogDir, Mibs, LogName, LogFile). +log_to_io(LogDir, Mibs, LogName) -> + LogFile = ?audit_trail_log_file, + snmp:log_to_io(LogDir, Mibs, LogName, LogFile). +log_to_io(LogDir, Mibs, LogName, LogFile) -> + snmp:log_to_io(LogDir, Mibs, LogName, LogFile). +log_to_io(LogDir, Mibs, LogName, LogFile, Start) -> + snmp:log_to_io(LogDir, Mibs, LogName, LogFile, Start). +log_to_io(LogDir, Mibs, LogName, LogFile, Start, Stop) -> + snmp:log_to_io(LogDir, Mibs, LogFile, Start, Stop). + + change_log_size(NewSize) -> LogName = ?audit_trail_log_name, snmp:change_log_size(LogName, NewSize). diff --git a/lib/snmp/src/manager/snmpm_config.erl b/lib/snmp/src/manager/snmpm_config.erl index c2e57abddb..5bbf9e5542 100644 --- a/lib/snmp/src/manager/snmpm_config.erl +++ b/lib/snmp/src/manager/snmpm_config.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2011. All Rights Reserved. +%% Copyright Ericsson AB 2004-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in diff --git a/lib/snmp/src/manager/snmpm_mpd.erl b/lib/snmp/src/manager/snmpm_mpd.erl index 103c87d32b..883224143e 100644 --- a/lib/snmp/src/manager/snmpm_mpd.erl +++ b/lib/snmp/src/manager/snmpm_mpd.erl @@ -110,9 +110,9 @@ process_msg(Msg, Domain, Addr, Port, State, NoteStore, Logger) -> #message{version = 'version-2', vsn_hdr = Community, data = Data} when State#state.v2c =:= true -> HS = ?empty_msg_size + length(Community), - (catch process_v1_v2c_msg('version-2', NoteStore, Msg, - Domain, Addr, Port, - Community, Data, HS, Logger)); + process_v1_v2c_msg('version-2', NoteStore, Msg, + Domain, Addr, Port, + Community, Data, HS, Logger); %% Version 3 #message{version = 'version-3', vsn_hdr = H, data = Data} diff --git a/lib/snmp/src/manager/snmpm_net_if_mt.erl b/lib/snmp/src/manager/snmpm_net_if_mt.erl new file mode 100644 index 0000000000..3e87f6a7fb --- /dev/null +++ b/lib/snmp/src/manager/snmpm_net_if_mt.erl @@ -0,0 +1,1259 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2004-2012. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% + +-module(snmpm_net_if_mt). + +-behaviour(gen_server). +-behaviour(snmpm_network_interface). + + +%% Network Interface callback functions +-export([ + start_link/2, + stop/1, + send_pdu/6, % Backward compatibillity + send_pdu/7, % Backward compatibillity + send_pdu/8, + + inform_response/4, + + note_store/2, + + info/1, + verbosity/2, + %% system_info_updated/2, + get_log_type/1, set_log_type/2, + filter_reset/1 + ]). + +%% gen_server callbacks +-export([init/1, handle_call/3, handle_cast/2, handle_info/2, + code_change/3, terminate/2]). + +-define(SNMP_USE_V3, true). +-include("snmp_types.hrl"). +-include("snmpm_internal.hrl"). +-include("snmpm_atl.hrl"). +-include("snmp_debug.hrl"). + +%% -define(VMODULE,"NET_IF"). +-include("snmp_verbosity.hrl"). + +-record(state, + { + server, + note_store, + sock, + mpd_state, + log, + irb = auto, % auto | {user, integer()} + irgc, + filter + }). + + +-define(DEFAULT_FILTER_MODULE, snmpm_net_if_filter). +-define(DEFAULT_FILTER_OPTS, [{module, ?DEFAULT_FILTER_MODULE}]). + +-ifdef(snmp_debug). +-define(GS_START_LINK(Args), + gen_server:start_link(?MODULE, Args, [{debug,[trace]}])). +-else. +-define(GS_START_LINK(Args), + gen_server:start_link(?MODULE, Args, [])). +-endif. + + +-define(IRGC_TIMEOUT, timer:minutes(5)). + +-define(ATL_SEQNO_INITIAL, 1). +-define(ATL_SEQNO_MAX, 2147483647). + + +%%%------------------------------------------------------------------- +%%% API +%%%------------------------------------------------------------------- +start_link(Server, NoteStore) -> + ?d("start_link -> entry with" + "~n Server: ~p" + "~n NoteStore: ~p", [Server, NoteStore]), + Args = [Server, NoteStore], + ?GS_START_LINK(Args). + +stop(Pid) -> + call(Pid, stop). + +send_pdu(Pid, Pdu, Vsn, MsgData, Addr, Port) -> + send_pdu(Pid, Pdu, Vsn, MsgData, Addr, Port, ?DEFAULT_EXTRA_INFO). + +send_pdu(Pid, Pdu, Vsn, MsgData, Addr, Port, ExtraInfo) -> + Domain = snmpm_config:default_transport_domain(), + send_pdu(Pid, Pdu, Vsn, MsgData, Domain, Addr, Port, ExtraInfo). + +send_pdu(Pid, Pdu, Vsn, MsgData, Domain, Addr, Port, ExtraInfo) + when is_record(Pdu, pdu) -> + ?d("send_pdu -> entry with" + "~n Pid: ~p" + "~n Pdu: ~p" + "~n Vsn: ~p" + "~n MsgData: ~p" + "~n Domain: ~p" + "~n Addr: ~p" + "~n Port: ~p", [Pid, Pdu, Vsn, MsgData, Domain, Addr, Port]), + cast(Pid, {send_pdu, Pdu, Vsn, MsgData, Domain, Addr, Port, ExtraInfo}). + +note_store(Pid, NoteStore) -> + call(Pid, {note_store, NoteStore}). + +inform_response(Pid, Ref, Addr, Port) -> + cast(Pid, {inform_response, Ref, Addr, Port}). + +info(Pid) -> + call(Pid, info). + +verbosity(Pid, V) -> + call(Pid, {verbosity, V}). + +%% system_info_updated(Pid, What) -> +%% call(Pid, {system_info_updated, What}). + +get_log_type(Pid) -> + call(Pid, get_log_type). + +set_log_type(Pid, NewType) -> + call(Pid, {set_log_type, NewType}). + +filter_reset(Pid) -> + cast(Pid, filter_reset). + + +%%%------------------------------------------------------------------- +%%% Callback functions from gen_server +%%%------------------------------------------------------------------- + +%%-------------------------------------------------------------------- +%% Func: init/1 +%% Returns: {ok, State} | +%% {ok, State, Timeout} | +%% ignore | +%% {stop, Reason} +%%-------------------------------------------------------------------- +init([Server, NoteStore]) -> + ?d("init -> entry with" + "~n Server: ~p" + "~n NoteStore: ~p", [Server, NoteStore]), + case (catch do_init(Server, NoteStore)) of + {error, Reason} -> + {stop, Reason}; + {ok, State} -> + {ok, State} + end. + +do_init(Server, NoteStore) -> + process_flag(trap_exit, true), + + %% -- Prio -- + {ok, Prio} = snmpm_config:system_info(prio), + process_flag(priority, Prio), + + %% -- Create inform request table -- + %% This should really be protected, but it also needs to + %% be writable for the worker processes, so... + ets:new(snmpm_inform_request_table, + [set, public, named_table, {keypos, 1}]), + + %% -- Verbosity -- + {ok, Verbosity} = snmpm_config:system_info(net_if_verbosity), + put(sname, mnif), + put(verbosity, Verbosity), + ?vlog("starting", []), + + %% -- MPD -- + {ok, Vsns} = snmpm_config:system_info(versions), + MpdState = snmpm_mpd:init(Vsns), + ?vdebug("MpdState: ~w", [MpdState]), + + %% -- Module dependent options -- + {ok, Opts} = snmpm_config:system_info(net_if_options), + + %% -- Inform response behaviour -- + {ok, IRB} = snmpm_config:system_info(net_if_irb), + IrGcRef = irgc_start(IRB), + + %% -- Socket -- + SndBuf = get_opt(Opts, sndbuf, default), + RecBuf = get_opt(Opts, recbuf, default), + BindTo = get_opt(Opts, bind_to, false), + NoReuse = get_opt(Opts, no_reuse, false), + {ok, Port} = snmpm_config:system_info(port), + {ok, Sock} = do_open_port(Port, SndBuf, RecBuf, BindTo, NoReuse), + + %% Flow control -- + FilterOpts = get_opt(Opts, filter, []), + FilterMod = create_filter(FilterOpts), + ?vdebug("FilterMod: ~w", [FilterMod]), + + %% -- Audit trail log --- + {ok, ATL} = snmpm_config:system_info(audit_trail_log), + Log = do_init_log(ATL), + ?vdebug("Log: ~w", [Log]), + + %% -- Initiate counters --- + init_counters(), + + %% -- We are done --- + State = #state{server = Server, + note_store = NoteStore, + mpd_state = MpdState, + sock = Sock, + log = Log, + irb = IRB, + irgc = IrGcRef, + filter = FilterMod}, + ?vdebug("started", []), + {ok, State}. + + +%% Open port +do_open_port(Port, SendSz, RecvSz, BindTo, NoReuse) -> + ?vtrace("do_open_port -> entry with" + "~n Port: ~p" + "~n SendSz: ~p" + "~n RecvSz: ~p" + "~n BindTo: ~p" + "~n NoReuse: ~p", [Port, SendSz, RecvSz, BindTo, NoReuse]), + IpOpts1 = bind_to(BindTo), + IpOpts2 = no_reuse(NoReuse), + IpOpts3 = recbuf(RecvSz), + IpOpts4 = sndbuf(SendSz), + IpOpts = [binary | IpOpts1 ++ IpOpts2 ++ IpOpts3 ++ IpOpts4], + OpenRes = + case init:get_argument(snmpm_fd) of + {ok, [[FdStr]]} -> + Fd = list_to_integer(FdStr), + gen_udp:open(0, [{fd, Fd}|IpOpts]); + error -> + gen_udp:open(Port, IpOpts) + end, + case OpenRes of + {error, _} = Error -> + throw(Error); + OK -> + OK + end. + +bind_to(true) -> + case snmpm_config:system_info(address) of + {ok, Addr} when is_list(Addr) -> + [{ip, list_to_tuple(Addr)}]; + {ok, Addr} -> + [{ip, Addr}]; + _ -> + [] + end; +bind_to(_) -> + []. + +no_reuse(false) -> + [{reuseaddr, true}]; +no_reuse(_) -> + []. + +recbuf(default) -> + []; +recbuf(Sz) -> + [{recbuf, Sz}]. + +sndbuf(default) -> + []; +sndbuf(Sz) -> + [{sndbuf, Sz}]. + + +create_filter(Opts) when is_list(Opts) -> + case get_opt(Opts, module, ?DEFAULT_FILTER_MODULE) of + ?DEFAULT_FILTER_MODULE = Mod -> + Mod; + Module -> + snmpm_network_interface_filter:verify(Module), + Module + end; +create_filter(BadOpts) -> + throw({error, {bad_filter_opts, BadOpts}}). + + +%% ---------------------------------------------------------------------- +%% Audit Trail Logger +%% ---------------------------------------------------------------------- + +%% Open log +do_init_log(false) -> + ?vtrace("do_init_log(false) -> entry", []), + undefined; +do_init_log(true) -> + ?vtrace("do_init_log(true) -> entry", []), + {ok, Type} = snmpm_config:system_info(audit_trail_log_type), + {ok, Dir} = snmpm_config:system_info(audit_trail_log_dir), + {ok, Size} = snmpm_config:system_info(audit_trail_log_size), + {ok, Repair} = snmpm_config:system_info(audit_trail_log_repair), + Name = ?audit_trail_log_name, + File = filename:absname(?audit_trail_log_file, Dir), + case snmpm_config:system_info(audit_trail_log_seqno) of + {ok, true} -> + Initial = ?ATL_SEQNO_INITIAL, + Max = ?ATL_SEQNO_MAX, + Module = snmpm_config, + Function = increment_counter, + Args = [atl_seqno, Initial, Max], + SeqNoGen = {Module, Function, Args}, + case snmp_log:create(Name, File, SeqNoGen, Size, Repair, true) of + {ok, Log} -> + ?vdebug("log created: ~w", [Log]), + {Name, Log, Type}; + {error, Reason} -> + throw({error, {failed_create_audit_log, Reason}}) + end; + _ -> + case snmp_log:create(Name, File, Size, Repair, true) of + {ok, Log} -> + ?vdebug("log created: ~w", [Log]), + {Name, Log, Type}; + {error, Reason} -> + throw({error, {failed_create_audit_log, Reason}}) + end + end. + + +%% ---------------------------------------------------------------------- + +%%-------------------------------------------------------------------- +%% Func: handle_call/3 +%% Returns: {reply, Reply, State} | +%% {reply, Reply, State, Timeout} | +%% {noreply, State} | +%% {noreply, State, Timeout} | +%% {stop, Reason, Reply, State} | (terminate/2 is called) +%% {stop, Reason, State} (terminate/2 is called) +%%-------------------------------------------------------------------- +handle_call({verbosity, Verbosity}, _From, State) -> + ?vlog("received verbosity request", []), + put(verbosity, Verbosity), + {reply, ok, State}; + +%% handle_call({system_info_updated, What}, _From, State) -> +%% ?vlog("received system_info_updated request with What = ~p", [What]), +%% {NewState, Reply} = handle_system_info_updated(State, What), +%% {reply, Reply, NewState}; + +handle_call(get_log_type, _From, State) -> + ?vlog("received get-log-type request", []), + Reply = (catch handle_get_log_type(State)), + {reply, Reply, State}; + +handle_call({set_log_type, NewType}, _From, State) -> + ?vlog("received set-log-type request with NewType = ~p", [NewType]), + {NewState, Reply} = (catch handle_set_log_type(State, NewType)), + {reply, Reply, NewState}; + +handle_call({note_store, Pid}, _From, State) -> + ?vlog("received new note_store: ~w", [Pid]), + {reply, ok, State#state{note_store = Pid}}; + +handle_call(stop, _From, State) -> + ?vlog("received stop request", []), + Reply = ok, + {stop, normal, Reply, State}; + +handle_call(info, _From, State) -> + ?vlog("received info request", []), + Reply = get_info(State), + {reply, Reply, State}; + +handle_call(Req, From, State) -> + warning_msg("received unknown request (from ~p): ~n~p", [Req, From]), + {reply, {error, {invalid_request, Req}}, State}. + + +%%-------------------------------------------------------------------- +%% Func: handle_cast/2 +%% Returns: {noreply, State} | +%% {noreply, State, Timeout} | +%% {stop, Reason, State} (terminate/2 is called) +%%-------------------------------------------------------------------- +handle_cast({send_pdu, Pdu, Vsn, MsgData, Domain, Addr, Port, ExtraInfo}, + State) -> + ?vlog("received send_pdu message with" + "~n Pdu: ~p" + "~n Vsn: ~p" + "~n MsgData: ~p" + "~n Domain: ~p" + "~n Addr: ~p" + "~n Port: ~p", [Pdu, Vsn, MsgData, Domain, Addr, Port]), + maybe_process_extra_info(ExtraInfo), + handle_send_pdu(Pdu, Vsn, MsgData, Domain, Addr, Port, State), + {noreply, State}; + +handle_cast({inform_response, Ref, Addr, Port}, State) -> + ?vlog("received inform_response message with" + "~n Ref: ~p" + "~n Addr: ~p" + "~n Port: ~p", [Ref, Addr, Port]), + handle_inform_response(Ref, Addr, Port, State), + {noreply, State}; + +handle_cast(filter_reset, State) -> + ?vlog("received filter_reset message", []), + reset_counters(), + {noreply, State}; + +handle_cast(Msg, State) -> + warning_msg("received unknown message: ~n~p", [Msg]), + {noreply, State}. + + +%%-------------------------------------------------------------------- +%% Func: handle_info/2 +%% Returns: {noreply, State} | +%% {noreply, State, Timeout} | +%% {stop, Reason, State} (terminate/2 is called) +%%-------------------------------------------------------------------- +handle_info({udp, Sock, Ip, Port, Bytes}, #state{sock = Sock} = State) -> + ?vlog("received ~w bytes from ~p:~p", [size(Bytes), Ip, Port]), + handle_udp(Ip, Port, Bytes, State), + {noreply, State}; + +handle_info(inform_response_gc, State) -> + ?vlog("received inform_response_gc message", []), + State2 = handle_inform_response_gc(State), + {noreply, State2}; + +handle_info({disk_log, _Node, Log, Info}, State) -> + ?vlog("received disk_log message: " + "~n Info: ~p", [Info]), + State2 = handle_disk_log(Log, Info, State), + {noreply, State2}; + +handle_info({'DOWN', _MRef, process, Pid, {net_if_worker, ExitStatus}}, + State) -> + ?vdebug("received DOWN message from net_if-worker: " + "~n ExitStatus: ~p", [ExitStatus]), + handle_worker_exit(Pid, ExitStatus), + {noreply, State}; + +handle_info(Info, State) -> + warning_msg("received unknown info: ~n~p", [Info]), + {noreply, State}. + + +%%-------------------------------------------------------------------- +%% Func: terminate/2 +%% Purpose: Shutdown the server +%% Returns: any (ignored by gen_server) +%%-------------------------------------------------------------------- +terminate(Reason, #state{log = Log, irgc = IrGcRef}) -> + ?vdebug("terminate: ~p", [Reason]), + irgc_stop(IrGcRef), + %% Close logs + do_close_log(Log), + ok. + + +do_close_log({Log, _Type}) -> + (catch snmp_log:sync(Log)), + (catch snmp_log:close(Log)), + ok; +do_close_log(_) -> + ok. + + +%%---------------------------------------------------------------------- +%% Func: code_change/3 +%% Purpose: Convert process state when code is changed +%% Returns: {ok, NewState} +%%---------------------------------------------------------------------- + +code_change(_Vsn, State, _Extra) -> + ?d("code_change -> entry with" + "~n Vsn: ~p" + "~n State: ~p" + "~n Extra: ~p", [_Vsn, State, _Extra]), + {ok, State}. + + +%%%------------------------------------------------------------------- +%%% Internal functions +%%%------------------------------------------------------------------- + +handle_udp(Addr, Port, Bytes, State) -> + Verbosity = get(verbosity), + spawn_opt(fun() -> + Log = worker_init(State, Verbosity), + Res = (catch maybe_handle_recv_msg( + Addr, Port, Bytes, + State#state{log = Log})), + worker_exit(udp, {Addr, Port}, Res) + end, + [monitor]). + + +maybe_handle_recv_msg(Addr, Port, Bytes, #state{filter = FilterMod} = State) -> + case (catch FilterMod:accept_recv(Addr, Port)) of + false -> + %% Drop the received packet + inc(netIfMsgInDrops), + ok; + _ -> + handle_recv_msg(Addr, Port, Bytes, State) + end. + + +handle_recv_msg(Addr, Port, Bytes, #state{server = Pid}) + when is_binary(Bytes) andalso (size(Bytes) =:= 0) -> + Pid ! {snmp_error, {empty_message, Addr, Port}, Addr, Port}, + ok; + +handle_recv_msg(Addr, Port, Bytes, + #state{server = Pid, + note_store = NoteStore, + mpd_state = MpdState, + sock = Sock, + log = Log} = State) -> + Domain = snmp_conf:which_domain(Addr), % What the ****... + Logger = logger(Log, read, Addr, Port), + case (catch snmpm_mpd:process_msg(Bytes, Domain, Addr, Port, + MpdState, NoteStore, Logger)) of + + {ok, Vsn, Pdu, MS, ACM} -> + maybe_handle_recv_pdu(Addr, Port, Vsn, Pdu, MS, ACM, + Logger, State); + + {discarded, Reason, Report} -> + ?vdebug("discarded: ~p", [Reason]), + ErrorInfo = {failed_processing_message, Reason}, + Pid ! {snmp_error, ErrorInfo, Addr, Port}, + maybe_udp_send(State#state.filter, Sock, Addr, Port, Report), + ok; + + {discarded, Reason} -> + ?vdebug("discarded: ~p", [Reason]), + ErrorInfo = {failed_processing_message, Reason}, + Pid ! {snmp_error, ErrorInfo, Addr, Port}, + ok; + + Error -> + error_msg("processing of received message failed: " + "~n ~p", [Error]), + ok + end. + + +maybe_handle_recv_pdu(Addr, Port, + Vsn, #pdu{type = Type} = Pdu, PduMS, ACM, + Logger, + #state{filter = FilterMod} = State) -> + case (catch FilterMod:accept_recv_pdu(Addr, Port, Type)) of + false -> + inc(netIfPduInDrops), + ok; + _ -> + handle_recv_pdu(Addr, Port, Vsn, Pdu, PduMS, ACM, Logger, State) + end; +maybe_handle_recv_pdu(Addr, Port, Vsn, Trap, PduMS, ACM, Logger, + #state{filter = FilterMod} = State) + when is_record(Trap, trappdu) -> + case (catch FilterMod:accept_recv_pdu(Addr, Port, trappdu)) of + false -> + inc(netIfPduInDrops), + ok; + _ -> + handle_recv_pdu(Addr, Port, Vsn, Trap, PduMS, ACM, Logger, State) + end; +maybe_handle_recv_pdu(Addr, Port, Vsn, Pdu, PduMS, ACM, Logger, State) -> + handle_recv_pdu(Addr, Port, Vsn, Pdu, PduMS, ACM, Logger, State). + + +handle_recv_pdu(Addr, Port, + Vsn, #pdu{type = 'inform-request'} = Pdu, _PduMS, ACM, + Logger, #state{server = Pid, irb = IRB} = State) -> + handle_inform_request(IRB, Pid, Vsn, Pdu, ACM, + Addr, Port, Logger, State); +handle_recv_pdu(Addr, Port, + _Vsn, #pdu{type = report} = Pdu, _PduMS, ok, + _Logger, + #state{server = Pid} = _State) -> + ?vtrace("received report - ok", []), + Pid ! {snmp_report, {ok, Pdu}, Addr, Port}, + ok; +handle_recv_pdu(Addr, Port, + _Vsn, #pdu{type = report} = Pdu, _PduMS, + {error, ReqId, Reason}, + _Logger, + #state{server = Pid} = _State) -> + ?vtrace("received report - error", []), + Pid ! {snmp_report, {error, ReqId, Reason, Pdu}, Addr, Port}, + ok; +handle_recv_pdu(Addr, Port, + _Vsn, #pdu{type = 'snmpv2-trap'} = Pdu, _PduMS, _ACM, + _Logger, + #state{server = Pid} = _State) -> + ?vtrace("received snmpv2-trap", []), + Pid ! {snmp_trap, Pdu, Addr, Port}, + ok; +handle_recv_pdu(Addr, Port, + _Vsn, Trap, _PduMS, _ACM, + _Logger, + #state{server = Pid} = _State) when is_record(Trap, trappdu) -> + ?vtrace("received trappdu", []), + Pid ! {snmp_trap, Trap, Addr, Port}, + ok; +handle_recv_pdu(Addr, Port, + _Vsn, Pdu, _PduMS, _ACM, + _Logger, + #state{server = Pid} = _State) when is_record(Pdu, pdu) -> + ?vtrace("received pdu", []), + Pid ! {snmp_pdu, Pdu, Addr, Port}, + ok; +handle_recv_pdu(_Addr, _Port, _Vsn, Pdu, _PduMS, ACM, _Logger, _State) -> + ?vlog("received unexpected pdu: " + "~n Pdu: ~p" + "~n ACM: ~p", [Pdu, ACM]), + ok. + + +handle_inform_request(auto, Pid, Vsn, Pdu, ACM, Addr, Port, Logger, State) -> + ?vtrace("received inform-request (true)", []), + Pid ! {snmp_inform, ignore, Pdu, Addr, Port}, + RePdu = make_response_pdu(Pdu), + maybe_send_inform_response(RePdu, Vsn, ACM, Addr, Port, Logger, State); +handle_inform_request({user, To}, Pid, Vsn, #pdu{request_id = ReqId} = Pdu, + ACM, Addr, Port, _Logger, _State) -> + ?vtrace("received inform-request (false)", []), + + Pid ! {snmp_inform, ReqId, Pdu, Addr, Port}, + + %% Before we go any further, we need to check that we have not + %% already received this message (possible resend). + + Key = {ReqId, Addr, Port}, + case ets:lookup(snmpm_inform_request_table, Key) of + [_] -> + %% OK, we already know about this. We assume this + %% is a resend. Either the agent is really eager or + %% the user has not answered yet. Bad user! + ok; + [] -> + RePdu = make_response_pdu(Pdu), + Expire = t() + To, + Rec = {Key, Expire, {Vsn, ACM, RePdu}}, + ets:insert(snmpm_inform_request_table, Rec) + end, + ok. + +handle_inform_response(Ref, Addr, Port, State) -> + Verbosity = get(verbosity), + spawn_opt(fun() -> + Log = worker_init(State, Verbosity), + Res = (catch do_handle_inform_response( + Ref, + Addr, Port, + State#state{log = Log})), + worker_exit(inform_reponse, {Addr, Port}, Res) + end, + [monitor]). + + + +do_handle_inform_response(Ref, Addr, Port, State) -> + Key = {Ref, Addr, Port}, + case ets:lookup(snmpm_inform_request_table, Key) of + [{Key, _, {Vsn, ACM, RePdu}}] -> + Logger = logger(State#state.log, read, Addr, Port), + ets:delete(snmpm_inform_request_table, Key), + maybe_send_inform_response(RePdu, Vsn, ACM, Addr, Port, + Logger, State); + [] -> + %% Already acknowledged, or the user was to slow to reply... + ok + end, + ok. + +maybe_send_inform_response(RePdu, Vsn, ACM, Addr, Port, Logger, + #state{server = Pid, + sock = Sock, + filter = FilterMod}) -> + case (catch FilterMod:accept_send_pdu(Addr, Port, pdu_type_of(RePdu))) of + false -> + inc(netIfPduOutDrops), + ok; + _ -> + case snmpm_mpd:generate_response_msg(Vsn, RePdu, ACM, Logger) of + {ok, Msg} -> + maybe_udp_send(FilterMod, Sock, Addr, Port, Msg); + {discarded, Reason} -> + ?vlog("failed generating response message:" + "~n Reason: ~p", [Reason]), + ReqId = RePdu#pdu.request_id, + ErrorInfo = {failed_generating_response, {RePdu, Reason}}, + Pid ! {snmp_error, ReqId, ErrorInfo, Addr, Port}, + ok + end + end. + +handle_inform_response_gc(#state{irb = IRB} = State) -> + ets:safe_fixtable(snmpm_inform_request_table, true), + do_irgc(ets:first(snmpm_inform_request_table), t()), + ets:safe_fixtable(snmpm_inform_request_table, false), + State#state{irgc = irgc_start(IRB)}. + +%% We are deleting at the same time as we are traversing the table!!! +do_irgc('$end_of_table', _) -> + ok; +do_irgc(Key, Now) -> + Next = ets:next(snmpm_inform_request_table, Key), + case ets:lookup(snmpm_inform_request_table, Key) of + [{Key, BestBefore, _}] when BestBefore < Now -> + ets:delete(snmpm_inform_request_table, Key); + _ -> + ok + end, + do_irgc(Next, Now). + +irgc_start(auto) -> + undefined; +irgc_start(_) -> + erlang:send_after(?IRGC_TIMEOUT, self(), inform_response_gc). + +irgc_stop(undefined) -> + ok; +irgc_stop(Ref) -> + (catch erlang:cancel_timer(Ref)). + + +handle_send_pdu(Pdu, Vsn, MsgData, Domain, Addr, Port, State) -> + Verbosity = get(verbosity), + spawn_opt(fun() -> + Log = worker_init(State, Verbosity), + Res = (catch maybe_handle_send_pdu( + Pdu, Vsn, MsgData, + Domain, Addr, Port, + State#state{log = Log})), + worker_exit(send_pdu, {Domain, Addr, Port}, Res) + end, + [monitor]). + +maybe_handle_send_pdu(Pdu, Vsn, MsgData, Domain, Addr, Port, + #state{filter = FilterMod} = State) -> + case (catch FilterMod:accept_send_pdu(Addr, Port, pdu_type_of(Pdu))) of + false -> + inc(netIfPduOutDrops), + ok; + _ -> + do_handle_send_pdu(Pdu, Vsn, MsgData, Domain, Addr, Port, State) + end. + +do_handle_send_pdu(Pdu, Vsn, MsgData, _Domain, Addr, Port, + #state{server = Pid, + note_store = NoteStore, + sock = Sock, + log = Log, + filter = FilterMod}) -> + Logger = logger(Log, write, Addr, Port), + case (catch snmpm_mpd:generate_msg(Vsn, NoteStore, + Pdu, MsgData, Logger)) of + {ok, Msg} -> + ?vtrace("do_handle_send_pdu -> message generated", []), + maybe_udp_send(FilterMod, Sock, Addr, Port, Msg); + {discarded, Reason} -> + ?vlog("PDU not sent: " + "~n PDU: ~p" + "~n Reason: ~p", [Pdu, Reason]), + Pid ! {snmp_error, Pdu, Reason}, + ok + end. + + +maybe_udp_send(FilterMod, Sock, Addr, Port, Msg) -> + case (catch FilterMod:accept_send(Addr, Port)) of + false -> + inc(netIfMsgOutDrops), + ok; + _ -> + udp_send(Sock, Addr, Port, Msg) + end. + + +udp_send(Sock, Addr, Port, Msg) -> + case (catch gen_udp:send(Sock, Addr, Port, Msg)) of + ok -> + ?vdebug("sent ~w bytes to ~w:~w [~w]", + [sz(Msg), Addr, Port, Sock]), + ok; + {error, Reason} -> + error_msg("failed sending message to ~p:~p: " + "~n ~p",[Addr, Port, Reason]), + ok; + Error -> + error_msg("failed sending message to ~p:~p: " + "~n ~p",[Addr, Port, Error]), + ok + end. + +sz(B) when is_binary(B) -> + size(B); +sz(L) when is_list(L) -> + length(L); +sz(_) -> + undefined. + + +handle_disk_log(_Log, {wrap, NoLostItems}, State) -> + ?vlog("Audit Trail Log - wrapped: ~w previously logged items where lost", + [NoLostItems]), + State; +handle_disk_log(_Log, {truncated, NoLostItems}, State) -> + ?vlog("Audit Trail Log - truncated: ~w items where lost when truncating", + [NoLostItems]), + State; +handle_disk_log(_Log, full, State) -> + error_msg("Failed to write to Audit Trail Log (full)", []), + State; +handle_disk_log(_Log, {error_status, ok}, State) -> + State; +handle_disk_log(_Log, {error_status, {error, Reason}}, State) -> + error_msg("Error status received from Audit Trail Log: " + "~n~p", [Reason]), + State; +handle_disk_log(_Log, _Info, State) -> + State. + + +%% mk_discovery_msg('version-3', Pdu, _VsnHdr, UserName) -> +%% ScopedPDU = #scopedPdu{contextEngineID = "", +%% contextName = "", +%% data = Pdu}, +%% Bytes = snmp_pdus:enc_scoped_pdu(ScopedPDU), +%% MsgID = get(msg_id), +%% put(msg_id,MsgID+1), +%% UsmSecParams = +%% #usmSecurityParameters{msgAuthoritativeEngineID = "", +%% msgAuthoritativeEngineBoots = 0, +%% msgAuthoritativeEngineTime = 0, +%% msgUserName = UserName, +%% msgPrivacyParameters = "", +%% msgAuthenticationParameters = ""}, +%% SecBytes = snmp_pdus:enc_usm_security_parameters(UsmSecParams), +%% PduType = Pdu#pdu.type, +%% Hdr = #v3_hdr{msgID = MsgID, +%% msgMaxSize = 1000, +%% msgFlags = snmp_misc:mk_msg_flags(PduType, 0), +%% msgSecurityModel = ?SEC_USM, +%% msgSecurityParameters = SecBytes}, +%% Msg = #message{version = 'version-3', vsn_hdr = Hdr, data = Bytes}, +%% case (catch snmp_pdus:enc_message_only(Msg)) of +%% {'EXIT', Reason} -> +%% error("Encoding error. Pdu: ~w. Reason: ~w",[Pdu, Reason]), +%% error; +%% L when list(L) -> +%% {Msg, L} +%% end; +%% mk_discovery_msg(Version, Pdu, {Com, _, _, _, _}, UserName) -> +%% Msg = #message{version = Version, vsn_hdr = Com, data = Pdu}, +%% case catch snmp_pdus:enc_message(Msg) of +%% {'EXIT', Reason} -> +%% error("Encoding error. Pdu: ~w. Reason: ~w",[Pdu, Reason]), +%% error; +%% L when list(L) -> +%% {Msg, L} +%% end. + + +%% mk_msg('version-3', Pdu, {Context, User, EngineID, CtxEngineId, SecLevel}, +%% MsgData) -> +%% %% Code copied from snmp_mpd.erl +%% {MsgId, SecName, SecData} = +%% if +%% tuple(MsgData), Pdu#pdu.type == 'get-response' -> +%% MsgData; +%% true -> +%% Md = get(msg_id), +%% put(msg_id, Md + 1), +%% {Md, User, []} +%% end, +%% ScopedPDU = #scopedPdu{contextEngineID = CtxEngineId, +%% contextName = Context, +%% data = Pdu}, +%% ScopedPDUBytes = snmp_pdus:enc_scoped_pdu(ScopedPDU), + +%% PduType = Pdu#pdu.type, +%% V3Hdr = #v3_hdr{msgID = MsgId, +%% msgMaxSize = 1000, +%% msgFlags = snmp_misc:mk_msg_flags(PduType, SecLevel), +%% msgSecurityModel = ?SEC_USM}, +%% Message = #message{version = 'version-3', vsn_hdr = V3Hdr, +%% data = ScopedPDUBytes}, +%% SecEngineID = case PduType of +%% 'get-response' -> snmp_framework_mib:get_engine_id(); +%% _ -> EngineID +%% end, +%% case catch snmp_usm:generate_outgoing_msg(Message, SecEngineID, +%% SecName, SecData, SecLevel) of +%% {'EXIT', Reason} -> +%% error("Encoding error. Pdu: ~w. Reason: ~w",[Pdu, Reason]), +%% error; +%% {error, Reason} -> +%% error("Encoding error. Pdu: ~w. Reason: ~w",[Pdu, Reason]), +%% error; +%% Packet -> +%% Packet +%% end; +%% mk_msg(Version, Pdu, {Com, _User, _EngineID, _Ctx, _SecLevel}, _SecData) -> +%% Msg = #message{version = Version, vsn_hdr = Com, data = Pdu}, +%% case catch snmp_pdus:enc_message(Msg) of +%% {'EXIT', Reason} -> +%% error("Encoding error. Pdu: ~w. Reason: ~w",[Pdu, Reason]), +%% error; +%% B when list(B) -> +%% B +%% end. + + +%% handle_system_info_updated(#state{log = {Log, _OldType}} = State, +%% audit_trail_log_type = _What) -> +%% %% Just to make sure, check that ATL is actually enabled +%% case snmpm_config:system_info(audit_trail_log) of +%% {ok, true} -> +%% {ok, Type} = snmpm_config:system_info(audit_trail_log_type), +%% NewState = State#state{log = {Log, Type}}, +%% {NewState, ok}; +%% _ -> +%% {State, {error, {adt_not_enabled}}} +%% end; +%% handle_system_info_updated(_State, _What) -> +%% ok. + +handle_get_log_type(#state{log = {_Log, Value}} = State) -> + %% Just to make sure, check that ATL is actually enabled + case snmpm_config:system_info(audit_trail_log) of + {ok, true} -> + Type = + case {lists:member(read, Value), lists:member(write, Value)} of + {true, true} -> + read_write; + {true, false} -> + read; + {false, true} -> + write; + {false, false} -> + throw({State, {error, {bad_atl_type, Value}}}) + end, + {ok, Type}; + _ -> + {error, not_enabled} + end; +handle_get_log_type(_State) -> + {error, not_enabled}. + +handle_set_log_type(#state{log = {Log, OldValue}} = State, NewType) -> + %% Just to make sure, check that ATL is actually enabled + case snmpm_config:system_info(audit_trail_log) of + {ok, true} -> + NewValue = + case NewType of + read -> + [read]; + write -> + [write]; + read_write -> + [read,write]; + _ -> + throw({State, {error, {bad_atl_type, NewType}}}) + end, + NewState = State#state{log = {Log, NewValue}}, + OldType = + case {lists:member(read, OldValue), + lists:member(write, OldValue)} of + {true, true} -> + read_write; + {true, false} -> + read; + {false, true} -> + write; + {false, false} -> + throw({State, {error, {bad_atl_type, OldValue}}}) + end, + {NewState, {ok, OldType}}; + _ -> + {State, {error, not_enabled}} + end; +handle_set_log_type(State, _NewType) -> + {State, {error, not_enabled}}. + + +%% ------------------------------------------------------------------- + +worker_init(#state{log = undefined = Log}, Verbosity) -> + worker_init2(Log, Verbosity); +worker_init(#state{log = {Name, Log, Type}}, Verbosity) -> + case snmp_log:open(Name, Log) of + {ok, NewLog} -> + worker_init2({Name, NewLog, Type}, Verbosity); + {error, Reason} -> + warning_msg("NetIf worker ~p failed opening ATL: " + "~n ~p", [self(), Reason]), + NewLog = undefined, + worker_init2({Name, NewLog, Type}, Verbosity) + end; +worker_init(State, Verbosity) -> + ?vinfo("worker_init -> entry with invalid data: " + "~n State: ~p" + "~n Verbosity: ~p", [State, Verbosity]), + exit({worker_init, State, Verbosity}). + +worker_init2(Log, Verbosity) -> + put(sname, mnifw), + put(verbosity, Verbosity), + Log. + + +worker_exit(Tag, Info, Result) -> + exit({net_if_worker, {Tag, Info, Result}}). + +handle_worker_exit(_, {_, _, ok}) -> + ok; +handle_worker_exit(Pid, {udp, {Addr, Port}, ExitStatus}) -> + warning_msg("Worker process (~p) terminated " + "while processing (incomming) message from ~w:~w: " + "~n~p", [Pid, Addr, Port, ExitStatus]), + ok; +handle_worker_exit(Pid, {send_pdu, {Domain, Addr, Port}, ExitStatus}) -> + warning_msg("Worker process (~p) terminated " + "while processing (outgoing) pdu for [~w] ~w:~w: " + "~n~p", [Pid, Domain, Addr, Port, ExitStatus]), + ok; +handle_worker_exit(Pid, {inform_response, {Addr, Port}, ExitStatus}) -> + warning_msg("Worker process (~p) terminated " + "while processing (outgoing) inform response for ~w:~w: " + "~n~p", [Pid, Addr, Port, ExitStatus]), + ok; +handle_worker_exit(_, _) -> + ok. + + +%% ------------------------------------------------------------------- + +make_response_pdu(#pdu{request_id = ReqId, varbinds = Vbs}) -> + #pdu{type = 'get-response', + request_id = ReqId, + error_status = noError, + error_index = 0, + varbinds = Vbs}. + + +%% ---------------------------------------------------------------- + +pdu_type_of(#pdu{type = Type}) -> + Type; +pdu_type_of(TrapPdu) when is_record(TrapPdu, trappdu) -> + trap. + + +%% ------------------------------------------------------------------- + +%% At this point this function is used during testing +maybe_process_extra_info(?DEFAULT_EXTRA_INFO) -> + ok; +maybe_process_extra_info({?SNMPM_EXTRA_INFO_TAG, Fun}) + when is_function(Fun, 0) -> + (catch Fun()), + ok; +maybe_process_extra_info(_ExtraInfo) -> + ok. + + +%% ------------------------------------------------------------------- + +t() -> + {A,B,C} = erlang:now(), + A*1000000000+B*1000+(C div 1000). + + +%% ------------------------------------------------------------------- + +logger(undefined, _Type, _Addr, _Port) -> + fun(_) -> + ok + end; +logger({_Name, Log, Types}, Type, Addr, Port) -> + case lists:member(Type, Types) of + true -> + fun(Msg) -> + snmp_log:log(Log, Msg, Addr, Port) + end; + false -> + fun(_) -> + ok + end + end. + + +%% ------------------------------------------------------------------- + +%% info_msg(F, A) -> +%% ?snmpm_info("NET-IF server: " ++ F, A). + +warning_msg(F, A) -> + ?snmpm_warning("NET-IF server: " ++ F, A). + +error_msg(F, A) -> + ?snmpm_error("NET-IF server: " ++ F, A). + + + +%%%------------------------------------------------------------------- + +% get_opt(Key, Opts) -> +% ?vtrace("get option ~w", [Key]), +% snmp_misc:get_option(Key, Opts). + +get_opt(Opts, Key, Def) -> + ?vtrace("get option ~w with default ~p", [Key, Def]), + snmp_misc:get_option(Key, Opts, Def). + + +%% ------------------------------------------------------------------- + +get_info(#state{sock = Id}) -> + ProcSize = proc_mem(self()), + PortInfo = get_port_info(Id), + [{process_memory, ProcSize}, {port_info, PortInfo}]. + +proc_mem(P) when is_pid(P) -> + case (catch erlang:process_info(P, memory)) of + {memory, Sz} when is_integer(Sz) -> + Sz; + _ -> + undefined + end. +%% proc_mem(_) -> +%% undefined. + + +get_port_info(Id) -> + PortInfo = + case (catch erlang:port_info(Id)) of + PI when is_list(PI) -> + [{port_info, PI}]; + _ -> + [] + end, + PortStatus = + case (catch prim_inet:getstatus(Id)) of + {ok, PS} -> + [{port_status, PS}]; + _ -> + [] + end, + PortAct = + case (catch inet:getopts(Id, [active])) of + {ok, PA} -> + [{port_act, PA}]; + _ -> + [] + end, + PortStats = + case (catch inet:getstat(Id)) of + {ok, Stat} -> + [{port_stats, Stat}]; + _ -> + [] + end, + IfList = + case (catch inet:getif(Id)) of + {ok, IFs} -> + [{interfaces, IFs}]; + _ -> + [] + end, + BufSz = + case (catch inet:getopts(Id, [recbuf, sndbuf, buffer])) of + {ok, Sz} -> + [{buffer_size, Sz}]; + _ -> + [] + end, + [{socket, Id}] ++ + IfList ++ + PortStats ++ + PortInfo ++ + PortStatus ++ + PortAct ++ + BufSz. + + +%%----------------------------------------------------------------- +%% Counter functions +%%----------------------------------------------------------------- +init_counters() -> + F = fun(Counter) -> maybe_create_counter(Counter) end, + lists:map(F, counters()). + +reset_counters() -> + F = fun(Counter) -> snmpm_config:reset_stats_counter(Counter) end, + lists:map(F, counters()). + +maybe_create_counter(Counter) -> + snmpm_config:maybe_cre_stats_counter(Counter, 0). + +counters() -> + [ + netIfMsgOutDrops, + netIfMsgInDrops, + netIfPduOutDrops, + netIfPduInDrops + ]. + +inc(Name) -> inc(Name, 1). +inc(Name, N) -> snmpm_config:incr_stats_counter(Name, N). + +%% get_counters() -> +%% Counters = counters(), +%% get_counters(Counters, []). + +%% get_counters([], Acc) -> +%% lists:reverse(Acc); +%% get_counters([Counter|Counters], Acc) -> +%% case snmpm_config:get_stats_counter(Counter) of +%% {ok, CounterVal} -> +%% get_counters(Counters, [{Counter, CounterVal}|Acc]); +%% _ -> +%% get_counters(Counters, Acc) +%% end. + + +%% ---------------------------------------------------------------- + +call(Pid, Req) -> + call(Pid, Req, infinity). + +call(Pid, Req, Timeout) -> + gen_server:call(Pid, Req, Timeout). + +cast(Pid, Msg) -> + gen_server:cast(Pid, Msg). + diff --git a/lib/snmp/src/misc/snmp_conf.erl b/lib/snmp/src/misc/snmp_conf.erl index 7249def24e..e1e7fab57b 100644 --- a/lib/snmp/src/misc/snmp_conf.erl +++ b/lib/snmp/src/misc/snmp_conf.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2011. All Rights Reserved. +%% Copyright Ericsson AB 1996-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -71,6 +71,18 @@ %%----------------------------------------------------------------- +%% read_files(Dir, Files) -> Configs +%% Dir - string() - Full path to the config dir. +%% Files - [{Gen, Filter, Check, FileName}] +%% Gen - function/2 - In case of failure when reading the config file, +%% this function is called to either generate a +%% default file or issue the error. +%% Filter - function/1 - Filters all the config entries read from the file +%% Check - function/1 - Check each entry as they are read from the file. +%% FileName - string() - Name of the config file. +%% Configs - [config_entry()] +%% config_entry() - term() + read_files(Dir, Files) when is_list(Dir) andalso is_list(Files) -> read_files(Dir, Files, []). @@ -90,7 +102,7 @@ read_files(Dir, [{Gen, Filter, Check, FileName}|Files], Res) {error, R} -> ?vlog("failed reading file info for ~s: " "~n ~p", [FileName, R]), - Gen(Dir), + Gen(Dir, R), read_files(Dir, Files, [Filter([])|Res]) end. @@ -99,6 +111,7 @@ read_files(Dir, [{Gen, Filter, Check, FileName}|Files], Res) read(File, Check) when is_function(Check) -> ?vdebug("read -> entry with" "~n File: ~p", [File]), + Fd = open_file(File), case loop(Fd, [], Check, 1, File) of diff --git a/lib/snmp/src/misc/snmp_config.erl b/lib/snmp/src/misc/snmp_config.erl index 6ab20e3e48..1da2c339c7 100644 --- a/lib/snmp/src/misc/snmp_config.erl +++ b/lib/snmp/src/misc/snmp_config.erl @@ -90,6 +90,17 @@ ]). +-export_type([void/0, + verify_config_entry_function/0, + verify_config_function/0, + write_config_function/0]). + + +%%---------------------------------------------------------------------- + +-type void() :: term(). % Any value - ignored + + %%---------------------------------------------------------------------- %% Handy SNMP configuration %%---------------------------------------------------------------------- @@ -2356,53 +2367,109 @@ write_sys_config_file_manager_atl_opt(Fid, {seqno, SeqNo}) -> header() -> - {Y,Mo,D} = date(), - {H,Mi,S} = time(), + {Y, Mo, D} = date(), + {H, Mi, S} = time(), io_lib:format("%% This file was generated by " - "snmp_config (version-~s) ~w-~2.2.0w-~2.2.0w " + "~w (version-~s) ~w-~2.2.0w-~2.2.0w " "~2.2.0w:~2.2.0w:~2.2.0w\n", - [?version,Y,Mo,D,H,Mi,S]). + [?MODULE, ?version, Y, Mo, D, H, Mi, S]). + +%% *If* these functions are successfull, they successfully return anything +%% (which is ignored), but they fail with either a throw or an exit or +%% something similar. + +%% Verification of one config entry read from a file +-type(verify_config_entry_function() :: + fun((Entry :: term()) -> ok | {error, Reason :: term()})). + +%% Verification of config to be written +-type(verify_config_function() :: + fun(() -> void())). + +%% Write config to file (as defined by Fd) +-type(write_config_function() :: + fun((Fd :: file:io_device()) -> void())). + +-spec write_config_file(Dir :: string(), + FileName :: string(), + Verify :: verify_config_function(), + Write :: write_config_function()) -> + ok | {error, Reason :: term()}. write_config_file(Dir, FileName, Verify, Write) when (is_list(Dir) andalso is_list(FileName) andalso is_function(Verify) andalso is_function(Write)) -> - (catch do_write_config_file(Dir, FileName, Verify, Write)). + try + begin + do_write_config_file(Dir, FileName, Verify, Write) + end + catch + throw:Error -> + Error; + T:E -> + {error, {failed_write, Dir, FileName, T, E}} + end. + do_write_config_file(Dir, FileName, Verify, Write) -> Verify(), case file:open(filename:join(Dir, FileName), [write]) of {ok, Fd} -> - (catch Write(Fd)), - file:close(Fd), - ok; + file_write_and_close(Write, Fd, Dir, FileName); Error -> Error end. - append_config_file(Dir, FileName, Verify, Write) when (is_list(Dir) andalso is_list(FileName) andalso is_function(Verify) andalso is_function(Write)) -> - (catch do_append_config_file(Dir, FileName, Verify, Write)). + try + begin + do_append_config_file(Dir, FileName, Verify, Write) + end + catch + throw:Error -> + Error; + T:E -> + {error, {failed_append, Dir, FileName, T, E}} + end. do_append_config_file(Dir, FileName, Verify, Write) -> Verify(), case file:open(filename:join(Dir, FileName), [read, write]) of {ok, Fd} -> file:position(Fd, eof), - (catch Write(Fd)), - file:close(Fd), - ok; + file_write_and_close(Write, Fd, Dir, FileName); Error -> Error end. +file_write_and_close(Write, Fd, Dir, FileName) -> + ok = Write(Fd), + case file:sync(Fd) of + ok -> + case file:close(Fd) of + ok -> + ok; + {error, Reason} -> + {error, {failed_closing, Dir, FileName, Reason}} + end; + {error, Reason} -> + {error, {failed_syncing, Dir, FileName, Reason}} + end. + + +-spec read_config_file(Dir :: string(), + FileName :: string(), + Verify :: verify_config_entry_function()) -> + {ok, Config :: list()} | {error, Reason :: term()}. + read_config_file(Dir, FileName, Verify) when is_list(Dir) andalso is_list(FileName) andalso is_function(Verify) -> (catch do_read_config_file(Dir, FileName, Verify)). diff --git a/lib/snmp/src/misc/snmp_log.erl b/lib/snmp/src/misc/snmp_log.erl index 2c781810ef..a8c5df0b64 100644 --- a/lib/snmp/src/misc/snmp_log.erl +++ b/lib/snmp/src/misc/snmp_log.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2011. All Rights Reserved. +%% Copyright Ericsson AB 1997-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -21,7 +21,7 @@ -export([ - create/4, create/5, create/6, + create/4, create/5, create/6, open/1, open/2, change_size/2, close/1, sync/1, info/1, log/4, log_to_txt/5, log_to_txt/6, log_to_txt/7, @@ -109,6 +109,24 @@ create(Name, File, SeqNoGen, Size, Repair, Notify) -> {error, {bad_args, Name, File, SeqNoGen, Size, Repair, Notify}}. +%% -- open --- + +%% Open an already existing ( = open ) log + +open(Name) -> + open(Name, #snmp_log{seqno = disabled}). +open(Name, #snmp_log{seqno = SeqNoGen} = _OldLog) -> + %% We include mode in the opts just to be on the safe side + case disk_log:open([{name, Name}, {mode, read_write}]) of + {ok, Log} -> + %% SeqNo must be proprly initiated also + {ok, #snmp_log{id = Log, seqno = SeqNoGen}}; + {repaired, Log, _RecBytes, _BadBytes} -> + {ok, #snmp_log{id = Log, seqno = SeqNoGen}}; + ERROR -> + ERROR + end. + %% -- close --- @@ -394,6 +412,14 @@ log_to_io(Log, FileName, Dir, Mibs, Start) -> log_to_io(Log, FileName, Dir, Mibs, Start, Stop) when is_list(Mibs) -> + ?vtrace("log_to_io -> entry with" + "~n Log: ~p" + "~n FileName: ~p" + "~n Dir: ~p" + "~n Mibs: ~p" + "~n Start: ~p" + "~n Stop: ~p", + [Log, FileName, Dir, Mibs, Start, Stop]), File = filename:join(Dir, FileName), Converter = fun(L) -> do_log_to_io(L, Mibs, Start, Stop) @@ -401,28 +427,10 @@ log_to_io(Log, FileName, Dir, Mibs, Start, Stop) log_convert(Log, File, Converter). -%% -- log_to_plain --- - -%% log_to_plain(Log, FileName, Dir) -> -%% log_to_plain(Log, FileName, Dir, null, null). - -%% log_to_plain(Log, FileName, Dir, Start) -> -%% log_to_plain(Log, FileName, Dir, Start, null). - -%% log_to_plain(Log, FileName, Dir, Start, Stop) -%% when is_list(Mibs) -> -%% File = filename:join(Dir, FileName), -%% Converter = fun(L) -> -%% do_log_to_plain(L, Start, Stop) -%% end, -%% log_convert(Log, File, Converter). - - %% -------------------------------------------------------------------- %% Internal functions %% -------------------------------------------------------------------- - %% -- log_convert --- log_convert(#snmp_log{id = Log}, File, Converter) -> @@ -431,6 +439,26 @@ log_convert(Log, File, Converter) -> do_log_convert(Log, File, Converter). do_log_convert(Log, File, Converter) -> + %% ?vtrace("do_log_converter -> entry with" + %% "~n Log: ~p" + %% "~n File: ~p" + %% "~n disk_log:info(Log): ~p", [Log, File, disk_log:info(Log)]), + {Pid, Ref} = + erlang:spawn_monitor( + fun() -> + Result = do_log_convert2(Log, File, Converter), + exit(Result) + end), + receive + {'DOWN', Ref, process, Pid, Result} -> + %% ?vtrace("do_log_converter -> received result" + %% "~n Result: ~p" + %% "~n disk_log:info(Log): ~p", + %% [Result, disk_log:info(Log)]), + Result + end. + +do_log_convert2(Log, File, Converter) -> %% First check if the caller process has already opened the %% log, because if we close an already open log we will cause %% a runtime error. @@ -439,29 +467,18 @@ do_log_convert(Log, File, Converter) -> Converter(Log); false -> %% Not yet member of the ruling party, apply for membership... - %% If a log is opened as read_write it is not possible to - %% open it as read_only. So, to get around this we open - %% it under a different name... - Log2 = convert_name(Log), - case log_open(Log2, File) of + case log_open(Log, File) of {ok, _} -> - Res = Converter(Log2), - disk_log:close(Log2), + Res = Converter(Log), + disk_log:close(Log), Res; {error, {name_already_open, _}} -> - Converter(Log2); + Converter(Log); {error, Reason} -> {error, {Log, Reason}} end end. -convert_name(Name) when is_list(Name) -> - Name ++ "_tmp"; -convert_name(Name) when is_atom(Name) -> - list_to_atom(atom_to_list(Name) ++ "_tmp"); -convert_name(Name) -> - lists:flatten(io_lib:format("~w_tmp", [Name])). - %% -- do_log_to_text --- @@ -705,21 +722,21 @@ tsf_ge(_Local,Universal,{universal_time,DateTime}) -> tsf_ge(Local,_Universal,DateTime) -> tsf_ge(Local,DateTime). -tsf_ge(TimeStamp,DateTime) -> +tsf_ge(TimeStamp, DateTime) -> T1 = calendar:datetime_to_gregorian_seconds(TimeStamp), T2 = calendar:datetime_to_gregorian_seconds(DateTime), T1 >= T2. -tsf_le(_Local,_Universal,null) -> +tsf_le(_Local, _Universal, null) -> true; -tsf_le(Local,_Universal,{local_time,DateTime}) -> - tsf_le(Local,DateTime); -tsf_le(_Local,Universal,{universal_time,DateTime}) -> - tsf_le(Universal,DateTime); -tsf_le(Local,_Universal,DateTime) -> +tsf_le(Local, _Universal, {local_time, DateTime}) -> + tsf_le(Local, DateTime); +tsf_le(_Local, Universal, {universal_time, DateTime}) -> + tsf_le(Universal, DateTime); +tsf_le(Local, _Universal, DateTime) -> tsf_le(Local,DateTime). -tsf_le(TimeStamp,DateTime) -> +tsf_le(TimeStamp, DateTime) -> T1 = calendar:datetime_to_gregorian_seconds(TimeStamp), T2 = calendar:datetime_to_gregorian_seconds(DateTime), T1 =< T2. @@ -864,11 +881,8 @@ do_std_log_open(Name, File, Size, Repair, Notify) -> log_open(Name, File) -> - Opts = [{name, Name}, - {file, File}, - {type, ?LOG_TYPE}, - {format, ?LOG_FORMAT}, - {mode, read_only}], + Opts = [{name, Name}, + {file, File}], case disk_log:open(Opts) of {error, {badarg, size}} -> {error, no_such_log}; diff --git a/lib/snmp/src/misc/snmp_verbosity.erl b/lib/snmp/src/misc/snmp_verbosity.erl index 85037ba2ae..df5986b7bc 100644 --- a/lib/snmp/src/misc/snmp_verbosity.erl +++ b/lib/snmp/src/misc/snmp_verbosity.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2009. All Rights Reserved. +%% Copyright Ericsson AB 2000-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -76,7 +76,7 @@ format_timestamp({_N1, _N2, N3} = Now) -> {YYYY,MM,DD} = Date, {Hour,Min,Sec} = Time, FormatDate = - io_lib:format("~.4w:~.2.0w:~.2.0w ~.2.0w:~.2.0w:~.2.0w 4~w", + io_lib:format("~.4w:~.2.0w:~.2.0w ~.2.0w:~.2.0w:~.2.0w ~w", [YYYY,MM,DD,Hour,Min,Sec,round(N3/1000)]), lists:flatten(FormatDate). @@ -144,6 +144,8 @@ image_of_sname(mse) -> "M-SERVER"; image_of_sname(msew) -> io_lib:format("M-SERVER-worker(~p)", [self()]); image_of_sname(mns) -> "M-NOTE-STORE"; image_of_sname(mnif) -> "M-NET-IF"; +image_of_sname(mnifl) -> "M-NET-IF-LOGGER"; +image_of_sname(mnifw) -> io_lib:format("M-NET-IF-worker(~p)", [self()]); image_of_sname(mconf) -> "M-CONF"; image_of_sname(mgr) -> "MGR"; diff --git a/lib/snmp/test/Makefile b/lib/snmp/test/Makefile index 78ffb1c255..8c1f53e51a 100644 --- a/lib/snmp/test/Makefile +++ b/lib/snmp/test/Makefile @@ -224,6 +224,9 @@ $(SNMP_BIN_TARGET_DIR)/Klas4.bin: $(SNMP_BIN_TARGET_DIR)/Klas3.bin $(SNMP_BIN_TARGET_DIR)/SA-MIB.bin: $(SNMP_BIN_TARGET_DIR)/OLD-SNMPEA-MIB.bin +$(SNMP_BIN_TARGET_DIR)/Test3.bin: $(SNMP_BIN_TARGET_DIR)/Test2.bin + + # ---------------------------------------------------- # Release Target # ---------------------------------------------------- diff --git a/lib/snmp/test/exp/.gitignore b/lib/snmp/test/exp/.gitignore new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/lib/snmp/test/exp/.gitignore diff --git a/lib/snmp/test/snmp_agent_bl_test.erl b/lib/snmp/test/exp/snmp_agent_bl_test.erl index b17489a755..b17489a755 100644 --- a/lib/snmp/test/snmp_agent_bl_test.erl +++ b/lib/snmp/test/exp/snmp_agent_bl_test.erl diff --git a/lib/snmp/test/snmp_agent_ms_test.erl b/lib/snmp/test/exp/snmp_agent_ms_test.erl index 1f34f1c8d1..1f34f1c8d1 100644 --- a/lib/snmp/test/snmp_agent_ms_test.erl +++ b/lib/snmp/test/exp/snmp_agent_ms_test.erl diff --git a/lib/snmp/test/snmp_agent_mt_test.erl b/lib/snmp/test/exp/snmp_agent_mt_test.erl index 4f125c0017..4f125c0017 100644 --- a/lib/snmp/test/snmp_agent_mt_test.erl +++ b/lib/snmp/test/exp/snmp_agent_mt_test.erl diff --git a/lib/snmp/test/snmp_agent_v1_test.erl b/lib/snmp/test/exp/snmp_agent_v1_test.erl index 737bb25cc3..737bb25cc3 100644 --- a/lib/snmp/test/snmp_agent_v1_test.erl +++ b/lib/snmp/test/exp/snmp_agent_v1_test.erl diff --git a/lib/snmp/test/snmp_agent_v2_test.erl b/lib/snmp/test/exp/snmp_agent_v2_test.erl index dc94c18ad9..dc94c18ad9 100644 --- a/lib/snmp/test/snmp_agent_v2_test.erl +++ b/lib/snmp/test/exp/snmp_agent_v2_test.erl diff --git a/lib/snmp/test/snmp_agent_v3_test.erl b/lib/snmp/test/exp/snmp_agent_v3_test.erl index 266be72878..266be72878 100644 --- a/lib/snmp/test/snmp_agent_v3_test.erl +++ b/lib/snmp/test/exp/snmp_agent_v3_test.erl diff --git a/lib/snmp/test/modules.mk b/lib/snmp/test/modules.mk index eacc749b53..7b0bdc5b8f 100644 --- a/lib/snmp/test/modules.mk +++ b/lib/snmp/test/modules.mk @@ -76,7 +76,8 @@ MIB_FILES = \ TestTrap.mib \ TestTrapv2.mib \ Test1.mib \ - Test2.mib + Test2.mib \ + Test3.mib SPECS = snmp.spec snmp.spec.vxworks diff --git a/lib/snmp/test/snmp_SUITE.erl b/lib/snmp/test/snmp_SUITE.erl index b6d72da2fa..22b9c64588 100644 --- a/lib/snmp/test/snmp_SUITE.erl +++ b/lib/snmp/test/snmp_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2011. All Rights Reserved. +%% Copyright Ericsson AB 1997-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -19,6 +19,8 @@ -module(snmp_SUITE). +-include("snmp_test_lib.hrl"). + -export([all/0, suite/0, groups/0, @@ -39,6 +41,21 @@ end_per_testcase(_Case, Config) when is_list(Config) -> Config. +init_per_suite(Config) when is_list(Config) -> + + ?DBG("init_per_suite -> entry with" + "~n Config: ~p", [Config]), + + Config. + +end_per_suite(Config) when is_list(Config) -> + + ?DBG("end_per_suite -> entry with" + "~n Config: ~p", [Config]), + + Config. + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Top test case @@ -53,7 +70,8 @@ all() -> {group, manager}]. groups() -> - [{app, [], [{group, app_test}, + [ + {app, [], [{group, app_test}, {group, appup_test}]}, {compiler, [], [{group, compiler_test}]}, {misc, [], [{group, conf_test}, @@ -66,6 +84,7 @@ groups() -> {manager, [], [{group, manager_config_test}, {group, manager_user_test}, {group, manager_test}]}, + {app_test, [], [{snmp_app_test, all}]}, {appup_test, [], [{snmp_appup_test, all}]}, {compiler_test, [], [{snmp_compiler_test, all}]}, @@ -78,17 +97,25 @@ groups() -> {agent_test, [], [{snmp_agent_test, all}]}, {manager_config_test, [], [{snmp_manager_config_test, all}]}, {manager_user_test, [], [{snmp_manager_user_test, all}]}, - {manager_test, [], [{snmp_manager_test, all}]}]. + {manager_test, [], [{snmp_manager_test, all}]} + ]. -init_per_suite(Config) -> - Config. -end_per_suite(_Config) -> - ok. +init_per_group(GroupName, Config0) -> -init_per_group(_GroupName, Config) -> - Config. + ?DBG("init_per_group -> entry with" + "~n GroupName: ~p" + "~n Config0: ~p", [GroupName, Config0]), + + %% Group name is not really the suite name + %% (but it is a good enough approximation), + %% but it does not matter since we only need + %% it to be unique. + snmp_test_lib:init_suite_top_dir(GroupName, Config0). + end_per_group(_GroupName, Config) -> - Config. + lists:keydelete(snmp_suite_top_dir, 1, Config). + + diff --git a/lib/snmp/test/snmp_agent_test.erl b/lib/snmp/test/snmp_agent_test.erl index e968bc65b1..8ee5dd534d 100644 --- a/lib/snmp/test/snmp_agent_test.erl +++ b/lib/snmp/test/snmp_agent_test.erl @@ -224,52 +224,82 @@ groups() -> }, {tickets2, [], [otp8395, otp9884]}, {otp_4394, [], [otp_4394_test]}, - {otp_7157, [], [otp_7157_test] - } + {otp_7157, [], [otp_7157_test]} ]. -init_per_group(all_tcs, Config) -> - init_all(Config); -init_per_group(otp_7157, Config) -> - init_otp_7157(Config); -init_per_group(otp_4394, Config) -> - init_otp_4394(Config); -init_per_group(v2_inform, Config) -> - init_v2_inform(Config); -init_per_group(multiple_reqs_2, Config) -> - init_mul(Config); -init_per_group(multiple_reqs, Config) -> - init_mul(Config); -init_per_group(test_multi_threaded, Config) -> - init_mt(Config); -init_per_group(test_v3, Config) -> - init_v3(Config); -init_per_group(test_v1_v2, Config) -> - init_v1_v2(Config); -init_per_group(test_v2, Config) -> - init_v2(Config); -init_per_group(test_v1, Config) -> - init_v1(Config); -init_per_group(misc, Config) -> - init_misc(Config); -init_per_group(mib_storage_varm_mnesia, Config) -> - init_varm_mib_storage_mnesia(Config); -init_per_group(mib_storage_varm_dets, Config) -> - init_varm_mib_storage_dets(Config); -init_per_group(mib_storage_size_check_mnesia, Config) -> - init_size_check_msm(Config); -init_per_group(mib_storage_size_check_dets, Config) -> - init_size_check_msd(Config); -init_per_group(mib_storage_size_check_ets, Config) -> - init_size_check_mse(Config); -init_per_group(mib_storage_mnesia, Config) -> - init_mib_storage_mnesia(Config); -init_per_group(mib_storage_dets, Config) -> - init_mib_storage_dets(Config); -init_per_group(mib_storage_ets, Config) -> - init_mib_storage_ets(Config); -init_per_group(_GroupName, Config) -> - Config. + +init_per_suite(Config0) when is_list(Config0) -> + + ?DBG("init_per_suite -> entry with" + "~n Config0: ~p", [Config0]), + + Config1 = snmp_test_lib:init_suite_top_dir(?MODULE, Config0), + Config2 = snmp_test_lib:fix_data_dir(Config1), + + %% Mib-dirs + MibDir = snmp_test_lib:lookup(data_dir, Config2), + StdMibDir = filename:join([code:priv_dir(snmp), "mibs"]), + + Config3 = [{mib_dir, MibDir}, {std_mib_dir, StdMibDir} | Config2], + + ?DBG("init_per_suite -> end with" + "~n Config3: ~p", [Config3]), + + Config3. + +end_per_suite(Config) when is_list(Config) -> + + ?DBG("end_per_suite -> entry with" + "~n Config: ~p", [Config]), + + Config. + + +init_per_group(all_tcs = GroupName, Config) -> + init_all(snmp_test_lib:init_group_top_dir(GroupName, Config)); +init_per_group(otp_7157 = GroupName, Config) -> + init_otp_7157(snmp_test_lib:init_group_top_dir(GroupName, Config)); +init_per_group(otp_4394 = GroupName, Config) -> + init_otp_4394(snmp_test_lib:init_group_top_dir(GroupName, Config)); +init_per_group(v2_inform = GroupName, Config) -> + init_v2_inform(snmp_test_lib:init_group_top_dir(GroupName, Config)); +init_per_group(multiple_reqs_2 = GroupName, Config) -> + init_mul(snmp_test_lib:init_group_top_dir(GroupName, Config)); +init_per_group(multiple_reqs = GroupName, Config) -> + init_mul(snmp_test_lib:init_group_top_dir(GroupName, Config)); +init_per_group(test_multi_threaded = GroupName, Config) -> + init_mt(snmp_test_lib:init_group_top_dir(GroupName, Config)); +init_per_group(test_v3 = GroupName, Config) -> + init_v3(snmp_test_lib:init_group_top_dir(GroupName, Config)); +init_per_group(test_v1_v2 = GroupName, Config) -> + init_v1_v2(snmp_test_lib:init_group_top_dir(GroupName, Config)); +init_per_group(test_v2 = GroupName, Config) -> + init_v2(snmp_test_lib:init_group_top_dir(GroupName, Config)); +init_per_group(test_v1 = GroupName, Config) -> + init_v1(snmp_test_lib:init_group_top_dir(GroupName, Config)); +init_per_group(misc = GroupName, Config) -> + init_misc(snmp_test_lib:init_group_top_dir(GroupName, Config)); +init_per_group(mib_storage_varm_mnesia = GroupName, Config) -> + init_varm_mib_storage_mnesia(snmp_test_lib:init_group_top_dir(GroupName, + Config)); +init_per_group(mib_storage_varm_dets = GroupName, Config) -> + init_varm_mib_storage_dets(snmp_test_lib:init_group_top_dir(GroupName, + Config)); +init_per_group(mib_storage_size_check_mnesia = GroupName, Config) -> + init_size_check_msm(snmp_test_lib:init_group_top_dir(GroupName, Config)); +init_per_group(mib_storage_size_check_dets = GroupName, Config) -> + init_size_check_msd(snmp_test_lib:init_group_top_dir(GroupName, Config)); +init_per_group(mib_storage_size_check_ets = GroupName, Config) -> + init_size_check_mse(snmp_test_lib:init_group_top_dir(GroupName, Config)); +init_per_group(mib_storage_mnesia = GroupName, Config) -> + init_mib_storage_mnesia(snmp_test_lib:init_group_top_dir(GroupName, + Config)); +init_per_group(mib_storage_dets = GroupName, Config) -> + init_mib_storage_dets(snmp_test_lib:init_group_top_dir(GroupName, Config)); +init_per_group(mib_storage_ets = GroupName, Config) -> + init_mib_storage_ets(snmp_test_lib:init_group_top_dir(GroupName, Config)); +init_per_group(GroupName, Config) -> + snmp_test_lib:init_group_top_dir(GroupName, Config). end_per_group(all_tcs, Config) -> finish_all(Config); @@ -320,38 +350,36 @@ init_per_testcase(otp8395 = Case, Config) when is_list(Config) -> ?DBG("init_per_testcase -> entry with" "~n Case: ~p" "~n Config: ~p", [Case, Config]), - Config2 = init_per_testcase2(Case, init_per_suite(Config)), - otp8395({init, Config2}); + otp8395({init, init_per_testcase2(Case, Config)}); init_per_testcase(otp9884 = Case, Config) when is_list(Config) -> ?DBG("init_per_testcase -> entry with" "~n Case: ~p" "~n Config: ~p", [Case, Config]), - Config2 = init_per_testcase2(Case, init_per_suite(Config)), - otp9884({init, Config2}); + otp9884({init, init_per_testcase2(Case, Config)}); init_per_testcase(otp_7157_test = _Case, Config) when is_list(Config) -> ?DBG("init_per_testcase -> entry with" "~n Case: ~p" "~n Config: ~p", [_Case, Config]), Dog = ?WD_START(?MINS(1)), - [{watchdog, Dog}|Config]; + [{watchdog, Dog} | Config ]; init_per_testcase(v2_inform_i = _Case, Config) when is_list(Config) -> ?DBG("init_per_testcase -> entry with" "~n Case: ~p" "~n Config: ~p", [_Case, Config]), Dog = ?WD_START(?MINS(10)), - [{watchdog, Dog}|Config]; + [{watchdog, Dog} | Config ]; init_per_testcase(v3_inform_i = _Case, Config) when is_list(Config) -> ?DBG("init_per_testcase -> entry with" "~n Case: ~p" "~n Config: ~p", [_Case, Config]), Dog = ?WD_START(?MINS(10)), - [{watchdog, Dog}|Config]; + [{watchdog, Dog} | Config ]; init_per_testcase(_Case, Config) when is_list(Config) -> ?DBG("init_per_testcase -> entry with" "~n Case: ~p" "~n Config: ~p", [_Case, Config]), Dog = ?WD_START(?MINS(6)), - [{watchdog, Dog}|Config]. + [{watchdog, Dog}| Config ]. end_per_testcase(otp8395, Config) when is_list(Config) -> otp8395({fin, Config}); @@ -366,65 +394,13 @@ end_per_testcase(_Case, Config) when is_list(Config) -> Config. -init_per_suite(Config) -> - ?DBG("init_per_suite -> entry with" - "~n Config: ~p", [Config]), - - %% Suite root dir for test suite - PrivDir = ?config(priv_dir, Config), - - %% Create top-directory for this sub-suite - SuiteTopDir = filename:join([PrivDir, ?MODULE]), - case file:make_dir(SuiteTopDir) of - ok -> - ok; - {error, eexist} -> - %% This can happen since this is not really a - %% suite-init function. - ok; - {error, Reason} -> - ?FAIL({failed_creating_suite_top_dir, SuiteTopDir, Reason}) - end, - - - %% -- - %% Fix config (data-dir is not correct): - %% - - Config1 = fix_data_dir(Config), - %% Config1 = Config, - - %% Mib-dirs - MibDir = ?config(data_dir, Config1), - StdMibDir = filename:join([code:priv_dir(snmp), "mibs"]), - - Config2 = [{suite_top_dir, SuiteTopDir}, - {mib_dir, MibDir}, - {std_mib_dir, StdMibDir} | Config1], - - ?DBG("init_per_suite -> done when" - "~n Config2: ~p", [Config2]), - Config2. - -%% end_per_suite(Config) -> -end_per_suite(Config) -> - Config. - -fix_data_dir(Config) -> - DataDir0 = ?config(data_dir, Config), - DataDir1 = filename:split(filename:absname(DataDir0)), - [_|DataDir2] = lists:reverse(DataDir1), - DataDir = filename:join(lists:reverse(DataDir2) ++ [?snmp_test_data]), - Config1 = lists:keydelete(data_dir, 1, Config), - [{data_dir, DataDir} | Config1]. +init_per_testcase2(Case, Config) -> + ?DBG("end_per_testcase2 -> entry with" + "~n Case: ~p" + "~n Config: ~p", [Case, Config]), -init_per_testcase2(Case, Config) -> - SuiteToDir = ?config(suite_top_dir, Config), - - %% Create top-directory for this test-case - CaseTopDir = filename:join([SuiteToDir, Case]), - ok = file:make_dir(CaseTopDir), + CaseTopDir = snmp_test_lib:init_testcase_top_dir(Case, Config), %% Create agent top-dir(s) AgentTopDir = filename:join([CaseTopDir, agent]), @@ -623,19 +599,19 @@ mib_storage_mnesia_cases() -> msm_mib_of]. mse_size_check_cases() -> -[mse_size_check]. + [mse_size_check]. msd_size_check_cases() -> -[msd_size_check]. + [msd_size_check]. msm_size_check_cases() -> -[msm_size_check]. + [msm_size_check]. varm_mib_storage_dets_cases() -> -[msd_varm_mib_start]. + [msd_varm_mib_start]. varm_mib_storage_mnesia_cases() -> -[msm_varm_mib_start]. + [msm_varm_mib_start]. init_mib_storage_ets(Config) when is_list(Config) -> ?LOG("init_mib_storage_ets -> entry", []), @@ -644,36 +620,37 @@ init_mib_storage_ets(Config) when is_list(Config) -> init_mib_storage_dets(Config) when is_list(Config) -> ?LOG("init_mib_storage_ets -> entry", []), - ?line AgentDir = ?GCONF(agent_dir, Config), - MibStorage = {snmp_mib_storage,{dets,AgentDir}}, + ?line AgentDbDir = ?GCONF(agent_db_dir, Config), + MibStorage = {snmp_mib_storage, {dets, AgentDbDir}}, init_ms(Config, [MibStorage]). init_mib_storage_mnesia(Config) when is_list(Config) -> ?LOG("init_mib_storage_ets -> entry", []), - MibStorage = {snmp_mib_storage,{mnesia,[]}}, + MibStorage = {snmp_mib_storage, {mnesia,[]}}, init_ms(Config, [MibStorage]). init_ms(Config, Opts) when is_list(Config) -> ?LOG("init_mib_storage_ets -> entry", []), - ?line SaNode = ?GCONF(snmp_sa, Config), + ?line SaNode = ?GCONF(snmp_sa, Config), ?line create_tables(SaNode), - ?line AgentDir = ?GCONF(agent_dir, Config), - ?line MgrDir = ?GCONF(mgr_dir, Config), - ?line Ip = ?GCONF(ip, Config), - ?line config([v1], MgrDir, AgentDir, tuple_to_list(Ip), tuple_to_list(Ip)), + ?line AgentConfDir = ?GCONF(agent_conf_dir, Config), + ?line MgrDir = ?GCONF(mgr_dir, Config), + ?line Ip = ?GCONF(ip, Config), + ?line config([v1], MgrDir, AgentConfDir, + tuple_to_list(Ip), tuple_to_list(Ip)), MasterAgentVerbosity = {snmp_master_agent_verbosity, trace}, MibsVerbosity = {snmp_mibserver_verbosity, trace}, SymStoreVerbosity = {snmp_symbolic_store_verbosity, trace}, - Opts1 = [MasterAgentVerbosity,MibsVerbosity,SymStoreVerbosity|Opts], - [{vsn, v1} | start_v1_agent(Config,Opts1)]. + Opts1 = [MasterAgentVerbosity, MibsVerbosity, SymStoreVerbosity | Opts], + [{vsn, v1} | start_v1_agent(Config, Opts1)]. init_size_check_mse(Config) when is_list(Config) -> MibStorage = {snmp_mib_storage, ets}, init_size_check_ms(Config, [MibStorage]). init_size_check_msd(Config) when is_list(Config) -> - AgentDir = ?GCONF(agent_dir, Config), - MibStorage = {snmp_mib_storage, {dets, AgentDir}}, + AgentDbDir = ?GCONF(agent_db_dir, Config), + MibStorage = {snmp_mib_storage, {dets, AgentDbDir}}, init_size_check_ms(Config, [MibStorage]). init_size_check_msm(Config) when is_list(Config) -> @@ -695,22 +672,24 @@ init_size_check_ms(Config, Opts) when is_list(Config) -> ?SKIP({failed_starting_crypto, Reason}) end, create_tables(SaNode), - AgentDir = ?GCONF(agent_dir, Config), - MgrDir = ?GCONF(mgr_dir, Config), - Ip = ?GCONF(ip, Config), - ?line ok = - config([v3], MgrDir, AgentDir, tuple_to_list(Ip), tuple_to_list(Ip)), + AgentConfDir = ?GCONF(agent_conf_dir, Config), + MgrDir = ?GCONF(mgr_dir, Config), + Ip = ?GCONF(ip, Config), + ?line ok = config([v3], MgrDir, AgentConfDir, + tuple_to_list(Ip), tuple_to_list(Ip)), [{vsn, v3} | start_v3_agent(Config, Opts)]. init_varm_mib_storage_dets(Config) when is_list(Config) -> ?LOG("init_varm_mib_storage_dets -> entry", []), - ?line SaNode = ?GCONF(snmp_sa, Config), + ?line SaNode = ?GCONF(snmp_sa, Config), ?line create_tables(SaNode), - ?line AgentDir = ?GCONF(agent_dir, Config), - ?line MgrDir = ?GCONF(mgr_dir, Config), - ?line Ip = ?GCONF(ip, Config), - ?line config([v1], MgrDir, AgentDir, tuple_to_list(Ip), tuple_to_list(Ip)), - MibStorage = {snmp_mib_storage,{dets,AgentDir}}, + ?line AgentDbDir = ?GCONF(agent_db_dir, Config), + ?line AgentConfDir = ?GCONF(agent_conf_dir, Config), + ?line MgrDir = ?GCONF(mgr_dir, Config), + ?line Ip = ?GCONF(ip, Config), + ?line config([v1], MgrDir, AgentConfDir, + tuple_to_list(Ip), tuple_to_list(Ip)), + MibStorage = {snmp_mib_storage, {dets, AgentDbDir}}, MasterAgentVerbosity = {snmp_master_agent_verbosity, trace}, MibsVerbosity = {snmp_mibserver_verbosity, trace}, SymStoreVerbosity = {snmp_symbolic_store_verbosity, trace}, @@ -719,12 +698,13 @@ init_varm_mib_storage_dets(Config) when is_list(Config) -> init_varm_mib_storage_mnesia(Config) when is_list(Config) -> ?LOG("init_varm_mib_storage_mnesia -> entry", []), - ?line SaNode = ?GCONF(snmp_sa, Config), + ?line SaNode = ?GCONF(snmp_sa, Config), ?line create_tables(SaNode), - ?line AgentDir = ?GCONF(agent_dir, Config), - ?line MgrDir = ?GCONF(mgr_dir, Config), - ?line Ip = ?GCONF(ip, Config), - ?line config([v1], MgrDir, AgentDir, tuple_to_list(Ip), tuple_to_list(Ip)), + ?line AgentConfDir = ?GCONF(agent_conf_dir, Config), + ?line MgrDir = ?GCONF(mgr_dir, Config), + ?line Ip = ?GCONF(ip, Config), + ?line config([v1], MgrDir, AgentConfDir, + tuple_to_list(Ip), tuple_to_list(Ip)), MibStorage = {snmp_mib_storage,{mnesia,[]}}, MasterAgentVerbosity = {snmp_master_agent_verbosity, trace}, MibsVerbosity = {snmp_mibserver_verbosity, trace}, @@ -1189,10 +1169,11 @@ v1_cases() -> init_v1(Config) when is_list(Config) -> ?line SaNode = ?config(snmp_sa, Config), ?line create_tables(SaNode), - ?line AgentDir = ?config(agent_dir, Config), + ?line AgentConfDir = ?config(agent_conf_dir, Config), ?line MgrDir = ?config(mgr_dir, Config), ?line Ip = ?config(ip, Config), - ?line config([v1], MgrDir, AgentDir, tuple_to_list(Ip), tuple_to_list(Ip)), + ?line config([v1], MgrDir, AgentConfDir, + tuple_to_list(Ip), tuple_to_list(Ip)), [{vsn, v1} | start_v1_agent(Config)]. finish_v1(Config) when is_list(Config) -> @@ -1232,10 +1213,11 @@ v2_cases() -> init_v2(Config) when is_list(Config) -> SaNode = ?config(snmp_sa, Config), create_tables(SaNode), - AgentDir = ?config(agent_dir, Config), + AgentConfDir = ?config(agent_conf_dir, Config), MgrDir = ?config(mgr_dir, Config), Ip = ?config(ip, Config), - config([v2], MgrDir, AgentDir, tuple_to_list(Ip), tuple_to_list(Ip)), + config([v2], MgrDir, AgentConfDir, + tuple_to_list(Ip), tuple_to_list(Ip)), [{vsn, v2} | start_v2_agent(Config)]. finish_v2(Config) when is_list(Config) -> @@ -1251,10 +1233,11 @@ v1_v2_cases() -> init_v1_v2(Config) when is_list(Config) -> SaNode = ?config(snmp_sa, Config), create_tables(SaNode), - AgentDir = ?config(agent_dir, Config), + AgentConfDir = ?config(agent_conf_dir, Config), MgrDir = ?config(mgr_dir, Config), Ip = ?config(ip, Config), - config([v1,v2], MgrDir, AgentDir, tuple_to_list(Ip), tuple_to_list(Ip)), + config([v1,v2], MgrDir, AgentConfDir, + tuple_to_list(Ip), tuple_to_list(Ip)), [{vsn, bilingual} | start_bilingual_agent(Config)]. finish_v1_v2(Config) when is_list(Config) -> @@ -1315,10 +1298,10 @@ init_v3(Config) when is_list(Config) -> end, SaNode = ?config(snmp_sa, Config), create_tables(SaNode), - AgentDir = ?config(agent_dir, Config), + AgentConfDir = ?config(agent_conf_dir, Config), MgrDir = ?config(mgr_dir, Config), Ip = ?config(ip, Config), - ?line ok = config([v3], MgrDir, AgentDir, + ?line ok = config([v3], MgrDir, AgentConfDir, tuple_to_list(Ip), tuple_to_list(Ip)), [{vsn, v3} | start_v3_agent(Config)]. @@ -1338,11 +1321,11 @@ mt_cases() -> init_mt(Config) when is_list(Config) -> SaNode = ?config(snmp_sa, Config), create_tables(SaNode), - AgentDir = ?config(agent_dir, Config), + AgentConfDir = ?config(agent_conf_dir, Config), MgrDir = ?config(mgr_dir, Config), Ip = ?config(ip, Config), - ?line ok = - config([v2], MgrDir, AgentDir, tuple_to_list(Ip), tuple_to_list(Ip)), + ?line ok = config([v2], MgrDir, AgentConfDir, + tuple_to_list(Ip), tuple_to_list(Ip)), [{vsn, v2} | start_multi_threaded_agent(Config)]. finish_mt(Config) when is_list(Config) -> @@ -1421,7 +1404,13 @@ simple(Config) when is_list(Config) -> ?P(simple), init_case(Config), - try_test(simple_standard_test). + try_test(simple_standard_test), + + p("Display log"), + display_log(Config), + + p("done"), + ok. simple_2(X) -> ?P(simple_2), simple(X). @@ -1601,7 +1590,7 @@ change_target_addr_config(Config) when is_list(Config) -> try_test(ma_trap1, [MA]), ?LOG("change_target_addr_config -> set silence verbosity for local_db",[]), - ?line snmpa:verbosity(local_db,silence), + ?line snmpa:verbosity(local_db, silence), %% Start new dummy listener ?LOG("change_target_addr_config -> start dummy manager",[]), @@ -1609,9 +1598,9 @@ change_target_addr_config(Config) when is_list(Config) -> %% Reconfigure ?LOG("change_target_addr_config -> reconfigure",[]), - AgentDir = ?config(agent_dir, Config), - ?line rewrite_target_addr_conf(AgentDir, NewPort), - ?line snmp_target_mib:reconfigure(AgentDir), + AgentConfDir = ?config(agent_conf_dir, Config), + ?line rewrite_target_addr_conf(AgentConfDir, NewPort), + ?line snmp_target_mib:reconfigure(AgentConfDir), %% Send the trap again ?LOG("change_target_addr_config -> send trap again",[]), @@ -1624,7 +1613,7 @@ change_target_addr_config(Config) when is_list(Config) -> ?line ok = dummy_manager_stop(Pid), ?LOG("change_target_addr_config -> reset target address config",[]), - ?line reset_target_addr_conf(AgentDir), + ?line reset_target_addr_conf(AgentConfDir), ?LOG("change_target_addr_config -> unload TestTrap",[]), ?line unload_master("TestTrap"). @@ -2067,7 +2056,7 @@ v3_inform(_X) -> {req, [], {conf, init_v3_inform, [v3_inform_i], finish_v3_inform}}. init_v2_inform(Config) when is_list(Config) -> - _Dir = ?config(agent_dir, Config), + _Dir = ?config(agent_conf_dir, Config), %% snmp_internal_mib:configure(Dir), Config. @@ -2075,7 +2064,7 @@ init_v3_inform(X) -> init_v2_inform(X). finish_v2_inform(Config) when is_list(Config) -> - _Dir = ?config(agent_dir, Config), + _Dir = ?config(agent_conf_dir, Config), %% snmp_internal_mib:configure(Dir), Config. @@ -2377,9 +2366,9 @@ v3_md5_auth(Config) when is_list(Config) -> ?P1("Testing MD5 authentication...takes a few seconds..."), - AgentDir = ?config(agent_dir, Config), - ?line rewrite_target_params_conf(AgentDir, "authMD5", authNoPriv), - ?line snmp_target_mib:reconfigure(AgentDir), + AgentConfDir = ?config(agent_conf_dir, Config), + ?line rewrite_target_params_conf(AgentConfDir, "authMD5", authNoPriv), + ?line snmp_target_mib:reconfigure(AgentConfDir), MA = whereis(snmp_master_agent), @@ -2388,14 +2377,14 @@ v3_md5_auth(Config) when is_list(Config) -> ?line load_master("TestTrapv2"), try_test(v3_sync, [[{v2_proc, []}, - {ma_v2_trap1, [MA]}, - {v3_inform_sync, [MA]}]], - [{sec_level, authNoPriv}, {user, "authMD5"}]), + {ma_v2_trap1, [MA]}, + {v3_inform_sync, [MA]}]], + [{sec_level, authNoPriv}, {user, "authMD5"}]), ?line unload_master("TestTrapv2"), ?line unload_master("TestTrap"), ?line unload_master("Test2"), - ?line reset_target_params_conf(AgentDir). + ?line reset_target_params_conf(AgentConfDir). v3_sha_auth(suite) -> []; v3_sha_auth(Config) when is_list(Config) -> @@ -2404,9 +2393,9 @@ v3_sha_auth(Config) when is_list(Config) -> ?P1("Testing SHA authentication...takes a few seconds..."), - AgentDir = ?config(agent_dir, Config), - ?line rewrite_target_params_conf(AgentDir, "authSHA", authNoPriv), - ?line snmp_target_mib:reconfigure(AgentDir), + AgentConfDir = ?config(agent_conf_dir, Config), + ?line rewrite_target_params_conf(AgentConfDir, "authSHA", authNoPriv), + ?line snmp_target_mib:reconfigure(AgentConfDir), MA = whereis(snmp_master_agent), @@ -2415,14 +2404,14 @@ v3_sha_auth(Config) when is_list(Config) -> ?line load_master("TestTrapv2"), try_test(v3_sync, [[{v2_proc, []}, - {ma_v2_trap1, [MA]}, - {v3_inform_sync, [MA]}]], - [{sec_level, authNoPriv}, {user, "authSHA"}]), + {ma_v2_trap1, [MA]}, + {v3_inform_sync, [MA]}]], + [{sec_level, authNoPriv}, {user, "authSHA"}]), ?line unload_master("TestTrapv2"), ?line unload_master("TestTrap"), ?line unload_master("Test2"), - ?line reset_target_params_conf(AgentDir). + ?line reset_target_params_conf(AgentConfDir). v3_des_priv(suite) -> []; v3_des_priv(Config) when is_list(Config) -> @@ -2431,9 +2420,9 @@ v3_des_priv(Config) when is_list(Config) -> ?P1("Testing DES encryption...takes a few seconds..."), - AgentDir = ?config(agent_dir, Config), - ?line rewrite_target_params_conf(AgentDir, "privDES", authPriv), - ?line snmp_target_mib:reconfigure(AgentDir), + AgentConfDir = ?config(agent_conf_dir, Config), + ?line rewrite_target_params_conf(AgentConfDir, "privDES", authPriv), + ?line snmp_target_mib:reconfigure(AgentConfDir), MA = whereis(snmp_master_agent), @@ -2444,14 +2433,14 @@ v3_des_priv(Config) when is_list(Config) -> ?line load_master("TestTrapv2"), try_test(v3_sync, [[{v2_proc, []}, - {ma_v2_trap1, [MA]}, - {v3_inform_sync, [MA]}]], - [{sec_level, authPriv}, {user, "privDES"}]), + {ma_v2_trap1, [MA]}, + {v3_inform_sync, [MA]}]], + [{sec_level, authPriv}, {user, "privDES"}]), ?line unload_master("TestTrapv2"), ?line unload_master("TestTrap"), ?line unload_master("Test2"), - ?line reset_target_params_conf(AgentDir). + ?line reset_target_params_conf(AgentConfDir). %% -define(usmStatsNotInTimeWindows_instance, [1,3,6,1,6,3,15,1,1,2,0]). @@ -4795,7 +4784,7 @@ snmp_user_based_sm_mib_3(Config) when is_list(Config) -> ?P(snmp_user_based_sm_mib_3), init_case(Config), - _AgentDir = ?config(agent_dir, Config), + _AgentDir = ?config(agent_conf_dir, Config), ?line load_master_std("SNMP-USER-BASED-SM-MIB"), %% The newUser used here already has VACM access. @@ -5727,28 +5716,28 @@ otp_3725_test(MaNode) -> init_otp_4394(Config) when is_list(Config) -> ?DBG("init_otp_4394 -> entry with" "~n Config: ~p", [Config]), - ?line AgentDir = ?config(agent_dir, Config), - ?line MgrDir = ?config(mgr_dir, Config), - ?line Ip = ?config(ip, Config), - ?line otp_4394_config(AgentDir, MgrDir, Ip), + ?line AgentConfDir = ?config(agent_conf_dir, Config), + ?line MgrDir = ?config(mgr_dir, Config), + ?line Ip = ?config(ip, Config), + ?line otp_4394_config(AgentConfDir, MgrDir, Ip), MasterAgentVerbosity = {master_agent_verbosity, trace}, NetIfVerbosity = {net_if_verbosity, trace}, - Opts = [MasterAgentVerbosity,NetIfVerbosity], - [{vsn, v1} | start_v1_agent(Config,Opts)]. + Opts = [MasterAgentVerbosity, NetIfVerbosity], + [{vsn, v1} | start_v1_agent(Config, Opts)]. -otp_4394_config(AgentDir, MgrDir, Ip0) -> +otp_4394_config(AgentConfDir, MgrDir, Ip0) -> ?DBG("otp_4394_config -> entry with" - "~n AgentDir: ~p" - "~n MgrDir: ~p" - "~n Ip0: ~p", [AgentDir, MgrDir, Ip0]), + "~n AgentConfDir: ~p" + "~n MgrDir: ~p" + "~n Ip0: ~p", [AgentConfDir, MgrDir, Ip0]), Vsn = [v1], Ip = tuple_to_list(Ip0), - ?line snmp_config:write_agent_snmp_files(AgentDir, Vsn, Ip, + ?line snmp_config:write_agent_snmp_files(AgentConfDir, Vsn, Ip, ?TRAP_UDP, Ip, 4000, "OTP-4394 test"), - ?line case update_usm(Vsn, AgentDir) of + ?line case update_usm(Vsn, AgentConfDir) of true -> - ?line copy_file(filename:join(AgentDir, "usm.conf"), + ?line copy_file(filename:join(AgentConfDir, "usm.conf"), filename:join(MgrDir, "usm.conf")), ?line update_usm_mgr(Vsn, MgrDir); false -> @@ -5756,8 +5745,8 @@ otp_4394_config(AgentDir, MgrDir, Ip0) -> end, C1 = {"a", "all-rights", "initial", "", "pc"}, C2 = {"c", "secret", "secret_name", "", "secret_tag"}, - ?line write_community_conf(AgentDir, [C1, C2]), - ?line update_vacm(Vsn, AgentDir), + ?line write_community_conf(AgentConfDir, [C1, C2]), + ?line update_vacm(Vsn, AgentConfDir), Ta1 = {"shelob v1", [134,138,177,177], 5000, 1500, 3, %% Anv�nd Ip och modda "pc1", @@ -5771,9 +5760,9 @@ otp_4394_config(AgentDir, MgrDir, Ip0) -> "target_v1", "", %% [255,255,255,255,0,0], [], 2048}, - ?line write_target_addr_conf(AgentDir, [Ta1, Ta2]), - ?line write_target_params_conf(AgentDir, Vsn), - ?line write_notify_conf(AgentDir), + ?line write_target_addr_conf(AgentConfDir, [Ta1, Ta2]), + ?line write_target_params_conf(AgentConfDir, Vsn), + ?line write_notify_conf(AgentConfDir), ok. @@ -5826,10 +5815,11 @@ init_otp_7157(Config) when is_list(Config) -> ?DBG("init_otp_7157 -> entry with" "~n Config: ~p", [Config]), - ?line AgentDir = ?config(agent_dir, Config), + ?line AgentConfDir = ?config(agent_conf_dir, Config), ?line MgrDir = ?config(mgr_dir, Config), ?line Ip = ?config(ip, Config), - ?line config([v2], MgrDir, AgentDir, tuple_to_list(Ip), tuple_to_list(Ip)), + ?line config([v2], MgrDir, AgentConfDir, + tuple_to_list(Ip), tuple_to_list(Ip)), MasterAgentVerbosity = {master_agent_verbosity, trace}, NetIfVerbosity = {net_if_verbosity, trace}, Opts = [MasterAgentVerbosity, NetIfVerbosity], @@ -6562,8 +6552,8 @@ write_community_conf(Dir, Conf) -> write_target_addr_conf(Dir, Conf) -> snmp_agent_test_lib:write_target_addr_conf(Dir, Conf). -write_target_addr_conf(Dir, ManagerIp, UDP, Vsns) -> - snmp_agent_test_lib:write_target_addr_conf(Dir, ManagerIp, UDP, Vsns). +%% write_target_addr_conf(Dir, ManagerIp, UDP, Vsns) -> +%% snmp_agent_test_lib:write_target_addr_conf(Dir, ManagerIp, UDP, Vsns). rewrite_target_addr_conf(Dir, NewPort) -> snmp_agent_test_lib:rewrite_target_addr_conf(Dir, NewPort). @@ -6596,9 +6586,42 @@ copy_file(From, To) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +display_log(Config) -> + case lists:keysearch(agent_log_dir, 1, Config) of + {value, {_, Dir}} -> + case lists:keysearch(snmp_master, 1, Config) of + {value, {_, Node}} -> + LogDir = Dir, + Mibs = [], + OutFile = filename:join(LogDir, "snmpa_log.txt"), + p("~n" + "=========================" + " < Audit Trail Log > " + "=========================" + "~n"), + rcall(Node, snmpa, log_to_txt, [LogDir, Mibs, OutFile]), + rcall(Node, snmpa, log_to_io, [LogDir, Mibs]), + p("~n" + "=========================" + " < / Audit Trail Log > " + "=========================" + "~n", []); + false -> + p("display_log -> no agent node found"), + ok + end; + false -> + p("display_log -> no agent log dir found: " + "~n ~p", [Config]), + ok + end. + + +%% ------ + display_memory_usage() -> Info = snmpa:info(snmp_master_agent), - AMU = display_agent_memory_uasge(Info), + AMU = display_agent_memory_usage(Info), NIMU = display_net_if_memory_usage(Info), NSMU = display_note_store_memory_usage(Info), SSMU = display_symbolic_store_memory_usage(Info), @@ -6608,7 +6631,7 @@ display_memory_usage() -> AMU ++ NIMU ++ NSMU ++ SSMU ++ LDBMU ++ MSMU, []), ok. -display_agent_memory_uasge(Info) -> +display_agent_memory_usage(Info) -> AgentInfo = lists_key1search(agent, Info), ProcMem = lists_key1search([process_memory,master_agent], AgentInfo), @@ -6717,3 +6740,27 @@ lists_key1search(Key, List) when is_atom(Key) -> regs() -> lists:sort(registered()). + +%% ------ + +rcall(Node, Mod, Func, Args) -> + case rpc:call(Node, Mod, Func, Args) of + {badrpc, nodedown} -> + ?FAIL({rpc_failure, Node}); + Else -> + Else + end. + + +%% ------ + +p(F) -> + p(F, []). + +p(F, A) -> + io:format("*** [~s] ***" + "~n" ++ F ++ "~n", [formated_timestamp()|A]). + +formated_timestamp() -> + snmp_test_lib:formated_timestamp(). + diff --git a/lib/snmp/test/snmp_agent_test_lib.erl b/lib/snmp/test/snmp_agent_test_lib.erl index 084b3ee8da..cd9a87eab8 100644 --- a/lib/snmp/test/snmp_agent_test_lib.erl +++ b/lib/snmp/test/snmp_agent_test_lib.erl @@ -119,20 +119,10 @@ %%% didn't undo (since it failed). %%%----------------------------------------------------------------- -init_all(Config0) when is_list(Config0) -> - ?LOG("init_all -> entry with" - "~n Config0: ~p",[Config0]), - - %% -- - %% Fix config: - %% +init_all(Config) when is_list(Config) -> - DataDir0 = ?config(data_dir, Config0), - DataDir1 = filename:split(filename:absname(DataDir0)), - [_|DataDir2] = lists:reverse(DataDir1), - DataDir3 = filename:join(lists:reverse(DataDir2) ++ [?snmp_test_data]), - Config1 = lists:keydelete(data_dir, 1, Config0), - Config = [{data_dir, DataDir3 ++ "/"}|Config1], + ?LOG("init_all -> entry with" + "~n Config: ~p",[Config]), %% -- %% Start nodes @@ -143,34 +133,43 @@ init_all(Config0) when is_list(Config0) -> %% -- - %% Create necessary files + %% Create necessary files ( and dirs ) %% - PrivDir = ?config(priv_dir, Config), - ?DBG("init_all -> PrivDir ~p", [PrivDir]), + SuiteTopDir = ?config(snmp_suite_top_dir, Config), + ?DBG("init_all -> SuiteTopDir ~p", [SuiteTopDir]), - TopDir = filename:join(PrivDir, snmp_agent_test), - case file:make_dir(TopDir) of - ok -> - ok; - {error, eexist} -> - ok; - Error -> - ?FAIL({failed_creating_subsuite_top_dir, Error}) - end, + AgentDir = filename:join(SuiteTopDir, "agent/"), + ?line ok = file:make_dir(AgentDir), + ?DBG("init_all -> AgentDir ~p", [AgentDir]), - DataDir = ?config(data_dir, Config), - ?DBG("init_all -> DataDir ~p", [DataDir]), + AgentDbDir = filename:join(AgentDir, "db/"), + ?line ok = file:make_dir(AgentDbDir), + ?DBG("init_all -> AgentDbDir ~p", [AgentDbDir]), - ?line ok = file:make_dir(MgrDir = filename:join(TopDir, "mgr_dir/")), - ?DBG("init_all -> MgrDir ~p", [MgrDir]), + AgentLogDir = filename:join(AgentDir, "log/"), + ?line ok = file:make_dir(AgentLogDir), + ?DBG("init_all -> AgentLogDir ~p", [AgentLogDir]), - ?line ok = file:make_dir(AgentDir = filename:join(TopDir, "agent_dir/")), - ?DBG("init_all -> AgentDir ~p", [AgentDir]), + AgentConfDir = filename:join(AgentDir, "conf/"), + ?line ok = file:make_dir(AgentConfDir), + ?DBG("init_all -> AgentConfDir ~p", [AgentConfDir]), - ?line ok = file:make_dir(SaDir = filename:join(TopDir, "sa_dir/")), + MgrDir = filename:join(SuiteTopDir, "mgr/"), + ?line ok = file:make_dir(MgrDir), + ?DBG("init_all -> MgrDir ~p", [MgrDir]), + + SaDir = filename:join(SuiteTopDir, "sa/"), + ?line ok = file:make_dir(SaDir), ?DBG("init_all -> SaDir ~p", [SaDir]), + SaDbDir = filename:join(SaDir, "db/"), + ?line ok = file:make_dir(SaDbDir), + ?DBG("init_all -> SaDbDir ~p", [SaDbDir]), + + %% MibDir = ?config(mib_dir, Config), + %% ?DBG("init_all -> MibDir ~p", [DataDir]), + %% -- %% Start and initiate mnesia @@ -184,11 +183,11 @@ init_all(Config0) when is_list(Config0) -> ?DBG("init_all -> application mnesia: set_env dir",[]), ?line application_controller:set_env(mnesia, dir, - filename:join(TopDir, "Mnesia1")), + filename:join(AgentDbDir, "Mnesia1")), ?DBG("init_all -> application mnesia: set_env dir on node ~p",[SaNode]), - ?line rpc:call(SaNode, application_controller, set_env, - [mnesia, dir, filename:join(TopDir, "Mnesia2")]), + ?line rpc:call(SaNode, application_controller, set_env, + [mnesia, dir, filename:join(SaDir, "Mnesia2")]), ?DBG("init_all -> create mnesia schema",[]), ?line ok = mnesia:create_schema([SaNode, node()]), @@ -199,13 +198,18 @@ init_all(Config0) when is_list(Config0) -> ?DBG("init_all -> start application mnesia on ~p",[SaNode]), ?line ok = rpc:call(SaNode, application, start, [mnesia]), Ip = ?LOCALHOST(), - [{snmp_sa, SaNode}, - {snmp_mgr, MgrNode}, - {agent_dir, AgentDir ++ "/"}, - {mgr_dir, MgrDir ++ "/"}, - {sa_dir, SaDir ++ "/"}, - {mib_dir, DataDir}, - {ip, Ip} | + [{snmp_sa, SaNode}, + {snmp_mgr, MgrNode}, + {snmp_master, node()}, + {agent_dir, AgentDir ++ "/"}, + {agent_db_dir, AgentDbDir ++ "/"}, + {agent_log_dir, AgentLogDir ++ "/"}, + {agent_conf_dir, AgentConfDir ++ "/"}, + {sa_dir, SaDir ++ "/"}, + {sa_db_dir, SaDbDir ++ "/"}, + {mgr_dir, MgrDir ++ "/"}, + %% {mib_dir, DataDir}, + {ip, Ip} | Config]. @@ -220,11 +224,14 @@ finish_all(Config) when is_list(Config) -> %% --- This one *must* be run first in each case --- init_case(Config) when is_list(Config) -> + ?DBG("init_case -> entry with" - "~n Config: ~p", [Config]), - SaNode = ?config(snmp_sa, Config), - MgrNode = ?config(snmp_mgr, Config), - MasterNode = node(), + "~n Config: ~p", [Config]), + + SaNode = ?config(snmp_sa, Config), + MgrNode = ?config(snmp_mgr, Config), + MasterNode = ?config(snmp_master, Config), + %% MasterNode = node(), SaHost = ?HOSTNAME(SaNode), MgrHost = ?HOSTNAME(MgrNode), @@ -411,7 +418,8 @@ start_v3_agent(Config, Opts) when is_list(Config) andalso is_list(Opts) -> start_bilingual_agent(Config) when is_list(Config) -> start_agent(Config, [v1,v2]). -start_bilingual_agent(Config, Opts) when is_list(Config) andalso is_list(Opts) -> +start_bilingual_agent(Config, Opts) + when is_list(Config) andalso is_list(Opts) -> start_agent(Config, [v1,v2], Opts). start_mt_agent(Config) when is_list(Config) -> @@ -423,57 +431,33 @@ start_mt_agent(Config, Opts) when is_list(Config) andalso is_list(Opts) -> start_agent(Config, Vsns) -> start_agent(Config, Vsns, []). start_agent(Config, Vsns, Opts) -> + ?LOG("start_agent -> entry (~p) with" "~n Config: ~p" "~n Vsns: ~p" "~n Opts: ~p", [node(), Config, Vsns, Opts]), - ?line AgentDir = ?config(agent_dir, Config), - ?line SaNode = ?config(snmp_sa, Config), - -%% AgentConfig = -%% [{agent_type, master}, -%% %% {multi_threaded, MultiT}, -%% %% {priority, Prio}, -%% %% {error_report_mod, ErrorReportMod}, -%% {versions, Vsns}, -%% {db_dir, AgentDir}, -%% %% {db_init_error, DbInitError}, -%% %% {set_mechanism, SetModule}, -%% %% {authentication_service, AuthModule}, -%% {audit_trail_log, [{type, read_write}, -%% {dir, AgentDir}, -%% {size, {10240, 10}}, -%% {repair, true}]}, -%% {config, [{verbosity, info}, -%% {dir, AgentDir}, -%% {force_load, false}]}, -%% {mibs, Mibs}, -%% %% {mib_storage, MibStorage}, -%% {local_db, []}, -%% {mib_server, []}, -%% {symbolic_store, []}, -%% {note_store, []}, -%% {net_if, []}, -%% %% {supervisor, SupOpts} -%% ], - + ?line AgentLogDir = ?config(agent_log_dir, Config), + ?line AgentConfDir = ?config(agent_conf_dir, Config), + ?line AgentDbDir = ?config(agent_db_dir, Config), + ?line SaNode = ?config(snmp_sa, Config), + app_env_init(vsn_init(Vsns) ++ - [{audit_trail_log, read_write_log}, - {audit_trail_log_dir, AgentDir}, - {audit_trail_log_size, {10240, 10}}, - {force_config_reload, false}, - {snmp_agent_type, master}, - {snmp_config_dir, AgentDir}, - {snmp_db_dir, AgentDir}, - {snmp_local_db_auto_repair, true}, - {snmp_local_db_verbosity, log}, - {snmp_master_agent_verbosity, trace}, - {snmp_supervisor_verbosity, trace}, - {snmp_mibserver_verbosity, log}, + [{audit_trail_log, read_write_log}, + {audit_trail_log_dir, AgentLogDir}, + {audit_trail_log_size, {10240, 10}}, + {force_config_reload, false}, + {snmp_agent_type, master}, + {snmp_config_dir, AgentConfDir}, + {snmp_db_dir, AgentDbDir}, + {snmp_local_db_auto_repair, true}, + {snmp_local_db_verbosity, log}, + {snmp_master_agent_verbosity, trace}, + {snmp_supervisor_verbosity, trace}, + {snmp_mibserver_verbosity, log}, {snmp_symbolic_store_verbosity, log}, - {snmp_note_store_verbosity, log}, - {snmp_net_if_verbosity, trace}], + {snmp_note_store_verbosity, log}, + {snmp_net_if_verbosity, trace}], Opts), @@ -1237,30 +1221,44 @@ stop_node(Node) -> %%% Configuration %%%----------------------------------------------------------------- -config(Vsns, MgrDir, AgentDir, MIp, AIp) -> - ?line snmp_config:write_agent_snmp_files(AgentDir, Vsns, MIp, - ?TRAP_UDP, AIp, 4000, +config(Vsns, MgrDir, AgentConfDir, MIp, AIp) -> + ?LOG("config -> entry with" + "~n Vsns: ~p" + "~n MgrDir: ~p" + "~n AgentConfDir: ~p" + "~n MIp: ~p" + "~n AIp: ~p", + [Vsns, MgrDir, AgentConfDir, MIp, AIp]), + ?line snmp_config:write_agent_snmp_files(AgentConfDir, Vsns, + MIp, ?TRAP_UDP, AIp, 4000, "test"), - ?line case update_usm(Vsns, AgentDir) of + ?line case update_usm(Vsns, AgentConfDir) of true -> - ?line copy_file(filename:join(AgentDir, "usm.conf"), + ?line copy_file(filename:join(AgentConfDir, "usm.conf"), filename:join(MgrDir, "usm.conf")), ?line update_usm_mgr(Vsns, MgrDir); false -> ?line ok end, - ?line update_community(Vsns, AgentDir), - ?line update_vacm(Vsns, AgentDir), - ?line write_target_addr_conf(AgentDir, MIp, ?TRAP_UDP, Vsns), - ?line write_target_params_conf(AgentDir, Vsns), - ?line write_notify_conf(AgentDir), + ?line update_community(Vsns, AgentConfDir), + ?line update_vacm(Vsns, AgentConfDir), + ?line write_target_addr_conf(AgentConfDir, MIp, ?TRAP_UDP, Vsns), + ?line write_target_params_conf(AgentConfDir, Vsns), + ?line write_notify_conf(AgentConfDir), ok. delete_files(Config) -> - Dir = ?config(agent_dir, Config), - {ok, List} = file:list_dir(Dir), + AgentDir = ?config(agent_dir, Config), + delete_files(AgentDir, [db, conf]). + +delete_files(_AgentFiles, []) -> + ok; +delete_files(AgentDir, [DirName|DirNames]) -> + Dir = filename:join(AgentDir, DirName), + {ok, Files} = file:list_dir(Dir), lists:foreach(fun(FName) -> file:delete(filename:join(Dir, FName)) end, - List). + Files), + delete_files(AgentDir, DirNames). update_usm(Vsns, Dir) -> case lists:member(v3, Vsns) of @@ -1418,8 +1416,8 @@ rewrite_target_addr_conf2(_NewPort,O) -> O. reset_target_addr_conf(Dir) -> - ?line ok = file:rename(filename:join(Dir,"target_addr.old"), - filename:join(Dir,"target_addr.conf")). + ?line ok = file:rename(filename:join(Dir, "target_addr.old"), + filename:join(Dir, "target_addr.conf")). write_target_params_conf(Dir, Vsns) -> F = fun(v1) -> {"target_v1", v1, v1, "all-rights", noAuthNoPriv}; @@ -1458,7 +1456,6 @@ copy_file(From, To) -> ok = file:write_file(To, Bin). - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% display_memory_usage() -> diff --git a/lib/snmp/test/snmp_app_test.erl b/lib/snmp/test/snmp_app_test.erl index bc62c8d530..0a320dbbce 100644 --- a/lib/snmp/test/snmp_app_test.erl +++ b/lib/snmp/test/snmp_app_test.erl @@ -23,8 +23,9 @@ -module(snmp_app_test). -export([ - all/0,groups/0,init_per_group/2,end_per_group/2, init_per_suite/1, - end_per_suite/1, + all/0, groups/0, + init_per_group/2, end_per_group/2, + init_per_suite/1, end_per_suite/1, init_per_testcase/2, end_per_testcase/2, fields/1, @@ -52,33 +53,47 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% all() -> -Cases = [fields, modules, exportall, app_depend, - undef_funcs, {group, start_and_stop}], - Cases. + Cases = + [ + fields, + modules, + exportall, + app_depend, + undef_funcs, + {group, start_and_stop} + ], + Cases. groups() -> [{start_and_stop, [], - [start_and_stop_empty, start_and_stop_with_agent, - start_and_stop_with_manager, - start_and_stop_with_agent_and_manager, - start_epmty_and_then_agent_and_manager_and_stop, - start_with_agent_and_then_manager_and_stop, - start_with_manager_and_then_agent_and_stop]}]. + [start_and_stop_empty, + start_and_stop_with_agent, + start_and_stop_with_manager, + start_and_stop_with_agent_and_manager, + start_epmty_and_then_agent_and_manager_and_stop, + start_with_agent_and_then_manager_and_stop, + start_with_manager_and_then_agent_and_stop]}]. init_per_group(_GroupName, Config) -> - Config. + Config. end_per_group(_GroupName, Config) -> - Config. + Config. init_per_suite(Config) when is_list(Config) -> ?DISPLAY_SUITE_INFO(), + + %% Note that part of this stuff (the suite top dir creation) + %% may already be done (if we run the entire snmp suite). + PrivDir = ?config(priv_dir, Config), TopDir = filename:join(PrivDir, app), case file:make_dir(TopDir) of ok -> ok; + {error, eexist} -> + ok; Error -> fail({failed_creating_subsuite_top_dir, Error}) end, diff --git a/lib/snmp/test/snmp_compiler_test.erl b/lib/snmp/test/snmp_compiler_test.erl index 0a147130b0..257fc47952 100644 --- a/lib/snmp/test/snmp_compiler_test.erl +++ b/lib/snmp/test/snmp_compiler_test.erl @@ -40,6 +40,7 @@ all/0, groups/0, init_per_group/2, end_per_group/2, init_per_testcase/2, end_per_testcase/2, + init_per_suite/1, end_per_suite/1, description/1, oid_conflicts/1, @@ -48,6 +49,7 @@ agent_capabilities/1, module_compliance/1, warnings_as_errors/1, + augments_extra_info/1, otp_6150/1, otp_8574/1, @@ -58,6 +60,7 @@ %%---------------------------------------------------------------------- %% Internal exports %%---------------------------------------------------------------------- + -export([ ]). @@ -74,19 +77,41 @@ %% External functions %%====================================================================== -init_per_testcase(_Case, Config) when is_list(Config) -> - Dir = ?config(priv_dir, Config), - DataDir = ?config(data_dir, Config), - [_|RL] = lists:reverse(filename:split(DataDir)), - MibDir = join(lists:reverse(["snmp_test_data"|RL])), - CompDir = join(Dir, "comp_dir/"), - ?line ok = file:make_dir(CompDir), - [{comp_dir, CompDir}, {mib_dir, MibDir} | Config]. +init_per_suite(Config0) when is_list(Config0) -> + + ?DBG("init_per_suite -> entry with" + "~n Config0: ~p", [Config0]), + + Config1 = snmp_test_lib:init_suite_top_dir(?MODULE, Config0), + Config2 = snmp_test_lib:fix_data_dir(Config1), + + %% Mib-dirs + %% data_dir is trashed by the test-server / common-test + %% so there is no point in fixing it... + MibDir = snmp_test_lib:lookup(data_dir, Config2), + StdMibDir = filename:join([code:priv_dir(snmp), "mibs"]), + + [{mib_dir, MibDir}, {std_mib_dir, StdMibDir} | Config2]. + +end_per_suite(Config) when is_list(Config) -> + + ?DBG("end_per_suite -> entry with" + "~n Config: ~p", [Config]), + + Config. + + +init_per_testcase(Case, Config) when is_list(Config) -> + + ?DBG("init_per_testcase -> entry with" + "~n Config: ~p", [Config]), + + CaseTopDir = snmp_test_lib:init_testcase_top_dir(Case, Config), + + [{case_top_dir, CaseTopDir} | Config]. end_per_testcase(_Case, Config) when is_list(Config) -> - CompDir = ?config(comp_dir, Config), - ?line ok = ?DEL_DIR(CompDir), - lists:keydelete(comp_dir, 1, Config). + Config. %%====================================================================== @@ -102,6 +127,7 @@ all() -> agent_capabilities, module_compliance, warnings_as_errors, + augments_extra_info, {group, tickets} ]. @@ -126,7 +152,7 @@ description(Config) when is_list(Config) -> put(tname,desc), p("starting with Config: ~p~n", [Config]), - Dir = ?config(comp_dir, Config), + Dir = ?config(case_top_dir, Config), Filename = join(Dir,"test"), MibSrcName = Filename ++ ".mib", MibBinName = Filename ++ ".bin", @@ -161,7 +187,7 @@ oid_conflicts(Config) when is_list(Config) -> put(tname,oid_conflicts), p("starting with Config: ~p~n", [Config]), - Dir = ?config(comp_dir, Config), + Dir = ?config(case_top_dir, Config), Mib = join(Dir,"TESTv2.mib"), ?line ok = write_oid_conflict_mib(Mib), ?line {error,compilation_failed} = @@ -278,7 +304,7 @@ warnings_as_errors(suite) -> warnings_as_errors(Config) when is_list(Config) -> put(tname,warnings_as_errors), p("starting with Config: ~p~n", [Config]), - Dir = ?config(comp_dir, Config), + Dir = ?config(case_top_dir, Config), MibDir = ?config(mib_dir, Config), MibFile = join(MibDir, "OTP8574-MIB.mib"), OutFile = join(Dir, "OTP8574-MIB.bin"), @@ -303,7 +329,7 @@ otp_6150(Config) when is_list(Config) -> put(tname,otp_6150), p("starting with Config: ~p~n", [Config]), - Dir = ?config(comp_dir, Config), + Dir = ?config(case_top_dir, Config), MibDir = ?config(mib_dir, Config), MibFile = join(MibDir, "ERICSSON-TOP-MIB.mib"), ?line {ok, Mib} = snmpc:compile(MibFile, [{outdir, Dir}, {verbosity, trace}]), @@ -319,7 +345,7 @@ otp_8574(Config) when is_list(Config) -> put(tname,otp_8574), p("starting with Config: ~p~n", [Config]), - Dir = ?config(comp_dir, Config), + Dir = ?config(case_top_dir, Config), MibDir = ?config(mib_dir, Config), MibFile = join(MibDir, "OTP8574-MIB.mib"), @@ -352,7 +378,7 @@ otp_8595(Config) when is_list(Config) -> put(tname,otp_8595), p("starting with Config: ~p~n", [Config]), - Dir = ?config(comp_dir, Config), + Dir = ?config(case_top_dir, Config), MibDir = ?config(mib_dir, Config), MibFile = join(MibDir, "OTP8595-MIB.mib"), ?line {ok, Mib} = @@ -364,6 +390,47 @@ otp_8595(Config) when is_list(Config) -> %%====================================================================== + +augments_extra_info(suite) -> + []; +augments_extra_info(Config) when is_list(Config) -> + put(tname, augments_extra_info), + p("starting with Config: ~p~n", [Config]), + + Dir = ?config(case_top_dir, Config), + MibDir = ?config(mib_dir, Config), + Test2File = join(MibDir, "Test2.mib"), + Test3File = join(MibDir, "Test3.mib"), + ?line {ok, Test2BinFile} = + snmpc:compile(Test2File, [{outdir, Dir}, + {verbosity, silence}, + {group_check, false}]), + io:format("Test2BinFile: ~n~p~n", [Test2BinFile]), + ?line {ok, Test3BinFile} = + snmpc:compile(Test3File, [{i, [MibDir]}, + {outdir, Dir}, + {verbosity, silence}, + {group_check, true}]), + io:format("Test3BinFile: ~n~p~n", [Test3BinFile]), + {ok, Test3Mib} = snmp_misc:read_mib(Test3BinFile), + io:format("Test3Mib: ~n~p~n", [Test3Mib]), + %% There is only one table in this mib + #mib{table_infos = [{TableName, TI}]} = Test3Mib, + io:format("TableName: ~p" + "~n Table Info: ~p" + "~n", [TableName, TI]), + #table_info{nbr_of_cols = 4, + defvals = DefVals, + not_accessible = [2,4], + index_types = {augments, {tEntry, undefined}}, + first_accessible = 1} = TI, + io:format("Table info: ~p" + "~n DefVals: ~p" + "~n", [TableName, DefVals]), + ok. + + +%%====================================================================== %% Internal functions %%====================================================================== @@ -517,11 +584,11 @@ DESCRIPTION \"" ++ Desc ++ "\" ::= { test 1 } END", - Message = file:write_file(Filename ,Binary), + Message = file:write_file(Filename, Binary), case Message of ok -> ok; {error, Reason} -> - exit({failed_writing_mib,Reason}) + exit({failed_writing_mib, Reason}) end. @@ -546,8 +613,8 @@ check_desc(Desc1, Desc2) -> exit({'description not equal', Desc1, Desc2}). -join(Comp) -> - filename:join(Comp). +%% join(Comp) -> +%% filename:join(Comp). join(A,B) -> filename:join(A,B). diff --git a/lib/snmp/test/snmp_log_test.erl b/lib/snmp/test/snmp_log_test.erl index b692017407..8478825f59 100644 --- a/lib/snmp/test/snmp_log_test.erl +++ b/lib/snmp/test/snmp_log_test.erl @@ -42,7 +42,11 @@ -export([ init_per_testcase/2, end_per_testcase/2, - all/0,groups/0,init_per_group/2,end_per_group/2, + all/0, + groups/0, + init_per_group/2, + end_per_group/2, + open_and_close/1, open_write_and_close1/1, @@ -109,16 +113,21 @@ end_per_testcase(_Case, Config) when is_list(Config) -> %%====================================================================== %% ?SKIP(not_yet_implemented). all() -> -[open_and_close, {group, open_write_and_close}, - {group, log_to_io}, {group, log_to_txt}]. + [ + open_and_close, + {group, open_write_and_close}, + {group, log_to_io}, + {group, log_to_txt}]. groups() -> - [{open_write_and_close, [], - [open_write_and_close1, open_write_and_close2, - open_write_and_close3, open_write_and_close4]}, - {log_to_io, [], [log_to_io1, log_to_io2]}, - {log_to_txt, [], - [log_to_txt1, log_to_txt2, log_to_txt3]}]. + [ + {open_write_and_close, [], + [open_write_and_close1, open_write_and_close2, + open_write_and_close3, open_write_and_close4]}, + {log_to_io, [], [log_to_io1, log_to_io2]}, + {log_to_txt, [], + [log_to_txt1, log_to_txt2, log_to_txt3]} + ]. init_per_group(_GroupName, Config) -> Config. diff --git a/lib/snmp/test/snmp_manager_test.erl b/lib/snmp/test/snmp_manager_test.erl index 75c9f7b277..c374a2f0a6 100644 --- a/lib/snmp/test/snmp_manager_test.erl +++ b/lib/snmp/test/snmp_manager_test.erl @@ -49,6 +49,8 @@ init_per_group/2, end_per_group/2, init_per_testcase/2, end_per_testcase/2, + init_per_suite/1, end_per_suite/1, + simple_start_and_stop1/1, simple_start_and_stop2/1, @@ -146,36 +148,43 @@ %% External functions %%====================================================================== +init_per_suite(Config0) when is_list(Config0) -> + + ?DBG("init_per_suite -> entry with" + "~n Config0: ~p", [Config0]), + + Config1 = snmp_test_lib:init_suite_top_dir(?MODULE, Config0), + Config2 = snmp_test_lib:fix_data_dir(Config1), + + %% Mib-dirs + %% data_dir is trashed by the test-server / common-test + %% so there is no point in fixing it... + MibDir = snmp_test_lib:lookup(data_dir, Config2), + StdMibDir = filename:join([code:priv_dir(snmp), "mibs"]), + + [{mib_dir, MibDir}, {std_mib_dir, StdMibDir} | Config2]. + +end_per_suite(Config) when is_list(Config) -> + + ?DBG("end_per_suite -> entry with" + "~n Config: ~p", [Config]), + + Config. + + init_per_testcase(Case, Config) when is_list(Config) -> io:format(user, "~n~n*** INIT ~w:~w ***~n~n", [?MODULE,Case]), init_per_testcase2(Case, Config). init_per_testcase2(Case, Config) -> - ?DBG("init [~w] Nodes [1]: ~p", [Case, erlang:nodes()]), - - %% Fix a correct data dir (points to the wrong location): - DataDir0 = ?config(data_dir, Config), - DataDir1 = filename:split(filename:absname(DataDir0)), - [_|DataDir2] = lists:reverse(DataDir1), - DataDir = filename:join(lists:reverse(DataDir2) ++ [?snmp_test_data]), + ?DBG("init_per_testcase2 -> ~p", [erlang:nodes()]), - PrivDir = ?config(priv_dir, Config), + CaseTopDir = snmp_test_lib:init_testcase_top_dir(Case, Config), - TopDir = filename:join(PrivDir, ?MODULE), - case file:make_dir(TopDir) of - ok -> - ok; - {error, eexist} -> - ok; - Error -> - ?FAIL({failed_creating_subsuite_top_dir, Error}) - end, - - CaseTopDir = filename:join(TopDir, Case), - ?line ok = file:make_dir(CaseTopDir), - %% -- Manager dirs -- - MgrTopDir = filename:join(CaseTopDir, "manager/"), + MgrTopDir = filename:join(CaseTopDir, "manager/"), + ?DBG("init_per_testcase2 -> try create manager top dir: ~n~p", + [MgrTopDir]), ?line ok = file:make_dir(MgrTopDir), MgrConfDir = filename:join(MgrTopDir, "conf/"), @@ -200,10 +209,9 @@ init_per_testcase2(Case, Config) -> AgLogDir = filename:join(AgTopDir, "log/"), ?line ok = file:make_dir(AgLogDir), - Conf = [{snmp_data_dir, DataDir}, - {watchdog, ?WD_START(?MINS(5))}, + Conf = [{watchdog, ?WD_START(?MINS(5))}, {ip, ?LOCALHOST()}, - {top_dir, TopDir}, + {case_top_dir, CaseTopDir}, {agent_dir, AgTopDir}, {agent_conf_dir, AgConfDir}, {agent_db_dir, AgDbDir}, @@ -388,9 +396,11 @@ all() -> {group, user_tests}, {group, agent_tests}, {group, request_tests}, + {group, request_tests_mt}, {group, event_tests}, + {group, event_tests_mt}, discovery, - {group, tickets} + {group, tickets} ]. groups() -> @@ -431,6 +441,15 @@ groups() -> {group, misc_request_tests} ] }, + {request_tests_mt, [], + [ + {group, get_tests}, + {group, get_next_tests}, + {group, set_tests}, + {group, bulk_tests}, + {group, misc_request_tests} + ] + }, {get_tests, [], [ simple_sync_get1, @@ -477,18 +496,30 @@ groups() -> misc_async2 ] }, - {event_tests, [], - [ - trap1%% , - %% trap2, - %% inform1, - %% inform2, - %% inform3, - %% inform4, - %% inform_swarm, - %% report - ] - }, + {event_tests, [], + [ + trap1, + trap2, + inform1, + inform2, + inform3, + inform4, + inform_swarm, + report + ] + }, + {event_tests_mt, [], + [ + trap1, + trap2, + inform1, + inform2, + inform3, + inform4, + inform_swarm, + report + ] + }, {tickets, [], [ {group, otp8015}, @@ -507,11 +538,21 @@ groups() -> } ]. -init_per_group(_GroupName, Config) -> - Config. +init_per_group(request_tests_mt = GroupName, Config) -> + snmp_test_lib:init_group_top_dir( + GroupName, + [{manager_net_if_module, snmpm_net_if_mt} | Config]); +init_per_group(event_tests_mt = GroupName, Config) -> + snmp_test_lib:init_group_top_dir( + GroupName, + [{manager_net_if_module, snmpm_net_if_mt} | Config]); +init_per_group(GroupName, Config) -> + snmp_test_lib:init_group_top_dir(GroupName, Config). + end_per_group(_GroupName, Config) -> - Config. + %% Do we really need to do this? + lists:keydelete(snmp_group_top_dir, 1, Config). %%====================================================================== @@ -1571,6 +1612,11 @@ simple_sync_get1(Config) when is_list(Config) -> ?line ok = mgr_user_load_mib(Node, std_mib()), Oids2 = [[sysObjectID, 0], [sysDescr, 0], [sysUpTime, 0]], ?line ok = do_simple_sync_get(Node, Addr, Port, Oids2), + + p("Display log"), + display_log(Config), + + p("done"), ok. do_simple_sync_get(Node, Addr, Port, Oids) -> @@ -1578,7 +1624,7 @@ do_simple_sync_get(Node, Addr, Port, Oids) -> ?DBG("~n Reply: ~p" "~n Rem: ~w", [Reply, Rem]), - + %% verify that the operation actually worked: %% The order should be the same, so no need to seach ?line ok = case Reply of @@ -1612,7 +1658,9 @@ simple_sync_get2(suite) -> []; simple_sync_get2(Config) when is_list(Config) -> process_flag(trap_exit, true), put(tname, ssg2), - do_simple_sync_get2(Config). + do_simple_sync_get2(Config), + display_log(Config), + ok. do_simple_sync_get2(Config) -> Get = fun(Node, TargetName, Oids) -> @@ -1677,7 +1725,9 @@ simple_sync_get3(suite) -> []; simple_sync_get3(Config) when is_list(Config) -> process_flag(trap_exit, true), put(tname, ssg3), - do_simple_sync_get3(Config). + do_simple_sync_get3(Config), + display_log(Config), + ok. do_simple_sync_get3(Config) -> Self = self(), @@ -1703,8 +1753,8 @@ do_simple_sync_get3(Config) -> %%====================================================================== -simple_async_get1(doc) -> ["Simple (async) get-request - " - "Old style (Addr & Port)"]; +simple_async_get1(doc) -> + ["Simple (async) get-request - Old style (Addr & Port)"]; simple_async_get1(suite) -> []; simple_async_get1(Config) when is_list(Config) -> process_flag(trap_exit, true), @@ -1766,6 +1816,7 @@ simple_async_get1(Config) when is_list(Config) -> p("manager info when ending test: ~n~p", [mgr_info(MgrNode)]), p("agent info when ending test: ~n~p", [agent_info(AgentNode)]), + display_log(Config), ok. async_g_exec1(Node, Addr, Port, Oids) -> @@ -1816,7 +1867,9 @@ simple_async_get2(Config) when is_list(Config) -> TargetName = ?config(manager_agent_target_name, Config), Get = fun(Oids) -> async_g_exec2(MgrNode, TargetName, Oids) end, PostVerify = fun(Res) -> Res end, - do_simple_async_sync_get2(Config, MgrNode, AgentNode, Get, PostVerify). + do_simple_async_sync_get2(Config, MgrNode, AgentNode, Get, PostVerify), + display_log(Config), + ok. do_simple_async_sync_get2(Config, MgrNode, AgentNode, Get, PostVerify) -> ?line ok = mgr_user_load_mib(MgrNode, std_mib()), @@ -1905,7 +1958,9 @@ simple_async_get3(Config) when is_list(Config) -> PostVerify = fun(ok) -> receive Msg -> ok end; (Error) -> Error end, - do_simple_async_sync_get2(Config, MgrNode, AgentNode, Get, PostVerify). + do_simple_async_sync_get2(Config, MgrNode, AgentNode, Get, PostVerify), + display_log(Config), + ok. async_g_exec3(Node, TargetName, Oids, SendOpts) -> mgr_user_async_get2(Node, TargetName, Oids, SendOpts). @@ -1999,6 +2054,8 @@ simple_sync_get_next1(Config) when is_list(Config) -> end, ?line ok = do_simple_get_next(8, MgrNode, Addr, Port, Oids08, VF08), + + display_log(Config), ok. @@ -2062,7 +2119,10 @@ simple_sync_get_next2(Config) when is_list(Config) -> mgr_user_sync_get_next(Node, TargetName, Oids) end, PostVerify = fun(Res) -> Res end, - do_simple_sync_get_next2(Config, GetNext, PostVerify). + do_simple_sync_get_next2(Config, GetNext, PostVerify), + display_log(Config), + ok. + do_simple_sync_get_next2(Config, GetNext, PostVerify) when is_function(GetNext, 3) andalso is_function(PostVerify, 1) -> @@ -2193,7 +2253,9 @@ simple_sync_get_next3(Config) when is_list(Config) -> PostVerify = fun(ok) -> receive Msg -> ok end; (Error) -> Error end, - do_simple_sync_get_next2(Config, GetNext, PostVerify). + do_simple_sync_get_next2(Config, GetNext, PostVerify), + display_log(Config), + ok. %%====================================================================== @@ -2286,6 +2348,7 @@ simple_async_get_next1(Config) when is_list(Config) -> p("manager info when ending test: ~n~p", [mgr_info(MgrNode)]), p("agent info when ending test: ~n~p", [agent_info(AgentNode)]), + display_log(Config), ok. @@ -2315,7 +2378,9 @@ simple_async_get_next2(Config) when is_list(Config) -> async_gn_exec2(MgrNode, TargetName, Oids) end, PostVerify = fun(Res) -> Res end, - do_simple_async_get_next2(MgrNode, AgentNode, GetNext, PostVerify). + do_simple_async_get_next2(MgrNode, AgentNode, GetNext, PostVerify), + display_log(Config), + ok. do_simple_async_get_next2(MgrNode, AgentNode, GetNext, PostVerify) when is_function(GetNext, 1) andalso is_function(PostVerify, 1) -> @@ -2437,7 +2502,9 @@ simple_async_get_next3(Config) when is_list(Config) -> (Error) -> Error end, - do_simple_async_get_next2(MgrNode, AgentNode, GetNext, PostVerify). + do_simple_async_get_next2(MgrNode, AgentNode, GetNext, PostVerify), + display_log(Config), + ok. async_gn_exec3(Node, TargetName, Oids, SendOpts) -> mgr_user_async_get_next2(Node, TargetName, Oids, SendOpts). @@ -2475,6 +2542,8 @@ simple_sync_set1(Config) when is_list(Config) -> {[sysLocation, 0], Val22} ], ?line ok = do_simple_set1(Node, Addr, Port, VAVs2), + + display_log(Config), ok. do_simple_set1(Node, Addr, Port, VAVs) -> @@ -2527,7 +2596,9 @@ simple_sync_set2(Config) when is_list(Config) -> end, PostVerify = fun() -> ok end, - do_simple_sync_set2(Config, Set, PostVerify). + do_simple_sync_set2(Config, Set, PostVerify), + display_log(Config), + ok. do_simple_sync_set2(Config, Set, PostVerify) when is_function(Set, 3) andalso is_function(PostVerify, 0) -> @@ -2604,7 +2675,9 @@ simple_sync_set3(Config) when is_list(Config) -> end, PostVerify = fun() -> receive Msg -> ok end end, - do_simple_sync_set2(Config, Set, PostVerify). + do_simple_sync_set2(Config, Set, PostVerify), + display_log(Config), + ok. %%====================================================================== @@ -2663,6 +2736,7 @@ simple_async_set1(Config) when is_list(Config) -> p("manager info when ending test: ~n~p", [mgr_info(MgrNode)]), p("agent info when ending test: ~n~p", [agent_info(AgentNode)]), + display_log(Config), ok. @@ -2724,7 +2798,9 @@ simple_async_set2(Config) when is_list(Config) -> end, PostVerify = fun(Res) -> Res end, - do_simple_async_set2(MgrNode, AgentNode, Set, PostVerify). + do_simple_async_set2(MgrNode, AgentNode, Set, PostVerify), + display_log(Config), + ok. do_simple_async_set2(MgrNode, AgentNode, Set, PostVerify) -> Requests = @@ -2806,7 +2882,9 @@ simple_async_set3(Config) when is_list(Config) -> (Res) -> Res end, - do_simple_async_set2(MgrNode, AgentNode, Set, PostVerify). + do_simple_async_set2(MgrNode, AgentNode, Set, PostVerify), + display_log(Config), + ok. async_s_exec3(Node, TargetName, VAVs, SendOpts) -> mgr_user_async_set2(Node, TargetName, VAVs, SendOpts). @@ -2932,6 +3010,7 @@ simple_sync_get_bulk1(Config) when is_list(Config) -> 0, 2, [[TCnt2, 1]], VF11), + display_log(Config), ok. fl(L) -> @@ -3004,7 +3083,9 @@ simple_sync_get_bulk2(Config) when is_list(Config) -> end, PostVerify = fun(Res) -> Res end, - do_simple_sync_get_bulk2(Config, MgrNode, AgentNode, GetBulk, PostVerify). + do_simple_sync_get_bulk2(Config, MgrNode, AgentNode, GetBulk, PostVerify), + display_log(Config), + ok. do_simple_sync_get_bulk2(Config, MgrNode, AgentNode, GetBulk, PostVerify) -> %% -- 1 -- @@ -3169,7 +3250,9 @@ simple_sync_get_bulk3(Config) when is_list(Config) -> (Res) -> Res end, - do_simple_sync_get_bulk2(Config, MgrNode, AgentNode, GetBulk, PostVerify). + do_simple_sync_get_bulk2(Config, MgrNode, AgentNode, GetBulk, PostVerify), + display_log(Config), + ok. %%====================================================================== @@ -3308,6 +3391,7 @@ simple_async_get_bulk1(Config) when is_list(Config) -> p("manager info when ending test: ~n~p", [mgr_info(MgrNode)]), p("agent info when ending test: ~n~p", [agent_info(AgentNode)]), + display_log(Config), ok. @@ -3340,7 +3424,9 @@ simple_async_get_bulk2(Config) when is_list(Config) -> end, PostVerify = fun(Res) -> Res end, - do_simple_async_get_bulk2(MgrNode, AgentNode, GetBulk, PostVerify). + do_simple_async_get_bulk2(MgrNode, AgentNode, GetBulk, PostVerify), + display_log(Config), + ok. do_simple_async_get_bulk2(MgrNode, AgentNode, GetBulk, PostVerify) -> %% We re-use the verification functions from the ssgb test-case @@ -3505,7 +3591,9 @@ simple_async_get_bulk3(Config) when is_list(Config) -> (Res) -> Res end, - do_simple_async_get_bulk2(MgrNode, AgentNode, GetBulk, PostVerify). + do_simple_async_get_bulk2(MgrNode, AgentNode, GetBulk, PostVerify), + display_log(Config), + ok. async_gb_exec3(Node, TargetName, {NR, MR, Oids}, SendOpts) -> mgr_user_async_get_bulk2(Node, TargetName, NR, MR, Oids, SendOpts). @@ -3697,6 +3785,7 @@ misc_async1(Config) when is_list(Config) -> p("manager info when ending test: ~n~p", [mgr_info(MgrNode)]), p("agent info when ending test: ~n~p", [agent_info(AgentNode)]), + display_log(Config), ok. @@ -3885,6 +3974,7 @@ misc_async2(Config) when is_list(Config) -> p("manager info when ending test: ~n~p", [mgr_info(MgrNode)]), p("agent info when ending test: ~n~p", [agent_info(AgentNode)]), + display_log(Config), ok. @@ -4099,7 +4189,9 @@ trap1(Config) when is_list(Config) -> {5, "Manager and agent info after test completion", Cmd1} ], - command_handler(Commands). + command_handler(Commands), + display_log(Config), + ok. %%====================================================================== @@ -4290,7 +4382,9 @@ trap2(Config) when is_list(Config) -> {7, "Manager and agent info after test completion", Cmd1} ], - command_handler(Commands). + command_handler(Commands), + display_log(Config), + ok. %%====================================================================== @@ -4415,7 +4509,9 @@ inform1(Config) when is_list(Config) -> {6, "Manager and agent info after test completion", Cmd1} ], - command_handler(Commands). + command_handler(Commands), + display_log(Config), + ok. %%====================================================================== @@ -4423,7 +4519,7 @@ inform1(Config) when is_list(Config) -> inform2(suite) -> []; inform2(Config) when is_list(Config) -> process_flag(trap_exit, true), - put(tname,i2), + put(tname, i2), p("starting with Config: ~p~n", [Config]), MgrNode = ?config(manager_node, Config), @@ -4577,7 +4673,7 @@ inform2(Config) when is_list(Config) -> [ {1, "Manager and agent info at start of test", Cmd1}, {2, "Send notifcation [no receiver] from agent", Cmd2}, - {3, "await inform-sent acknowledge from agent", Cmd3}, + {3, "Await inform-sent acknowledge from agent", Cmd3}, {4, "Await first inform to manager - do not reply", Cmd4}, {5, "Await second inform to manager - reply", Cmd5}, {6, "await inform-acknowledge from agent", Cmd6}, @@ -4585,7 +4681,9 @@ inform2(Config) when is_list(Config) -> {8, "Manager and agent info after test completion", Cmd1} ], - command_handler(Commands). + command_handler(Commands), + display_log(Config), + ok. %%====================================================================== @@ -4719,7 +4817,9 @@ inform3(Config) when is_list(Config) -> {9, "Manager and agent info after test completion", Cmd1} ], - command_handler(Commands). + command_handler(Commands), + display_log(Config), + ok. %%====================================================================== @@ -4835,7 +4935,9 @@ inform4(Config) when is_list(Config) -> {6, "Manager and agent info after test completion", Cmd1} ], - command_handler(Commands). + command_handler(Commands), + display_log(Config), + ok. %%====================================================================== @@ -4923,7 +5025,10 @@ inform_swarm(Config) when is_list(Config) -> {5, "Manager and agent info after test completion", Cmd1} ], - command_handler(Commands). + command_handler(Commands), + display_log(Config), + ok. + inform_swarm_collector(N) -> inform_swarm_collector(N, 0, 0, 0, 10000). @@ -5227,8 +5332,8 @@ init_agent(Config) -> %% -- %% Retrieve some dir's %% - Dir = ?config(top_dir, Config), - DataDir = ?config(data_dir, Config), + Dir = ?config(agent_dir, Config), + MibDir = ?config(mib_dir, Config), %% -- %% Start node @@ -5259,7 +5364,7 @@ init_agent(Config) -> ?line ok = write_agent_config(Vsns, Config), Conf = [{agent_node, Node}, - {mib_dir, DataDir} | Config], + {mib_dir, MibDir} | Config], %% %% Start the agent @@ -5720,6 +5825,15 @@ start_manager(Node, Vsns, Conf0, Opts) -> AtlSeqNo = get_opt(manager_atl_seqno, Conf0, false), + NetIfConf = + case get_opt(manager_net_if_module, Conf0, no_module) of + no_module -> + [{verbosity, NetIfVerbosity}]; + NetIfModule -> + [{module, NetIfModule}, + {verbosity, NetIfVerbosity}] + end, + Env = [{versions, Vsns}, {inform_request_behaviour, IRB}, {audit_trail_log, [{type, read_write}, @@ -5732,7 +5846,7 @@ start_manager(Node, Vsns, Conf0, Opts) -> {verbosity, ConfigVerbosity}]}, {note_store, [{verbosity, NoteStoreVerbosity}]}, {server, [{verbosity, ServerVerbosity}]}, - {net_if, [{verbosity, NetIfVerbosity}]}], + {net_if, NetIfConf}], ?line ok = set_mgr_env(Node, Env), ?line ok = start_snmp(Node), @@ -6018,6 +6132,38 @@ write_conf_file(Dir, File, Str) -> %% ------ +display_log(Config) -> + case lists:keysearch(manager_log_dir, 1, Config) of + {value, {_, Dir}} -> + case lists:keysearch(manager_node, 1, Config) of + {value, {_, Node}} -> + LogDir = Dir, + Mibs = [], + OutFile = j(LogDir, "snmpm_log.txt"), + p("~n" + "=========================" + " < Audit Trail Log > " + "=========================" + "~n"), + rcall(Node, snmpm, log_to_txt, [LogDir, Mibs, OutFile]), + rcall(Node, snmpm, log_to_io, [LogDir, Mibs]), + p("~n" + "=========================" + " < / Audit Trail Log > " + "=========================" + "~n"); + false -> + p("display_log -> no manager node found"), + ok + end; + false -> + p("display_log -> no manager log dir found"), + ok + end. + + +%% ------ + test2_mib(Config) -> j(test_mib_dir(Config), "Test2.bin"). @@ -6034,7 +6180,7 @@ snmpv2_mib() -> j(mib_dir(), "SNMPv2-MIB.bin"). test_mib_dir(Config) -> - ?config(snmp_data_dir, Config). + ?config(mib_dir, Config). mib_dir() -> j(code:priv_dir(snmp), "mibs"). diff --git a/lib/snmp/test/snmp_test_data/Test3.mib b/lib/snmp/test/snmp_test_data/Test3.mib new file mode 100644 index 0000000000..7f76e4dba4 --- /dev/null +++ b/lib/snmp/test/snmp_test_data/Test3.mib @@ -0,0 +1,123 @@ +Test3 DEFINITIONS ::= BEGIN + +IMPORTS + MODULE-IDENTITY, OBJECT-TYPE, Integer32, snmpModules, mib-2 + FROM SNMPv2-SMI + MODULE-COMPLIANCE, OBJECT-GROUP + FROM SNMPv2-CONF + tEntry + FROM Test2; + +t3MIB MODULE-IDENTITY + LAST-UPDATED "1203090000Z" + ORGANIZATION "" + CONTACT-INFO + "" + DESCRIPTION + "Test mib, used to test processing of requests." + ::= { snmpModules 42 } + + +-- Administrative assignments **************************************** + +t3MIBObjects OBJECT IDENTIFIER ::= { t3MIB 1 } +t3MIBConformance OBJECT IDENTIFIER ::= { t3MIB 2 } + + +-- test4 OBJECT IDENTIFIER ::= { mib-2 18 } + +tAugTable OBJECT-TYPE + SYNTAX SEQUENCE OF TAugEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "This table AUGMENTS tTable of the Test2 MIB." + ::= { t3MIBObjects 1 } + +tAugEntry OBJECT-TYPE + SYNTAX TAugEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "An entry (conceptual row) in the sysORTable." + AUGMENTS { tEntry } + ::= { tAugTable 1 } + +TAugEntry ::= SEQUENCE { + tFoo1 OCTET STRING, + tFoo2 OCTET STRING, + tBar1 Integer32, + tBar2 Integer32 +} + +tFoo1 OBJECT-TYPE + SYNTAX OCTET STRING (SIZE (0..255)) + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "A string." + DEFVAL { "foo 1" } + ::= { tAugEntry 1 } + +tFoo2 OBJECT-TYPE + SYNTAX OCTET STRING (SIZE (0..255)) + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A string." + DEFVAL { "foo 2" } + ::= { tAugEntry 2 } + +tBar1 OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "An integer." + DEFVAL { 42 } + ::= { tAugEntry 3 } + +tBar2 OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "An integer." + DEFVAL { 42 } + ::= { tAugEntry 4 } + + +-- Conformance Information ******************************************* + +t3MIBCompliances OBJECT IDENTIFIER + ::= { t3MIBConformance 1 } +t3MIBGroups OBJECT IDENTIFIER + ::= { t3MIBConformance 2 } + +-- Compliance statements + +t3MIBCompliance MODULE-COMPLIANCE + STATUS current + DESCRIPTION + "The compliance statement for SNMP engines which + implement the SNMP-COMMUNITY-MIB." + + MODULE -- this module + MANDATORY-GROUPS { t3Group } + + ::= { t3MIBCompliances 1 } + +t3Group OBJECT-GROUP + OBJECTS { + tFoo1, + tFoo2, + tBar1, + tBar2 + } + STATUS current + DESCRIPTION + "A group." + ::= { t3MIBGroups 1 } + + +END diff --git a/lib/snmp/test/snmp_test_lib.erl b/lib/snmp/test/snmp_test_lib.erl index e4d58a1253..26115a0c74 100644 --- a/lib/snmp/test/snmp_test_lib.erl +++ b/lib/snmp/test/snmp_test_lib.erl @@ -25,7 +25,10 @@ -export([hostname/0, hostname/1, localhost/0, os_type/0, sz/1, display_suite_info/1]). -export([non_pc_tc_maybe_skip/4, os_based_skip/1]). --export([replace_config/3, set_config/3, get_config/2, get_config/3]). +-export([fix_data_dir/1, + init_suite_top_dir/2, init_group_top_dir/2, init_testcase_top_dir/2, + lookup/2, + replace_config/3, set_config/3, get_config/2, get_config/3]). -export([fail/3, skip/3]). -export([millis/0, millis_diff/2, hours/1, minutes/1, seconds/1, sleep/1]). -export([flush_mqueue/0, trap_exit/0, trap_exit/1]). @@ -198,6 +201,97 @@ os_based_skip(_Crap) -> %% Test suite utility functions %% +fix_data_dir(Config) -> + DataDir0 = lookup(data_dir, Config), + DataDir1 = filename:split(filename:absname(DataDir0)), + [_|DataDir2] = lists:reverse(DataDir1), + DataDir = filename:join(lists:reverse(DataDir2) ++ [?snmp_test_data]), + Config1 = lists:keydelete(data_dir, 1, Config), + [{data_dir, DataDir ++ "/"} | Config1]. + + +init_suite_top_dir(Suite, Config0) -> + io:format("~w:init_suite_top_dir -> entry with" + "~n Suite: ~p" + "~n Config0: ~p" + "~n", [?MODULE, Suite, Config0]), + Dir = lookup(priv_dir, Config0), + SuiteTopDir = filename:join(Dir, Suite), + case file:make_dir(SuiteTopDir) of + ok -> + ok; + {error, eexist} -> + ok; + {error, Reason} -> + fail({failed_creating_suite_top_dir, SuiteTopDir, Reason}, + ?MODULE, ?LINE) + end, + + %% This is just in case... + Config1 = lists:keydelete(snmp_group_top_dir, 1, Config0), + Config2 = lists:keydelete(snmp_suite_top_dir, 1, Config1), + [{snmp_suite_top_dir, SuiteTopDir} | Config2]. + + +init_group_top_dir(GroupName, Config) -> + io:format("~w:init_group_top_dir -> entry with" + "~n GroupName: ~p" + "~n Config: ~p" + "~n", [?MODULE, GroupName, Config]), + case lists:keysearch(snmp_group_top_dir, 1, Config) of + {value, {_Key, Dir}} -> + %% This is a sub-group, so create our dir within Dir + GroupTopDir = filename:join(Dir, GroupName), + case file:make_dir(GroupTopDir) of + ok -> + ok; + {error, Reason} -> + fail({failed_creating_group_top_dir, GroupTopDir, Reason}, + ?MODULE, ?LINE) + end, + [{snmp_group_top_dir, GroupTopDir} | Config]; + + _ -> + case lists:keysearch(snmp_suite_top_dir, 1, Config) of + {value, {_Key, Dir}} -> + GroupTopDir = filename:join(Dir, GroupName), + case file:make_dir(GroupTopDir) of + ok -> + ok; + {error, Reason} -> + fail({failed_creating_group_top_dir, + GroupTopDir, Reason}, + ?MODULE, ?LINE) + end, + [{snmp_group_top_dir, GroupTopDir} | Config]; + _ -> + fail(could_not_find_suite_top_dir, ?MODULE, ?LINE) + end + end. + + +init_testcase_top_dir(Case, Config) -> + io:format("~w:init_testcase_top_dir -> entry with" + "~n Case: ~p" + "~n Config: ~p" + "~n", [?MODULE, Case, Config]), + case lists:keysearch(snmp_group_top_dir, 1, Config) of + {value, {_Key, Dir}} -> + CaseTopDir = filename:join(Dir, Case), + ok = file:make_dir(CaseTopDir), + CaseTopDir; + false -> + case lists:keysearch(snmp_suite_top_dir, 1, Config) of + {value, {_Key, Dir}} -> + CaseTopDir = filename:join(Dir, Case), + ok = file:make_dir(CaseTopDir), + CaseTopDir; + false -> + fail(failed_creating_case_top_dir, ?MODULE, ?LINE) + end + end. + + replace_config(Key, Config, NewValue) -> lists:keyreplace(Key, 1, Config, {Key, NewValue}). @@ -220,6 +314,9 @@ get_config(Key,C,Default) -> Default end. +lookup(Key, Config) -> + {value, {Key, Value}} = lists:keysearch(Key, 1, Config), + Value. fail(Reason, Mod, Line) -> exit({suite_failed, Reason, Mod, Line}). diff --git a/lib/snmp/test/test-mibs/RMON-MIB.mib b/lib/snmp/test/test-mibs/RMON-MIB.mib index 0824dbde1d..fa5bc82f4a 100644 --- a/lib/snmp/test/test-mibs/RMON-MIB.mib +++ b/lib/snmp/test/test-mibs/RMON-MIB.mib @@ -1,3826 +1,3958 @@ - RMON-MIB DEFINITIONS ::= BEGIN - - IMPORTS - Counter FROM RFC1155-SMI - mib-2,DisplayString FROM RFC1213-MIB - OBJECT-TYPE FROM RFC-1212 - TRAP-TYPE FROM RFC-1215; - - -- Remote Network Monitoring MIB - - rmon OBJECT IDENTIFIER ::= { mib-2 16 } - - - -- textual conventions - - OwnerString ::= DisplayString - -- This data type is used to model an administratively - -- assigned name of the owner of a resource. This - -- information is taken from the NVT ASCII character - -- set. It is suggested that this name contain one or - - - -- more of the following: IP address, management station - -- name, network manager's name, location, or phone - -- number. - -- In some cases the agent itself will be the owner of - -- an entry. In these cases, this string shall be set - -- to a string starting with 'monitor'. - -- - -- SNMP access control is articulated entirely in terms - -- of the contents of MIB views; access to a particular - -- SNMP object instance depends only upon its presence - -- or absence in a particular MIB view and never upon - -- its value or the value of related object instances. - -- Thus, objects of this type afford resolution of - -- resource contention only among cooperating managers; - -- they realize no access control function with respect - -- to uncooperative parties. - -- - -- By convention, objects with this syntax are declared as - -- having - -- - -- SIZE (0..127) - - EntryStatus ::= INTEGER - { valid(1), - createRequest(2), - underCreation(3), - invalid(4) - } - -- The status of a table entry. - -- - -- Setting this object to the value invalid(4) has the - -- effect of invalidating the corresponding entry. - -- That is, it effectively disassociates the mapping - -- identified with said entry. - -- It is an implementation-specific matter as to whether - -- the agent removes an invalidated entry from the table. - -- Accordingly, management stations must be prepared to - -- receive tabular information from agents that - -- corresponds to entries currently not in use. Proper - -- interpretation of such entries requires examination - -- of the relevant EntryStatus object. - -- - -- An existing instance of this object cannot be set to - -- createRequest(2). This object may only be set to - -- createRequest(2) when this instance is created. When - -- this object is created, the agent may wish to create - -- supplemental object instances with default values - -- to complete a conceptual row in this table. Because - - - -- the creation of these default objects is entirely at - -- the option of the agent, the manager must not assume - -- that any will be created, but may make use of any that - -- are created. Immediately after completing the create - -- operation, the agent must set this object to - -- underCreation(3). - -- - -- When in the underCreation(3) state, an entry is - -- allowed to exist in a possibly incomplete, possibly - -- inconsistent state, usually to allow it to be - -- modified in mutiple PDUs. When in this state, an - -- entry is not fully active. Entries shall exist in - -- the underCreation(3) state until the management - -- station is finished configuring the entry and sets - -- this object to valid(1) or aborts, setting this - -- object to invalid(4). If the agent determines that - -- an entry has been in the underCreation(3) state for - -- an abnormally long time, it may decide that the - -- management station has crashed. If the agent makes - -- this decision, it may set this object to invalid(4) - -- to reclaim the entry. A prudent agent will - -- understand that the management station may need to - -- wait for human input and will allow for that - -- possibility in its determination of this abnormally - -- long period. - -- - -- An entry in the valid(1) state is fully configured and - -- consistent and fully represents the configuration or - -- operation such a row is intended to represent. For - -- example, it could be a statistical function that is - -- configured and active, or a filter that is available - -- in the list of filters processed by the packet capture - -- process. - -- - -- A manager is restricted to changing the state of an - -- entry in the following ways: - -- - -- create under - -- To: valid Request Creation invalid - -- From: - -- valid OK NO OK OK - -- createRequest N/A N/A N/A N/A - -- underCreation OK NO OK OK - -- invalid NO NO NO OK - -- nonExistent NO OK NO OK - -- - -- In the table above, it is not applicable to move the - -- state from the createRequest state to any other - - - -- state because the manager will never find the - -- variable in that state. The nonExistent state is - -- not a value of the enumeration, rather it means that - -- the entryStatus variable does not exist at all. - -- - -- An agent may allow an entryStatus variable to change - -- state in additional ways, so long as the semantics - -- of the states are followed. This allowance is made - -- to ease the implementation of the agent and is made - -- despite the fact that managers should never - -- excercise these additional state transitions. - - - statistics OBJECT IDENTIFIER ::= { rmon 1 } - history OBJECT IDENTIFIER ::= { rmon 2 } - alarm OBJECT IDENTIFIER ::= { rmon 3 } - hosts OBJECT IDENTIFIER ::= { rmon 4 } - hostTopN OBJECT IDENTIFIER ::= { rmon 5 } - matrix OBJECT IDENTIFIER ::= { rmon 6 } - filter OBJECT IDENTIFIER ::= { rmon 7 } - capture OBJECT IDENTIFIER ::= { rmon 8 } - event OBJECT IDENTIFIER ::= { rmon 9 } - - - -- The Ethernet Statistics Group - -- - -- Implementation of the Ethernet Statistics group is - -- optional. - -- - -- The ethernet statistics group contains statistics - -- measured by the probe for each monitored interface on - -- this device. These statistics take the form of free - -- running counters that start from zero when a valid entry - -- is created. - -- - -- This group currently has statistics defined only for - -- Ethernet interfaces. Each etherStatsEntry contains - -- statistics for one Ethernet interface. The probe must - -- create one etherStats entry for each monitored Ethernet - -- interface on the device. - - etherStatsTable OBJECT-TYPE - SYNTAX SEQUENCE OF EtherStatsEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "A list of Ethernet statistics entries." - ::= { statistics 1 } - - - etherStatsEntry OBJECT-TYPE - SYNTAX EtherStatsEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "A collection of statistics kept for a particular - Ethernet interface. As an example, an instance of the - etherStatsPkts object might be named etherStatsPkts.1" - INDEX { etherStatsIndex } - ::= { etherStatsTable 1 } - - EtherStatsEntry ::= SEQUENCE { - etherStatsIndex INTEGER (1..65535), - etherStatsDataSource OBJECT IDENTIFIER, - etherStatsDropEvents Counter, - etherStatsOctets Counter, - etherStatsPkts Counter, - etherStatsBroadcastPkts Counter, - etherStatsMulticastPkts Counter, - etherStatsCRCAlignErrors Counter, - etherStatsUndersizePkts Counter, - etherStatsOversizePkts Counter, - etherStatsFragments Counter, - etherStatsJabbers Counter, - etherStatsCollisions Counter, - etherStatsPkts64Octets Counter, - etherStatsPkts65to127Octets Counter, - etherStatsPkts128to255Octets Counter, - etherStatsPkts256to511Octets Counter, - etherStatsPkts512to1023Octets Counter, - etherStatsPkts1024to1518Octets Counter, - etherStatsOwner OwnerString, - etherStatsStatus EntryStatus - } - - etherStatsIndex OBJECT-TYPE - SYNTAX INTEGER (1..65535) - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The value of this object uniquely identifies this - etherStats entry." - ::= { etherStatsEntry 1 } - - etherStatsDataSource OBJECT-TYPE - SYNTAX OBJECT IDENTIFIER - ACCESS read-write - STATUS mandatory - - - DESCRIPTION - "This object identifies the source of the data that - this etherStats entry is configured to analyze. This - source can be any ethernet interface on this device. - In order to identify a particular interface, this - object shall identify the instance of the ifIndex - object, defined in RFC 1213 and RFC 1573 [4,6], for - the desired interface. For example, if an entry - were to receive data from interface #1, this object - would be set to ifIndex.1. - - The statistics in this group reflect all packets - on the local network segment attached to the - identified interface. - - An agent may or may not be able to tell if - fundamental changes to the media of the interface - have occurred and necessitate an invalidation of - this entry. For example, a hot-pluggable ethernet - card could be pulled out and replaced by a - token-ring card. In such a case, if the agent has - such knowledge of the change, it is recommended that - it invalidate this entry. - - This object may not be modified if the associated - etherStatsStatus object is equal to valid(1)." - ::= { etherStatsEntry 2 } - - etherStatsDropEvents OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The total number of events in which packets - were dropped by the probe due to lack of resources. - Note that this number is not necessarily the number of - packets dropped; it is just the number of times this - condition has been detected." - ::= { etherStatsEntry 3 } - - etherStatsOctets OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The total number of octets of data (including - those in bad packets) received on the - network (excluding framing bits but including - - - FCS octets). - - This object can be used as a reasonable estimate of - ethernet utilization. If greater precision is - desired, the etherStatsPkts and etherStatsOctets - objects should be sampled before and after a common - interval. The differences in the sampled values are - Pkts and Octets, respectively, and the number of - seconds in the interval is Interval. These values - are used to calculate the Utilization as follows: - - Pkts * (9.6 + 6.4) + (Octets * .8) - Utilization = ------------------------------------- - Interval * 10,000 - - The result of this equation is the value Utilization - which is the percent utilization of the ethernet - segment on a scale of 0 to 100 percent." - ::= { etherStatsEntry 4 } - - etherStatsPkts OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The total number of packets (including bad packets, - broadcast packets, and multicast packets) received." - ::= { etherStatsEntry 5 } - - etherStatsBroadcastPkts OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The total number of good packets received that were - directed to the broadcast address. Note that this - does not include multicast packets." - ::= { etherStatsEntry 6 } - - etherStatsMulticastPkts OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The total number of good packets received that were - directed to a multicast address. Note that this - number does not include packets directed to the - broadcast address." - - - ::= { etherStatsEntry 7 } - - etherStatsCRCAlignErrors OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The total number of packets received that - had a length (excluding framing bits, but - including FCS octets) of between 64 and 1518 - octets, inclusive, but but had either a bad - Frame Check Sequence (FCS) with an integral - number of octets (FCS Error) or a bad FCS with - a non-integral number of octets (Alignment Error)." - ::= { etherStatsEntry 8 } - - etherStatsUndersizePkts OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The total number of packets received that were - less than 64 octets long (excluding framing bits, - but including FCS octets) and were otherwise well - formed." - ::= { etherStatsEntry 9 } - - etherStatsOversizePkts OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The total number of packets received that were - longer than 1518 octets (excluding framing bits, - but including FCS octets) and were otherwise - well formed." - ::= { etherStatsEntry 10 } - - etherStatsFragments OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The total number of packets received that were less - than 64 octets in length (excluding framing bits but - including FCS octets) and had either a bad Frame - Check Sequence (FCS) with an integral number of - octets (FCS Error) or a bad FCS with a non-integral - - - number of octets (Alignment Error). - - Note that it is entirely normal for - etherStatsFragments to increment. This is because - it counts both runts (which are normal occurrences - due to collisions) and noise hits." - ::= { etherStatsEntry 11 } - - etherStatsJabbers OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The total number of packets received that were - longer than 1518 octets (excluding framing bits, - but including FCS octets), and had either a bad - Frame Check Sequence (FCS) with an integral number - of octets (FCS Error) or a bad FCS with a - non-integral number of octets (Alignment Error). - - Note that this definition of jabber is different - than the definition in IEEE-802.3 section 8.2.1.5 - (10BASE5) and section 10.3.1.4 (10BASE2). These - documents define jabber as the condition where any - packet exceeds 20 ms. The allowed range to detect - jabber is between 20 ms and 150 ms." - ::= { etherStatsEntry 12 } - - etherStatsCollisions OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The best estimate of the total number of collisions - on this Ethernet segment. - - The value returned will depend on the location of - the RMON probe. Section 8.2.1.3 (10BASE-5) and - section 10.3.1.3 (10BASE-2) of IEEE standard 802.3 - states that a station must detect a collision, in - the receive mode, if three or more stations are - transmitting simultaneously. A repeater port must - detect a collision when two or more stations are - transmitting simultaneously. Thus a probe placed on - a repeater port could record more collisions than a - probe connected to a station on the same segment - would. - - - - Probe location plays a much smaller role when - considering 10BASE-T. 14.2.1.4 (10BASE-T) of IEEE - standard 802.3 defines a collision as the - simultaneous presence of signals on the DO and RD - circuits (transmitting and receiving at the same - time). A 10BASE-T station can only detect - collisions when it is transmitting. Thus probes - placed on a station and a repeater, should report - the same number of collisions. - - Note also that an RMON probe inside a repeater - should ideally report collisions between the - repeater and one or more other hosts (transmit - collisions as defined by IEEE 802.3k) plus receiver - collisions observed on any coax segments to which - the repeater is connected." - ::= { etherStatsEntry 13 } - - etherStatsPkts64Octets OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The total number of packets (including bad - packets) received that were 64 octets in length - (excluding framing bits but including FCS octets)." - ::= { etherStatsEntry 14 } - - etherStatsPkts65to127Octets OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The total number of packets (including bad - packets) received that were between - 65 and 127 octets in length inclusive - (excluding framing bits but including FCS octets)." - ::= { etherStatsEntry 15 } - - etherStatsPkts128to255Octets OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The total number of packets (including bad - packets) received that were between - 128 and 255 octets in length inclusive - (excluding framing bits but including FCS octets)." - - - ::= { etherStatsEntry 16 } - - etherStatsPkts256to511Octets OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The total number of packets (including bad - packets) received that were between - 256 and 511 octets in length inclusive - (excluding framing bits but including FCS octets)." - ::= { etherStatsEntry 17 } - - etherStatsPkts512to1023Octets OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The total number of packets (including bad - packets) received that were between - 512 and 1023 octets in length inclusive - (excluding framing bits but including FCS octets)." - ::= { etherStatsEntry 18 } - - etherStatsPkts1024to1518Octets OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The total number of packets (including bad - packets) received that were between - 1024 and 1518 octets in length inclusive - (excluding framing bits but including FCS octets)." - ::= { etherStatsEntry 19 } - - etherStatsOwner OBJECT-TYPE - SYNTAX OwnerString - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The entity that configured this entry and is - therefore using the resources assigned to it." - ::= { etherStatsEntry 20 } - - etherStatsStatus OBJECT-TYPE - SYNTAX EntryStatus - ACCESS read-write - STATUS mandatory - - - DESCRIPTION - "The status of this etherStats entry." - ::= { etherStatsEntry 21 } - - - -- The History Control Group - - -- Implementation of the History Control group is optional. - -- - -- The history control group controls the periodic statistical - -- sampling of data from various types of networks. The - -- historyControlTable stores configuration entries that each - -- define an interface, polling period, and other parameters. - -- Once samples are taken, their data is stored in an entry - -- in a media-specific table. Each such entry defines one - -- sample, and is associated with the historyControlEntry that - -- caused the sample to be taken. Each counter in the - -- etherHistoryEntry counts the same event as its - -- similarly-named counterpart in the etherStatsEntry, - -- except that each value here is a cumulative sum during a - -- sampling period. - -- - -- If the probe keeps track of the time of day, it should - -- start the first sample of the history at a time such that - -- when the next hour of the day begins, a sample is - -- started at that instant. This tends to make more - -- user-friendly reports, and enables comparison of reports - -- from different probes that have relatively accurate time - -- of day. - -- - -- The probe is encouraged to add two history control entries - -- per monitored interface upon initialization that describe - -- a short term and a long term polling period. Suggested - -- parameters are 30 seconds for the short term polling period - -- and 30 minutes for the long term period. - - historyControlTable OBJECT-TYPE - SYNTAX SEQUENCE OF HistoryControlEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "A list of history control entries." - ::= { history 1 } - - historyControlEntry OBJECT-TYPE - SYNTAX HistoryControlEntry - ACCESS not-accessible - STATUS mandatory - - - DESCRIPTION - "A list of parameters that set up a periodic sampling - of statistics. As an example, an instance of the - historyControlInterval object might be named - historyControlInterval.2" - INDEX { historyControlIndex } - ::= { historyControlTable 1 } - - HistoryControlEntry ::= SEQUENCE { - historyControlIndex INTEGER (1..65535), - historyControlDataSource OBJECT IDENTIFIER, - historyControlBucketsRequested INTEGER (1..65535), - historyControlBucketsGranted INTEGER (1..65535), - historyControlInterval INTEGER (1..3600), - historyControlOwner OwnerString, - historyControlStatus EntryStatus - } - - historyControlIndex OBJECT-TYPE - SYNTAX INTEGER (1..65535) - ACCESS read-only - STATUS mandatory - DESCRIPTION - "An index that uniquely identifies an entry in the - historyControl table. Each such entry defines a - set of samples at a particular interval for an - interface on the device." - ::= { historyControlEntry 1 } - - historyControlDataSource OBJECT-TYPE - SYNTAX OBJECT IDENTIFIER - ACCESS read-write - STATUS mandatory - DESCRIPTION - "This object identifies the source of the data for - which historical data was collected and - placed in a media-specific table on behalf of this - historyControlEntry. This source can be any - interface on this device. In order to identify - a particular interface, this object shall identify - the instance of the ifIndex object, defined - in RFC 1213 and RFC 1573 [4,6], for the desired - interface. For example, if an entry were to receive - data from interface #1, this object would be set - to ifIndex.1. - - The statistics in this group reflect all packets - on the local network segment attached to the - - - identified interface. - - An agent may or may not be able to tell if fundamental - changes to the media of the interface have occurred - and necessitate an invalidation of this entry. For - example, a hot-pluggable ethernet card could be - pulled out and replaced by a token-ring card. In - such a case, if the agent has such knowledge of the - change, it is recommended that it invalidate this - entry. - - This object may not be modified if the associated - historyControlStatus object is equal to valid(1)." - ::= { historyControlEntry 2 } - - historyControlBucketsRequested OBJECT-TYPE - SYNTAX INTEGER (1..65535) - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The requested number of discrete time intervals - over which data is to be saved in the part of the - media-specific table associated with this - historyControlEntry. - - When this object is created or modified, the probe - should set historyControlBucketsGranted as closely to - this object as is possible for the particular probe - implementation and available resources." - DEFVAL { 50 } - ::= { historyControlEntry 3 } - - historyControlBucketsGranted OBJECT-TYPE - SYNTAX INTEGER (1..65535) - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of discrete sampling intervals - over which data shall be saved in the part of - the media-specific table associated with this - historyControlEntry. - - When the associated historyControlBucketsRequested - object is created or modified, the probe - should set this object as closely to the requested - value as is possible for the particular - probe implementation and available resources. The - probe must not lower this value except as a result - - - of a modification to the associated - historyControlBucketsRequested object. - - There will be times when the actual number of - buckets associated with this entry is less than - the value of this object. In this case, at the - end of each sampling interval, a new bucket will - be added to the media-specific table. - - When the number of buckets reaches the value of - this object and a new bucket is to be added to the - media-specific table, the oldest bucket associated - with this historyControlEntry shall be deleted by - the agent so that the new bucket can be added. - - When the value of this object changes to a value less - than the current value, entries are deleted - from the media-specific table associated with this - historyControlEntry. Enough of the oldest of these - entries shall be deleted by the agent so that their - number remains less than or equal to the new value of - this object. - - When the value of this object changes to a value - greater than the current value, the number of - associated media- specific entries may be allowed to - grow." - ::= { historyControlEntry 4 } - - historyControlInterval OBJECT-TYPE - SYNTAX INTEGER (1..3600) - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The interval in seconds over which the data is - sampled for each bucket in the part of the - media-specific table associated with this - historyControlEntry. This interval can - be set to any number of seconds between 1 and - 3600 (1 hour). - - Because the counters in a bucket may overflow at their - maximum value with no indication, a prudent manager - will take into account the possibility of overflow - in any of the associated counters. It is important - to consider the minimum time in which any counter - could overflow on a particular media type and set - the historyControlInterval object to a value less - - - than this interval. This is typically most - important for the 'octets' counter in any - media-specific table. For example, on an Ethernet - network, the etherHistoryOctets counter could - overflow in about one hour at the Ethernet's maximum - utilization. - - This object may not be modified if the associated - historyControlStatus object is equal to valid(1)." - DEFVAL { 1800 } - ::= { historyControlEntry 5 } - - historyControlOwner OBJECT-TYPE - SYNTAX OwnerString - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The entity that configured this entry and is - therefore using the resources assigned to it." - ::= { historyControlEntry 6 } - - historyControlStatus OBJECT-TYPE - SYNTAX EntryStatus - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The status of this historyControl entry. - - Each instance of the media-specific table associated - with this historyControlEntry will be deleted by the - agent if this historyControlEntry is not equal to - valid(1)." - ::= { historyControlEntry 7 } - - - -- The Ethernet History Group - - -- Implementation of the Ethernet History group is optional. - -- - -- The Ethernet History group records periodic - -- statistical samples from a network and stores them - -- for later retrieval. Once samples are taken, their - -- data is stored in an entry in a media-specific - -- table. Each such entry defines one sample, and is - -- associated with the historyControlEntry that caused - -- the sample to be taken. This group defines the - -- etherHistoryTable, for Ethernet networks. - -- - - - etherHistoryTable OBJECT-TYPE - SYNTAX SEQUENCE OF EtherHistoryEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "A list of Ethernet history entries." - ::= { history 2 } - - etherHistoryEntry OBJECT-TYPE - SYNTAX EtherHistoryEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "An historical sample of Ethernet statistics on a - particular Ethernet interface. This sample is - associated with the historyControlEntry which set up - the parameters for a regular collection of these - samples. As an example, an instance of the - etherHistoryPkts object might be named - etherHistoryPkts.2.89" - INDEX { etherHistoryIndex , etherHistorySampleIndex } - ::= { etherHistoryTable 1 } - - EtherHistoryEntry ::= SEQUENCE { - etherHistoryIndex INTEGER (1..65535), - etherHistorySampleIndex INTEGER (1..2147483647), - etherHistoryIntervalStart TimeTicks, - etherHistoryDropEvents Counter, - etherHistoryOctets Counter, - etherHistoryPkts Counter, - etherHistoryBroadcastPkts Counter, - etherHistoryMulticastPkts Counter, - etherHistoryCRCAlignErrors Counter, - etherHistoryUndersizePkts Counter, - etherHistoryOversizePkts Counter, - etherHistoryFragments Counter, - etherHistoryJabbers Counter, - etherHistoryCollisions Counter, - etherHistoryUtilization INTEGER (0..10000) - } - - etherHistoryIndex OBJECT-TYPE - SYNTAX INTEGER (1..65535) - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The history of which this entry is a part. The - history identified by a particular value of this - - - index is the same history as identified - by the same value of historyControlIndex." - ::= { etherHistoryEntry 1 } - - etherHistorySampleIndex OBJECT-TYPE - SYNTAX INTEGER (1..2147483647) - ACCESS read-only - STATUS mandatory - DESCRIPTION - "An index that uniquely identifies the particular - sample this entry represents among all samples - associated with the same historyControlEntry. - This index starts at 1 and increases by one - as each new sample is taken." - ::= { etherHistoryEntry 2 } - - etherHistoryIntervalStart OBJECT-TYPE - SYNTAX TimeTicks - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The value of sysUpTime at the start of the interval - over which this sample was measured. If the probe - keeps track of the time of day, it should start - the first sample of the history at a time such that - when the next hour of the day begins, a sample is - started at that instant. Note that following this - rule may require the probe to delay collecting the - first sample of the history, as each sample must be - of the same interval. Also note that the sample which - is currently being collected is not accessible in this - table until the end of its interval." - ::= { etherHistoryEntry 3 } - - etherHistoryDropEvents OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The total number of events in which packets - were dropped by the probe due to lack of resources - during this sampling interval. Note that this number - is not necessarily the number of packets dropped, it - is just the number of times this condition has been - detected." - ::= { etherHistoryEntry 4 } - - etherHistoryOctets OBJECT-TYPE - - - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The total number of octets of data (including - those in bad packets) received on the - network (excluding framing bits but including - FCS octets)." - ::= { etherHistoryEntry 5 } - - etherHistoryPkts OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of packets (including bad packets) - received during this sampling interval." - ::= { etherHistoryEntry 6 } - - etherHistoryBroadcastPkts OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of good packets received during this - sampling interval that were directed to the - broadcast address." - ::= { etherHistoryEntry 7 } - - etherHistoryMulticastPkts OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of good packets received during this - sampling interval that were directed to a - multicast address. Note that this number does not - include packets addressed to the broadcast address." - ::= { etherHistoryEntry 8 } - - etherHistoryCRCAlignErrors OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of packets received during this sampling - interval that had a length (excluding framing bits - but including FCS octets) between 64 and 1518 - - - octets, inclusive, but had either a bad Frame Check - Sequence (FCS) with an integral number of octets - (FCS Error) or a bad FCS with a non-integral number - of octets (Alignment Error)." - ::= { etherHistoryEntry 9 } - - etherHistoryUndersizePkts OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of packets received during this - sampling interval that were less than 64 octets - long (excluding framing bits but including FCS - octets) and were otherwise well formed." - ::= { etherHistoryEntry 10 } - - etherHistoryOversizePkts OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of packets received during this - sampling interval that were longer than 1518 - octets (excluding framing bits but including - FCS octets) but were otherwise well formed." - ::= { etherHistoryEntry 11 } - - etherHistoryFragments OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The total number of packets received during this - sampling interval that were less than 64 octets in - length (excluding framing bits but including FCS - octets) had either a bad Frame Check Sequence (FCS) - with an integral number of octets (FCS Error) or a bad - FCS with a non-integral number of octets (Alignment - Error). - - Note that it is entirely normal for - etherHistoryFragments to increment. This is because - it counts both runts (which are normal occurrences - due to collisions) and noise hits." - ::= { etherHistoryEntry 12 } - - etherHistoryJabbers OBJECT-TYPE - - - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of packets received during this - sampling interval that were longer than 1518 octets - (excluding framing bits but including FCS octets), - and had either a bad Frame Check Sequence (FCS) - with an integral number of octets (FCS Error) or - a bad FCS with a non-integral number of octets - (Alignment Error). - - Note that this definition of jabber is different - than the definition in IEEE-802.3 section 8.2.1.5 - (10BASE5) and section 10.3.1.4 (10BASE2). These - documents define jabber as the condition where any - packet exceeds 20 ms. The allowed range to detect - jabber is between 20 ms and 150 ms." - ::= { etherHistoryEntry 13 } - - etherHistoryCollisions OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The best estimate of the total number of collisions - on this Ethernet segment during this sampling - interval. - - The value returned will depend on the location of - the RMON probe. Section 8.2.1.3 (10BASE-5) and - section 10.3.1.3 (10BASE-2) of IEEE standard 802.3 - states that a station must detect a collision, in - the receive mode, if three or more stations are - transmitting simultaneously. A repeater port must - detect a collision when two or more stations are - transmitting simultaneously. Thus a probe placed on - a repeater port could record more collisions than a - probe connected to a station on the same segment - would. - - Probe location plays a much smaller role when - considering 10BASE-T. 14.2.1.4 (10BASE-T) of IEEE - standard 802.3 defines a collision as the - simultaneous presence of signals on the DO and RD - circuits (transmitting and receiving at the same - time). A 10BASE-T station can only detect - collisions when it is transmitting. Thus probes - - - placed on a station and a repeater, should report - the same number of collisions. - - Note also that an RMON probe inside a repeater - should ideally report collisions between the - repeater and one or more other hosts (transmit - collisions as defined by IEEE 802.3k) plus receiver - collisions observed on any coax segments to which - the repeater is connected." - ::= { etherHistoryEntry 14 } - - etherHistoryUtilization OBJECT-TYPE - SYNTAX INTEGER (0..10000) - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The best estimate of the mean physical layer - network utilization on this interface during this - sampling interval, in hundredths of a percent." - ::= { etherHistoryEntry 15 } - - - -- The Alarm Group - - -- Implementation of the Alarm group is optional. - -- - -- The Alarm Group requires the implementation of the Event - -- group. - -- - -- The Alarm group periodically takes - -- statistical samples from variables in the probe and - -- compares them to thresholds that have been - -- configured. The alarm table stores configuration - -- entries that each define a variable, polling period, - -- and threshold parameters. If a sample is found to - -- cross the threshold values, an event is generated. - -- Only variables that resolve to an ASN.1 primitive - -- type of INTEGER (INTEGER, Counter, Gauge, or - -- TimeTicks) may be monitored in this way. - -- - -- This function has a hysteresis mechanism to limit - -- the generation of events. This mechanism generates - -- one event as a threshold is crossed in the - -- appropriate direction. No more events are generated - -- for that threshold until the opposite threshold is - -- crossed. - -- - -- In the case of a sampling a deltaValue, a probe may - - - -- implement this mechanism with more precision if it - -- takes a delta sample twice per period, each time - -- comparing the sum of the latest two samples to the - -- threshold. This allows the detection of threshold - -- crossings that span the sampling boundary. Note - -- that this does not require any special configuration - -- of the threshold value. It is suggested that probes - -- implement this more precise algorithm. - - alarmTable OBJECT-TYPE - SYNTAX SEQUENCE OF AlarmEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "A list of alarm entries." - ::= { alarm 1 } - - alarmEntry OBJECT-TYPE - SYNTAX AlarmEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "A list of parameters that set up a periodic checking - for alarm conditions. For example, an instance of the - alarmValue object might be named alarmValue.8" - INDEX { alarmIndex } - ::= { alarmTable 1 } - - AlarmEntry ::= SEQUENCE { - alarmIndex INTEGER (1..65535), - alarmInterval INTEGER, - alarmVariable OBJECT IDENTIFIER, - alarmSampleType INTEGER, - alarmValue INTEGER, - alarmStartupAlarm INTEGER, - alarmRisingThreshold INTEGER, - alarmFallingThreshold INTEGER, - alarmRisingEventIndex INTEGER (0..65535), - alarmFallingEventIndex INTEGER (0..65535), - alarmOwner OwnerString, - alarmStatus EntryStatus - } - - alarmIndex OBJECT-TYPE - SYNTAX INTEGER (1..65535) - ACCESS read-only - STATUS mandatory - DESCRIPTION - - - "An index that uniquely identifies an entry in the - alarm table. Each such entry defines a - diagnostic sample at a particular interval - for an object on the device." - ::= { alarmEntry 1 } - - alarmInterval OBJECT-TYPE - SYNTAX INTEGER - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The interval in seconds over which the data is - sampled and compared with the rising and falling - thresholds. When setting this variable, care - should be taken in the case of deltaValue - sampling - the interval should be set short enough - that the sampled variable is very unlikely to - increase or decrease by more than 2^31 - 1 during - a single sampling interval. - - This object may not be modified if the associated - alarmStatus object is equal to valid(1)." - ::= { alarmEntry 2 } - - alarmVariable OBJECT-TYPE - SYNTAX OBJECT IDENTIFIER - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The object identifier of the particular variable to - be sampled. Only variables that resolve to an ASN.1 - primitive type of INTEGER (INTEGER, Counter, Gauge, - or TimeTicks) may be sampled. - - Because SNMP access control is articulated entirely - in terms of the contents of MIB views, no access - control mechanism exists that can restrict the value - of this object to identify only those objects that - exist in a particular MIB view. Because there is - thus no acceptable means of restricting the read - access that could be obtained through the alarm - mechanism, the probe must only grant write access to - this object in those views that have read access to - all objects on the probe. - - During a set operation, if the supplied variable - name is not available in the selected MIB view, a - badValue error must be returned. If at any time the - - - variable name of an established alarmEntry is no - longer available in the selected MIB view, the probe - must change the status of this alarmEntry to - invalid(4). - - This object may not be modified if the associated - alarmStatus object is equal to valid(1)." - ::= { alarmEntry 3 } - - alarmSampleType OBJECT-TYPE - SYNTAX INTEGER { - absoluteValue(1), - deltaValue(2) - } - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The method of sampling the selected variable and - calculating the value to be compared against the - thresholds. If the value of this object is - absoluteValue(1), the value of the selected variable - will be compared directly with the thresholds at the - end of the sampling interval. If the value of this - object is deltaValue(2), the value of the selected - variable at the last sample will be subtracted from - the current value, and the difference compared with - the thresholds. - - This object may not be modified if the associated - alarmStatus object is equal to valid(1)." - ::= { alarmEntry 4 } - - alarmValue OBJECT-TYPE - SYNTAX INTEGER - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The value of the statistic during the last sampling - period. For example, if the sample type is - deltaValue, this value will be the difference - between the samples at the beginning and end of the - period. If the sample type is absoluteValue, this - value will be the sampled value at the end of the - period. - - This is the value that is compared with the rising and - falling thresholds. - - - - The value during the current sampling period is not - made available until the period is completed and will - remain available until the next period completes." - ::= { alarmEntry 5 } - - alarmStartupAlarm OBJECT-TYPE - SYNTAX INTEGER { - risingAlarm(1), - fallingAlarm(2), - risingOrFallingAlarm(3) - } - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The alarm that may be sent when this entry is first - set to valid. If the first sample after this entry - becomes valid is greater than or equal to the - risingThreshold and alarmStartupAlarm is equal to - risingAlarm(1) or risingOrFallingAlarm(3), then a - single rising alarm will be generated. If the first - sample after this entry becomes valid is less than - or equal to the fallingThreshold and - alarmStartupAlarm is equal to fallingAlarm(2) or - risingOrFallingAlarm(3), then a single falling alarm - will be generated. - - This object may not be modified if the associated - alarmStatus object is equal to valid(1)." - ::= { alarmEntry 6 } - - alarmRisingThreshold OBJECT-TYPE - SYNTAX INTEGER - ACCESS read-write - STATUS mandatory - DESCRIPTION - "A threshold for the sampled statistic. When the - current sampled value is greater than or equal to - this threshold, and the value at the last sampling - interval was less than this threshold, a single - event will be generated. A single event will also - be generated if the first sample after this entry - becomes valid is greater than or equal to this - threshold and the associated alarmStartupAlarm is - equal to risingAlarm(1) or risingOrFallingAlarm(3). - - After a rising event is generated, another such event - will not be generated until the sampled value - falls below this threshold and reaches the - - - alarmFallingThreshold. - - This object may not be modified if the associated - alarmStatus object is equal to valid(1)." - ::= { alarmEntry 7 } - - alarmFallingThreshold OBJECT-TYPE - SYNTAX INTEGER - ACCESS read-write - STATUS mandatory - DESCRIPTION - "A threshold for the sampled statistic. When the - current sampled value is less than or equal to this - threshold, and the value at the last sampling - interval was greater than this threshold, a single - event will be generated. A single event will also - be generated if the first sample after this entry - becomes valid is less than or equal to this - threshold and the associated alarmStartupAlarm is - equal to fallingAlarm(2) or risingOrFallingAlarm(3). - - After a falling event is generated, another such event - will not be generated until the sampled value - rises above this threshold and reaches the - alarmRisingThreshold. - - This object may not be modified if the associated - alarmStatus object is equal to valid(1)." - ::= { alarmEntry 8 } - - alarmRisingEventIndex OBJECT-TYPE - SYNTAX INTEGER (0..65535) - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The index of the eventEntry that is - used when a rising threshold is crossed. The - eventEntry identified by a particular value of - this index is the same as identified by the same value - of the eventIndex object. If there is no - corresponding entry in the eventTable, then - no association exists. In particular, if this value - is zero, no associated event will be generated, as - zero is not a valid event index. - - This object may not be modified if the associated - alarmStatus object is equal to valid(1)." - ::= { alarmEntry 9 } - - - alarmFallingEventIndex OBJECT-TYPE - SYNTAX INTEGER (0..65535) - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The index of the eventEntry that is - used when a falling threshold is crossed. The - eventEntry identified by a particular value of - this index is the same as identified by the same value - of the eventIndex object. If there is no - corresponding entry in the eventTable, then - no association exists. In particular, if this value - is zero, no associated event will be generated, as - zero is not a valid event index. - - This object may not be modified if the associated - alarmStatus object is equal to valid(1)." - ::= { alarmEntry 10 } - - alarmOwner OBJECT-TYPE - SYNTAX OwnerString - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The entity that configured this entry and is - therefore using the resources assigned to it." - ::= { alarmEntry 11 } - - alarmStatus OBJECT-TYPE - SYNTAX EntryStatus - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The status of this alarm entry." - ::= { alarmEntry 12 } - - - -- The Host Group - - -- Implementation of the Host group is optional. - -- - -- The host group discovers new hosts on the network by - -- keeping a list of source and destination MAC Addresses seen - -- in good packets. For each of these addresses, the host - -- group keeps a set of statistics. The hostControlTable - -- controls which interfaces this function is performed on, - -- and contains some information about the process. On - -- behalf of each hostControlEntry, data is collected on an - - - -- interface and placed in both the hostTable and the - -- hostTimeTable. If the monitoring device finds itself - -- short of resources, it may delete entries as needed. It - -- is suggested that the device delete the least recently - -- used entries first. - - -- The hostTable contains entries for each address - -- discovered on a particular interface. Each entry - -- contains statistical data about that host. This table is - -- indexed by the MAC address of the host, through which a - -- random access may be achieved. - - -- The hostTimeTable contains data in the same format as the - -- hostTable, and must contain the same set of hosts, but is - -- indexed using hostTimeCreationOrder rather than - -- hostAddress. - -- The hostTimeCreationOrder is an integer which reflects - -- the relative order in which a particular entry was - -- discovered and thus inserted into the table. As this - -- order, and thus the index, is among those entries - -- currently in the table, the index for a particular entry - -- may change if an (earlier) entry is deleted. Thus the - -- association between hostTimeCreationOrder and - -- hostTimeEntry may be broken at any time. - - -- The hostTimeTable has two important uses. The first is the - -- fast download of this potentially large table. Because the - -- index of this table runs from 1 to the size of the table, - -- inclusive, its values are predictable. This allows very - -- efficient packing of variables into SNMP PDU's and allows - -- a table transfer to have multiple packets outstanding. - -- These benefits increase transfer rates tremendously. - - -- The second use of the hostTimeTable is the efficient - -- discovery by the management station of new entries added - -- to the table. After the management station has downloaded - -- the entire table, it knows that new entries will be added - -- immediately after the end of the current table. It can - -- thus detect new entries there and retrieve them easily. - - -- Because the association between hostTimeCreationOrder and - -- hostTimeEntry may be broken at any time, the management - -- station must monitor the related hostControlLastDeleteTime - -- object. When the management station thus detects a - -- deletion, it must assume that any such associations have - --- been broken, and invalidate any it has stored locally. - -- This includes restarting any download of the - -- hostTimeTable that may have been in progress, as well as - - - -- rediscovering the end of the hostTimeTable so that it may - -- detect new entries. If the management station does not - -- detect the broken association, it may continue to refer - -- to a particular host by its creationOrder while - -- unwittingly retrieving the data associated with another - -- host entirely. If this happens while downloading the - -- host table, the management station may fail to download - -- all of the entries in the table. - - hostControlTable OBJECT-TYPE - SYNTAX SEQUENCE OF HostControlEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "A list of host table control entries." - ::= { hosts 1 } - - hostControlEntry OBJECT-TYPE - SYNTAX HostControlEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "A list of parameters that set up the discovery of - hosts on a particular interface and the collection - of statistics about these hosts. For example, an - instance of the hostControlTableSize object might be - named hostControlTableSize.1" - INDEX { hostControlIndex } - ::= { hostControlTable 1 } - - HostControlEntry ::= SEQUENCE { - hostControlIndex INTEGER (1..65535), - hostControlDataSource OBJECT IDENTIFIER, - hostControlTableSize INTEGER, - hostControlLastDeleteTime TimeTicks, - hostControlOwner OwnerString, - hostControlStatus EntryStatus - } - - hostControlIndex OBJECT-TYPE - SYNTAX INTEGER (1..65535) - ACCESS read-only - STATUS mandatory - DESCRIPTION - "An index that uniquely identifies an entry in the - hostControl table. Each such entry defines - a function that discovers hosts on a particular - interface and places statistics about them in the - - - hostTable and the hostTimeTable on behalf of this - hostControlEntry." - ::= { hostControlEntry 1 } - - hostControlDataSource OBJECT-TYPE - SYNTAX OBJECT IDENTIFIER - ACCESS read-write - STATUS mandatory - DESCRIPTION - "This object identifies the source of the data for - this instance of the host function. This source - can be any interface on this device. In order - to identify a particular interface, this object shall - identify the instance of the ifIndex object, defined - in RFC 1213 and RFC 1573 [4,6], for the desired - interface. For example, if an entry were to receive - data from interface #1, this object would be set to - ifIndex.1. - - The statistics in this group reflect all packets - on the local network segment attached to the - identified interface. - - An agent may or may not be able to tell if - fundamental changes to the media of the interface - have occurred and necessitate an invalidation of - this entry. For example, a hot-pluggable ethernet - card could be pulled out and replaced by a - token-ring card. In such a case, if the agent has - such knowledge of the change, it is recommended that - it invalidate this entry. - - This object may not be modified if the associated - hostControlStatus object is equal to valid(1)." - ::= { hostControlEntry 2 } - - hostControlTableSize OBJECT-TYPE - SYNTAX INTEGER - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of hostEntries in the hostTable and the - hostTimeTable associated with this hostControlEntry." - ::= { hostControlEntry 3 } - - hostControlLastDeleteTime OBJECT-TYPE - SYNTAX TimeTicks - ACCESS read-only - - - STATUS mandatory - DESCRIPTION - "The value of sysUpTime when the last entry - was deleted from the portion of the hostTable - associated with this hostControlEntry. If no - deletions have occurred, this value shall be zero." - ::= { hostControlEntry 4 } - - hostControlOwner OBJECT-TYPE - SYNTAX OwnerString - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The entity that configured this entry and is - therefore using the resources assigned to it." - ::= { hostControlEntry 5 } - - hostControlStatus OBJECT-TYPE - SYNTAX EntryStatus - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The status of this hostControl entry. - - If this object is not equal to valid(1), all - associated entries in the hostTable, hostTimeTable, - and the hostTopNTable shall be deleted by the - agent." - ::= { hostControlEntry 6 } - - hostTable OBJECT-TYPE - SYNTAX SEQUENCE OF HostEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "A list of host entries." - ::= { hosts 2 } - - hostEntry OBJECT-TYPE - SYNTAX HostEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "A collection of statistics for a particular host - that has been discovered on an interface of this - device. For example, an instance of the - hostOutBroadcastPkts object might be named - hostOutBroadcastPkts.1.6.8.0.32.27.3.176" - - - INDEX { hostIndex, hostAddress } - ::= { hostTable 1 } - - HostEntry ::= SEQUENCE { - hostAddress OCTET STRING, - hostCreationOrder INTEGER (1..65535), - hostIndex INTEGER (1..65535), - hostInPkts Counter, - hostOutPkts Counter, - hostInOctets Counter, - hostOutOctets Counter, - hostOutErrors Counter, - hostOutBroadcastPkts Counter, - hostOutMulticastPkts Counter - } - - hostAddress OBJECT-TYPE - SYNTAX OCTET STRING - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The physical address of this host." - ::= { hostEntry 1 } - - hostCreationOrder OBJECT-TYPE - SYNTAX INTEGER (1..65535) - ACCESS read-only - STATUS mandatory - DESCRIPTION - "An index that defines the relative ordering of - the creation time of hosts captured for a - particular hostControlEntry. This index shall - be between 1 and N, where N is the value of - the associated hostControlTableSize. The ordering - of the indexes is based on the order of each entry's - insertion into the table, in which entries added - earlier have a lower index value than entries added - later. - - It is important to note that the order for a - particular entry may change as an (earlier) entry - is deleted from the table. Because this order may - change, management stations should make use of the - hostControlLastDeleteTime variable in the - hostControlEntry associated with the relevant - portion of the hostTable. By observing - this variable, the management station may detect - the circumstances where a previous association - - - between a value of hostCreationOrder - and a hostEntry may no longer hold." - ::= { hostEntry 2 } - - hostIndex OBJECT-TYPE - SYNTAX INTEGER (1..65535) - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The set of collected host statistics of which - this entry is a part. The set of hosts - identified by a particular value of this - index is associated with the hostControlEntry - as identified by the same value of hostControlIndex." - ::= { hostEntry 3 } - - hostInPkts OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of good packets transmitted to this - address since it was added to the hostTable." - ::= { hostEntry 4 } - - hostOutPkts OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of packets, including bad packets, - transmitted by this address since it was added - to the hostTable." - ::= { hostEntry 5 } - - hostInOctets OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of octets transmitted to this address - since it was added to the hostTable (excluding - framing bits but including FCS octets), except for - those octets in bad packets." - ::= { hostEntry 6 } - - hostOutOctets OBJECT-TYPE - SYNTAX Counter - - - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of octets transmitted by this address - since it was added to the hostTable (excluding - framing bits but including FCS octets), including - those octets in bad packets." - ::= { hostEntry 7 } - - hostOutErrors OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of bad packets transmitted by this address - since this host was added to the hostTable." - ::= { hostEntry 8 } - - hostOutBroadcastPkts OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of good packets transmitted by this - address that were directed to the broadcast address - since this host was added to the hostTable." - ::= { hostEntry 9 } - - hostOutMulticastPkts OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of good packets transmitted by this - address that were directed to a multicast address - since this host was added to the hostTable. - Note that this number does not include packets - directed to the broadcast address." - ::= { hostEntry 10 } - - -- host Time Table - - hostTimeTable OBJECT-TYPE - SYNTAX SEQUENCE OF HostTimeEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "A list of time-ordered host table entries." - - - ::= { hosts 3 } - - hostTimeEntry OBJECT-TYPE - SYNTAX HostTimeEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "A collection of statistics for a particular host - that has been discovered on an interface of this - device. This collection includes the relative - ordering of the creation time of this object. For - example, an instance of the hostTimeOutBroadcastPkts - object might be named - hostTimeOutBroadcastPkts.1.687" - INDEX { hostTimeIndex, hostTimeCreationOrder } - ::= { hostTimeTable 1 } - - HostTimeEntry ::= SEQUENCE { - hostTimeAddress OCTET STRING, - hostTimeCreationOrder INTEGER (1..65535), - hostTimeIndex INTEGER (1..65535), - hostTimeInPkts Counter, - hostTimeOutPkts Counter, - hostTimeInOctets Counter, - hostTimeOutOctets Counter, - hostTimeOutErrors Counter, - hostTimeOutBroadcastPkts Counter, - hostTimeOutMulticastPkts Counter - } - - hostTimeAddress OBJECT-TYPE - SYNTAX OCTET STRING - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The physical address of this host." - ::= { hostTimeEntry 1 } - - hostTimeCreationOrder OBJECT-TYPE - SYNTAX INTEGER (1..65535) - ACCESS read-only - STATUS mandatory - DESCRIPTION - "An index that uniquely identifies an entry in - the hostTime table among those entries associated - with the same hostControlEntry. This index shall - be between 1 and N, where N is the value of - the associated hostControlTableSize. The ordering - - - of the indexes is based on the order of each entry's - insertion into the table, in which entries added - earlier have a lower index value than entries added - later. Thus the management station has the ability to - learn of new entries added to this table without - downloading the entire table. - - It is important to note that the index for a - particular entry may change as an (earlier) entry - is deleted from the table. Because this order may - change, management stations should make use of the - hostControlLastDeleteTime variable in the - hostControlEntry associated with the relevant - portion of the hostTimeTable. By observing - this variable, the management station may detect - the circumstances where a download of the table - may have missed entries, and where a previous - association between a value of hostTimeCreationOrder - and a hostTimeEntry may no longer hold." - ::= { hostTimeEntry 2 } - - hostTimeIndex OBJECT-TYPE - SYNTAX INTEGER (1..65535) - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The set of collected host statistics of which - this entry is a part. The set of hosts - identified by a particular value of this - index is associated with the hostControlEntry - as identified by the same value of hostControlIndex." - ::= { hostTimeEntry 3 } - - hostTimeInPkts OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of good packets transmitted to this - address since it was added to the hostTimeTable." - ::= { hostTimeEntry 4 } - - hostTimeOutPkts OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of god packets transmitted by this - - - address since it was added to the hostTimeTable." - ::= { hostTimeEntry 5 } - - hostTimeInOctets OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of octets transmitted to this address - since it was added to the hostTimeTable (excluding - framing bits but including FCS octets), except for - those octets in bad packets." - ::= { hostTimeEntry 6 } - - hostTimeOutOctets OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of octets transmitted by this address - since it was added to the hostTimeTable (excluding - framing bits but including FCS octets), including - those octets in bad packets." - ::= { hostTimeEntry 7 } - - hostTimeOutErrors OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of bad packets transmitted by this address - since this host was added to the hostTimeTable." - ::= { hostTimeEntry 8 } - - hostTimeOutBroadcastPkts OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of good packets transmitted by this - address that were directed to the broadcast address - since this host was added to the hostTimeTable." - ::= { hostTimeEntry 9 } - - hostTimeOutMulticastPkts OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - - - DESCRIPTION - "The number of good packets transmitted by this - address that were directed to a multicast address - since this host was added to the hostTimeTable. - Note that this number does not include packets - directed to the broadcast address." - ::= { hostTimeEntry 10 } - - - -- The Host Top "N" Group - - -- Implementation of the Host Top N group is optional. - -- - -- The Host Top N group requires the implementation of the - -- host group. - -- - -- The Host Top N group is used to prepare reports that - -- describe the hosts that top a list ordered by one of - -- their statistics. - -- The available statistics are samples of one of their - -- base statistics, over an interval specified by the - -- management station. Thus, these statistics are rate - -- based. The management station also selects how many such - -- hosts are reported. - - -- The hostTopNControlTable is used to initiate the - -- generation of such a report. The management station - -- may select the parameters of such a report, such as - -- which interface, which statistic, how many hosts, - -- and the start and stop times of the sampling. When - -- the report is prepared, entries are created in the - -- hostTopNTable associated with the relevant - -- hostTopNControlEntry. These entries are static for - -- each report after it has been prepared. - - hostTopNControlTable OBJECT-TYPE - SYNTAX SEQUENCE OF HostTopNControlEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "A list of top N host control entries." - ::= { hostTopN 1 } - - hostTopNControlEntry OBJECT-TYPE - SYNTAX HostTopNControlEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - - - "A set of parameters that control the creation of a - report of the top N hosts according to several - metrics. For example, an instance of the - hostTopNDuration object might be named - hostTopNDuration.3" - INDEX { hostTopNControlIndex } - ::= { hostTopNControlTable 1 } - - HostTopNControlEntry ::= SEQUENCE { - hostTopNControlIndex INTEGER (1..65535), - hostTopNHostIndex INTEGER (1..65535), - hostTopNRateBase INTEGER, - hostTopNTimeRemaining INTEGER, - hostTopNDuration INTEGER, - hostTopNRequestedSize INTEGER, - hostTopNGrantedSize INTEGER, - hostTopNStartTime TimeTicks, - hostTopNOwner OwnerString, - hostTopNStatus EntryStatus - } - - hostTopNControlIndex OBJECT-TYPE - SYNTAX INTEGER (1..65535) - ACCESS read-only - STATUS mandatory - DESCRIPTION - "An index that uniquely identifies an entry - in the hostTopNControl table. Each such - entry defines one top N report prepared for - one interface." - ::= { hostTopNControlEntry 1 } - - hostTopNHostIndex OBJECT-TYPE - SYNTAX INTEGER (1..65535) - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The host table for which a top N report will be - prepared on behalf of this entry. The host table - identified by a particular value of this index is - associated with the same host table as identified by - the same value of hostIndex. - - This object may not be modified if the associated - hostTopNStatus object is equal to valid(1)." - ::= { hostTopNControlEntry 2 } - - hostTopNRateBase OBJECT-TYPE - - - SYNTAX INTEGER { - hostTopNInPkts(1), - hostTopNOutPkts(2), - hostTopNInOctets(3), - hostTopNOutOctets(4), - hostTopNOutErrors(5), - hostTopNOutBroadcastPkts(6), - hostTopNOutMulticastPkts(7) - } - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The variable for each host that the hostTopNRate - variable is based upon. - - This object may not be modified if the associated - hostTopNStatus object is equal to valid(1)." - ::= { hostTopNControlEntry 3 } - - hostTopNTimeRemaining OBJECT-TYPE - SYNTAX INTEGER - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The number of seconds left in the report currently - being collected. When this object is modified by - the management station, a new collection is started, - possibly aborting a currently running report. The - new value is used as the requested duration of this - report, which is loaded into the associated - hostTopNDuration object. - - When this object is set to a non-zero value, any - associated hostTopNEntries shall be made - inaccessible by the monitor. While the value of - this object is non-zero, it decrements by one per - second until it reaches zero. During this time, all - associated hostTopNEntries shall remain - inaccessible. At the time that this object - decrements to zero, the report is made accessible in - the hostTopNTable. Thus, the hostTopN table needs - to be created only at the end of the collection - interval." - DEFVAL { 0 } - ::= { hostTopNControlEntry 4 } - - hostTopNDuration OBJECT-TYPE - SYNTAX INTEGER - - - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of seconds that this report has collected - during the last sampling interval, or if this - report is currently being collected, the number - of seconds that this report is being collected - during this sampling interval. - - When the associated hostTopNTimeRemaining object is - set, this object shall be set by the probe to the - same value and shall not be modified until the next - time the hostTopNTimeRemaining is set. - - This value shall be zero if no reports have been - requested for this hostTopNControlEntry." - DEFVAL { 0 } - ::= { hostTopNControlEntry 5 } - - hostTopNRequestedSize OBJECT-TYPE - SYNTAX INTEGER - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The maximum number of hosts requested for the top N - table. - - When this object is created or modified, the probe - should set hostTopNGrantedSize as closely to this - object as is possible for the particular probe - implementation and available resources." - DEFVAL { 10 } - ::= { hostTopNControlEntry 6 } - - hostTopNGrantedSize OBJECT-TYPE - SYNTAX INTEGER - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The maximum number of hosts in the top N table. - - When the associated hostTopNRequestedSize object is - created or modified, the probe should set this - object as closely to the requested value as is - possible for the particular implementation and - available resources. The probe must not lower this - value except as a result of a set to the associated - hostTopNRequestedSize object. - - - Hosts with the highest value of hostTopNRate shall be - placed in this table in decreasing order of this rate - until there is no more room or until there are no more - hosts." - ::= { hostTopNControlEntry 7 } - - hostTopNStartTime OBJECT-TYPE - SYNTAX TimeTicks - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The value of sysUpTime when this top N report was - last started. In other words, this is the time that - the associated hostTopNTimeRemaining object was - modified to start the requested report." - ::= { hostTopNControlEntry 8 } - - hostTopNOwner OBJECT-TYPE - SYNTAX OwnerString - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The entity that configured this entry and is - therefore using the resources assigned to it." - ::= { hostTopNControlEntry 9 } - - hostTopNStatus OBJECT-TYPE - SYNTAX EntryStatus - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The status of this hostTopNControl entry. - - If this object is not equal to valid(1), all - associated hostTopNEntries shall be deleted by the - agent." - ::= { hostTopNControlEntry 10 } - - hostTopNTable OBJECT-TYPE - SYNTAX SEQUENCE OF HostTopNEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "A list of top N host entries." - ::= { hostTopN 2 } - - hostTopNEntry OBJECT-TYPE - SYNTAX HostTopNEntry - - - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "A set of statistics for a host that is part of a - top N report. For example, an instance of the - hostTopNRate object might be named - hostTopNRate.3.10" - INDEX { hostTopNReport, hostTopNIndex } - ::= { hostTopNTable 1 } - - HostTopNEntry ::= SEQUENCE { - hostTopNReport INTEGER (1..65535), - hostTopNIndex INTEGER (1..65535), - hostTopNAddress OCTET STRING, - hostTopNRate INTEGER - } - - hostTopNReport OBJECT-TYPE - SYNTAX INTEGER (1..65535) - ACCESS read-only - STATUS mandatory - DESCRIPTION - "This object identifies the top N report of which - this entry is a part. The set of hosts - identified by a particular value of this - object is part of the same report as identified - by the same value of the hostTopNControlIndex object." - ::= { hostTopNEntry 1 } - - hostTopNIndex OBJECT-TYPE - SYNTAX INTEGER (1..65535) - ACCESS read-only - STATUS mandatory - DESCRIPTION - "An index that uniquely identifies an entry in - the hostTopN table among those in the same report. - This index is between 1 and N, where N is the - number of entries in this table. Increasing values - of hostTopNIndex shall be assigned to entries with - decreasing values of hostTopNRate until index N - is assigned to the entry with the lowest value of - hostTopNRate or there are no more hostTopNEntries." - ::= { hostTopNEntry 2 } - - hostTopNAddress OBJECT-TYPE - SYNTAX OCTET STRING - ACCESS read-only - STATUS mandatory - - - DESCRIPTION - "The physical address of this host." - ::= { hostTopNEntry 3 } - - hostTopNRate OBJECT-TYPE - SYNTAX INTEGER - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The amount of change in the selected variable - during this sampling interval. The selected - variable is this host's instance of the object - selected by hostTopNRateBase." - ::= { hostTopNEntry 4 } - - - -- The Matrix Group - - -- Implementation of the Matrix group is optional. - -- - -- The Matrix group consists of the matrixControlTable, - -- matrixSDTable and the matrixDSTable. These tables - -- store statistics for a particular conversation - -- between two addresses. As the device detects a new - -- conversation, including those to a non-unicast - -- address, it creates a new entry in both of the - -- matrix tables. It must only create new entries - -- based on information received in good packets. If - -- the monitoring device finds itself short of - -- resources, it may delete entries as needed. It is - -- suggested that the device delete the least recently - -- used entries first. - - matrixControlTable OBJECT-TYPE - SYNTAX SEQUENCE OF MatrixControlEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "A list of information entries for the - traffic matrix on each interface." - ::= { matrix 1 } - - matrixControlEntry OBJECT-TYPE - SYNTAX MatrixControlEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "Information about a traffic matrix on a particular - - - interface. For example, an instance of the - matrixControlLastDeleteTime object might be named - matrixControlLastDeleteTime.1" - INDEX { matrixControlIndex } - ::= { matrixControlTable 1 } - - MatrixControlEntry ::= SEQUENCE { - matrixControlIndex INTEGER (1..65535), - matrixControlDataSource OBJECT IDENTIFIER, - matrixControlTableSize INTEGER, - matrixControlLastDeleteTime TimeTicks, - matrixControlOwner OwnerString, - matrixControlStatus EntryStatus - } - - matrixControlIndex OBJECT-TYPE - SYNTAX INTEGER (1..65535) - ACCESS read-only - STATUS mandatory - DESCRIPTION - "An index that uniquely identifies an entry in the - matrixControl table. Each such entry defines - a function that discovers conversations on a - particular interface and places statistics about - them in the matrixSDTable and the matrixDSTable on - behalf of this matrixControlEntry." - ::= { matrixControlEntry 1 } - - matrixControlDataSource OBJECT-TYPE - SYNTAX OBJECT IDENTIFIER - ACCESS read-write - STATUS mandatory - DESCRIPTION - "This object identifies the source of - the data from which this entry creates a traffic - matrix. This source can be any interface on this - device. In order to identify a particular - interface, this object shall identify the instance - of the ifIndex object, defined in RFC 1213 and RFC - 1573 [4,6], for the desired interface. For example, - if an entry were to receive data from interface #1, - this object would be set to ifIndex.1. - - The statistics in this group reflect all packets - on the local network segment attached to the - identified interface. - - An agent may or may not be able to tell if - - - fundamental changes to the media of the interface - have occurred and necessitate an invalidation of - this entry. For example, a hot-pluggable ethernet - card could be pulled out and replaced by a - token-ring card. In such a case, if the agent has - such knowledge of the change, it is recommended that - it invalidate this entry. - - This object may not be modified if the associated - matrixControlStatus object is equal to valid(1)." - ::= { matrixControlEntry 2 } - - matrixControlTableSize OBJECT-TYPE - SYNTAX INTEGER - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of matrixSDEntries in the matrixSDTable - for this interface. This must also be the value of - the number of entries in the matrixDSTable for this - interface." - ::= { matrixControlEntry 3 } - - matrixControlLastDeleteTime OBJECT-TYPE - SYNTAX TimeTicks - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The value of sysUpTime when the last entry - was deleted from the portion of the matrixSDTable - or matrixDSTable associated with this - matrixControlEntry. If no deletions have occurred, - this value shall be zero." - ::= { matrixControlEntry 4 } - - matrixControlOwner OBJECT-TYPE - SYNTAX OwnerString - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The entity that configured this entry and is - therefore using the resources assigned to it." - ::= { matrixControlEntry 5 } - - matrixControlStatus OBJECT-TYPE - SYNTAX EntryStatus - ACCESS read-write - STATUS mandatory - - - DESCRIPTION - "The status of this matrixControl entry. - - If this object is not equal to valid(1), all - associated entries in the matrixSDTable and the - matrixDSTable shall be deleted by the agent." - ::= { matrixControlEntry 6 } - - matrixSDTable OBJECT-TYPE - SYNTAX SEQUENCE OF MatrixSDEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "A list of traffic matrix entries indexed by - source and destination MAC address." - ::= { matrix 2 } - - matrixSDEntry OBJECT-TYPE - SYNTAX MatrixSDEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "A collection of statistics for communications between - two addresses on a particular interface. For example, - an instance of the matrixSDPkts object might be named - matrixSDPkts.1.6.8.0.32.27.3.176.6.8.0.32.10.8.113" - INDEX { matrixSDIndex, - matrixSDSourceAddress, matrixSDDestAddress } - ::= { matrixSDTable 1 } - - MatrixSDEntry ::= SEQUENCE { - matrixSDSourceAddress OCTET STRING, - matrixSDDestAddress OCTET STRING, - matrixSDIndex INTEGER (1..65535), - matrixSDPkts Counter, - matrixSDOctets Counter, - matrixSDErrors Counter - } - - matrixSDSourceAddress OBJECT-TYPE - SYNTAX OCTET STRING - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The source physical address." - ::= { matrixSDEntry 1 } - - matrixSDDestAddress OBJECT-TYPE - - - SYNTAX OCTET STRING - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The destination physical address." - ::= { matrixSDEntry 2 } - - matrixSDIndex OBJECT-TYPE - SYNTAX INTEGER (1..65535) - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The set of collected matrix statistics of which - this entry is a part. The set of matrix statistics - identified by a particular value of this index - is associated with the same matrixControlEntry - as identified by the same value of - matrixControlIndex." - ::= { matrixSDEntry 3 } - - matrixSDPkts OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of packets transmitted from the source - address to the destination address (this number - includes bad packets)." - ::= { matrixSDEntry 4 } - - matrixSDOctets OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of octets (excluding framing bits but - including FCS octets) contained in all packets - transmitted from the source address to the - destination address." - ::= { matrixSDEntry 5 } - - matrixSDErrors OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of bad packets transmitted from - the source address to the destination address." - - - ::= { matrixSDEntry 6 } - - - -- Traffic matrix tables from destination to source - - matrixDSTable OBJECT-TYPE - SYNTAX SEQUENCE OF MatrixDSEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "A list of traffic matrix entries indexed by - destination and source MAC address." - ::= { matrix 3 } - - matrixDSEntry OBJECT-TYPE - SYNTAX MatrixDSEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "A collection of statistics for communications between - two addresses on a particular interface. For example, - an instance of the matrixSDPkts object might be named - matrixSDPkts.1.6.8.0.32.10.8.113.6.8.0.32.27.3.176" - INDEX { matrixDSIndex, - matrixDSDestAddress, matrixDSSourceAddress } - ::= { matrixDSTable 1 } - - MatrixDSEntry ::= SEQUENCE { - matrixDSSourceAddress OCTET STRING, - matrixDSDestAddress OCTET STRING, - matrixDSIndex INTEGER (1..65535), - matrixDSPkts Counter, - matrixDSOctets Counter, - matrixDSErrors Counter - } - - matrixDSSourceAddress OBJECT-TYPE - SYNTAX OCTET STRING - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The source physical address." - ::= { matrixDSEntry 1 } - - matrixDSDestAddress OBJECT-TYPE - SYNTAX OCTET STRING - ACCESS read-only - STATUS mandatory - - - DESCRIPTION - "The destination physical address." - ::= { matrixDSEntry 2 } - - matrixDSIndex OBJECT-TYPE - SYNTAX INTEGER (1..65535) - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The set of collected matrix statistics of which - this entry is a part. The set of matrix statistics - identified by a particular value of this index - is associated with the same matrixControlEntry - as identified by the same value of - matrixControlIndex." - ::= { matrixDSEntry 3 } - - matrixDSPkts OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of packets transmitted from the source - address to the destination address (this number - includes bad packets)." - ::= { matrixDSEntry 4 } - - matrixDSOctets OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of octets (excluding framing bits - but including FCS octets) contained in all packets - transmitted from the source address to the - destination address." - ::= { matrixDSEntry 5 } - - matrixDSErrors OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of bad packets transmitted from - the source address to the destination address." - ::= { matrixDSEntry 6 } - - - - - -- The Filter Group - - -- Implementation of the Filter group is optional. - -- - -- The Filter group allows packets to be captured with an - -- arbitrary filter expression. A logical data and - -- event stream or "channel" is formed by the packets - -- that match the filter expression. - -- - -- This filter mechanism allows the creation of an arbitrary - -- logical expression with which to filter packets. Each - -- filter associated with a channel is OR'ed with the others. - -- Within a filter, any bits checked in the data and status - -- are AND'ed with respect to other bits in the same filter. - -- The NotMask also allows for checking for inequality. - -- Finally, the channelAcceptType object allows for - -- inversion of the whole equation. - -- - -- If a management station wishes to receive a trap to alert - -- it that new packets have been captured and are available - -- for download, it is recommended that it set up an alarm - -- entry that monitors the value of the relevant - -- channelMatches instance. - -- - -- The channel can be turned on or off, and can also - -- generate events when packets pass through it. - - filterTable OBJECT-TYPE - SYNTAX SEQUENCE OF FilterEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "A list of packet filter entries." - ::= { filter 1 } - - filterEntry OBJECT-TYPE - SYNTAX FilterEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "A set of parameters for a packet filter applied on a - particular interface. As an example, an instance of - the filterPktData object might be named - filterPktData.12" - INDEX { filterIndex } - ::= { filterTable 1 } - - - - - FilterEntry ::= SEQUENCE { - filterIndex INTEGER (1..65535), - filterChannelIndex INTEGER (1..65535), - filterPktDataOffset INTEGER, - filterPktData OCTET STRING, - filterPktDataMask OCTET STRING, - filterPktDataNotMask OCTET STRING, - filterPktStatus INTEGER, - filterPktStatusMask INTEGER, - filterPktStatusNotMask INTEGER, - filterOwner OwnerString, - filterStatus EntryStatus - } - - filterIndex OBJECT-TYPE - SYNTAX INTEGER (1..65535) - ACCESS read-only - STATUS mandatory - DESCRIPTION - "An index that uniquely identifies an entry - in the filter table. Each such entry defines - one filter that is to be applied to every packet - received on an interface." - ::= { filterEntry 1 } - - filterChannelIndex OBJECT-TYPE - SYNTAX INTEGER (1..65535) - ACCESS read-write - STATUS mandatory - DESCRIPTION - "This object identifies the channel of which this - filter is a part. The filters identified by a - particular value of this object are associated with - the same channel as identified by the same value of - the channelIndex object." - ::= { filterEntry 2 } - - filterPktDataOffset OBJECT-TYPE - SYNTAX INTEGER - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The offset from the beginning of each packet where - a match of packet data will be attempted. This offset - is measured from the point in the physical layer - packet after the framing bits, if any. For example, - in an Ethernet frame, this point is at the beginning - of the destination MAC address. - - - This object may not be modified if the associated - filterStatus object is equal to valid(1)." - DEFVAL { 0 } - ::= { filterEntry 3 } - - filterPktData OBJECT-TYPE - SYNTAX OCTET STRING - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The data that is to be matched with the input - packet. For each packet received, this filter and - the accompanying filterPktDataMask and - filterPktDataNotMask will be adjusted for the - offset. The only bits relevant to this match - algorithm are those that have the corresponding - filterPktDataMask bit equal to one. The following - three rules are then applied to every packet: - - (1) If the packet is too short and does not have data - corresponding to part of the filterPktData, the - packet will fail this data match. - - (2) For each relevant bit from the packet with the - corresponding filterPktDataNotMask bit set to - zero, if the bit from the packet is not equal to - the corresponding bit from the filterPktData, - then the packet will fail this data match. - - (3) If for every relevant bit from the packet with the - corresponding filterPktDataNotMask bit set to one, - the bit from the packet is equal to the - corresponding bit from the filterPktData, then - the packet will fail this data match. - - Any packets that have not failed any of the three - matches above have passed this data match. In - particular, a zero length filter will match any - packet. - - This object may not be modified if the associated - filterStatus object is equal to valid(1)." - ::= { filterEntry 4 } - - filterPktDataMask OBJECT-TYPE - SYNTAX OCTET STRING - ACCESS read-write - STATUS mandatory - - - DESCRIPTION - "The mask that is applied to the match process. - After adjusting this mask for the offset, only those - bits in the received packet that correspond to bits - set in this mask are relevant for further processing - by the match algorithm. The offset is applied to - filterPktDataMask in the same way it is applied to the - filter. For the purposes of the matching algorithm, - if the associated filterPktData object is longer - than this mask, this mask is conceptually extended - with '1' bits until it reaches the length of the - filterPktData object. - - This object may not be modified if the associated - filterStatus object is equal to valid(1)." - ::= { filterEntry 5 } - - filterPktDataNotMask OBJECT-TYPE - SYNTAX OCTET STRING - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The inversion mask that is applied to the match - process. After adjusting this mask for the offset, - those relevant bits in the received packet that - correspond to bits cleared in this mask must all be - equal to their corresponding bits in the - filterPktData object for the packet to be accepted. - In addition, at least one of those relevant bits in - the received packet that correspond to bits set in - this mask must be different to its corresponding bit - in the filterPktData object. - - For the purposes of the matching algorithm, if the - associated filterPktData object is longer than this - mask, this mask is conceptually extended with '0' - bits until it reaches the length of the - filterPktData object. - - This object may not be modified if the associated - filterStatus object is equal to valid(1)." - ::= { filterEntry 6 } - - filterPktStatus OBJECT-TYPE - SYNTAX INTEGER - ACCESS read-write - STATUS mandatory - DESCRIPTION - - - "The status that is to be matched with the input - packet. The only bits relevant to this match - algorithm are those that have the corresponding - filterPktStatusMask bit equal to one. The following - two rules are then applied to every packet: - - (1) For each relevant bit from the packet status - with the corresponding filterPktStatusNotMask bit - set to zero, if the bit from the packet status is - not equal to the corresponding bit from the - filterPktStatus, then the packet will fail this - status match. - - (2) If for every relevant bit from the packet status - with the corresponding filterPktStatusNotMask bit - set to one, the bit from the packet status is - equal to the corresponding bit from the - filterPktStatus, then the packet will fail this - status match. - - Any packets that have not failed either of the two - matches above have passed this status match. In - particular, a zero length status filter will match any - packet's status. - - The value of the packet status is a sum. This sum - initially takes the value zero. Then, for each - error, E, that has been discovered in this packet, - 2 raised to a value representing E is added to the - sum. The errors and the bits that represent them are - dependent on the media type of the interface that - this channel is receiving packets from. - - The errors defined for a packet captured off of an - Ethernet interface are as follows: - - bit # Error - 0 Packet is longer than 1518 octets - 1 Packet is shorter than 64 octets - 2 Packet experienced a CRC or Alignment - error - - For example, an Ethernet fragment would have a - value of 6 (2^1 + 2^2). - - As this MIB is expanded to new media types, this - object will have other media-specific errors - defined. - - - For the purposes of this status matching algorithm, - if the packet status is longer than this - filterPktStatus object, this object is conceptually - extended with '0' bits until it reaches the size of - the packet status. - - This object may not be modified if the associated - filterStatus object is equal to valid(1)." - ::= { filterEntry 7 } - - filterPktStatusMask OBJECT-TYPE - SYNTAX INTEGER - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The mask that is applied to the status match - process. Only those bits in the received packet - that correspond to bits set in this mask are - relevant for further processing by the status match - algorithm. For the purposes of the matching - algorithm, if the associated filterPktStatus object - is longer than this mask, this mask is conceptually - extended with '1' bits until it reaches the size of - the filterPktStatus. In addition, if a packet - status is longer than this mask, this mask is - conceptually extended with '0' bits until it reaches - the size of the packet status. - - This object may not be modified if the associated - filterStatus object is equal to valid(1)." - ::= { filterEntry 8 } - - filterPktStatusNotMask OBJECT-TYPE - SYNTAX INTEGER - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The inversion mask that is applied to the status - match process. Those relevant bits in the received - packet status that correspond to bits cleared in - this mask must all be equal to their corresponding - bits in the filterPktStatus object for the packet to - be accepted. In addition, at least one of those - relevant bits in the received packet status that - correspond to bits set in this mask must be - different to its corresponding bit in the - filterPktStatus object for the packet to be - accepted. - - - For the purposes of the matching algorithm, if the - associated filterPktStatus object or a packet status - is longer than this mask, this mask is conceptually - extended with '0' bits until it reaches the longer - of the lengths of the filterPktStatus object and the - packet status. - - This object may not be modified if the associated - filterStatus object is equal to valid(1)." - ::= { filterEntry 9 } - - filterOwner OBJECT-TYPE - SYNTAX OwnerString - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The entity that configured this entry and is - therefore using the resources assigned to it." - ::= { filterEntry 10 } - - filterStatus OBJECT-TYPE - SYNTAX EntryStatus - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The status of this filter entry." - ::= { filterEntry 11 } - - channelTable OBJECT-TYPE - SYNTAX SEQUENCE OF ChannelEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "A list of packet channel entries." - ::= { filter 2 } - - channelEntry OBJECT-TYPE - SYNTAX ChannelEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "A set of parameters for a packet channel applied on a - particular interface. As an example, an instance of - the channelMatches object might be named - channelMatches.3" - INDEX { channelIndex } - ::= { channelTable 1 } - - - - ChannelEntry ::= SEQUENCE { - channelIndex INTEGER (1..65535), - channelIfIndex INTEGER (1..65535), - channelAcceptType INTEGER, - channelDataControl INTEGER, - channelTurnOnEventIndex INTEGER (0..65535), - channelTurnOffEventIndex INTEGER (0..65535), - channelEventIndex INTEGER (0..65535), - channelEventStatus INTEGER, - channelMatches Counter, - channelDescription DisplayString (SIZE (0..127)), - channelOwner OwnerString, - channelStatus EntryStatus - } - - channelIndex OBJECT-TYPE - SYNTAX INTEGER (1..65535) - ACCESS read-only - STATUS mandatory - DESCRIPTION - "An index that uniquely identifies an entry in the - channel table. Each such entry defines one channel, - a logical data and event stream. - - It is suggested that before creating a channel, an - application should scan all instances of the - filterChannelIndex object to make sure that there - are no pre-existing filters that would be - inadvertently be linked to the channel." - ::= { channelEntry 1 } - - channelIfIndex OBJECT-TYPE - SYNTAX INTEGER (1..65535) - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The value of this object uniquely identifies the - interface on this remote network monitoring device - to which the associated filters are applied to allow - data into this channel. The interface identified by - a particular value of this object is the same - interface as identified by the same value of the - ifIndex object, defined in RFC 1213 and RFC 1573 - [4,6]. - - The filters in this group are applied to all packets - on the local network segment attached to the - identified interface. - - - An agent may or may not be able to tell if - fundamental changes to the media of the interface - have occurred and necessitate an invalidation of - this entry. For example, a hot-pluggable ethernet - card could be pulled out and replaced by a - token-ring card. In such a case, if the agent has - such knowledge of the change, it is recommended that - it invalidate this entry. - - This object may not be modified if the associated - channelStatus object is equal to valid(1)." - ::= { channelEntry 2 } - - channelAcceptType OBJECT-TYPE - SYNTAX INTEGER { - acceptMatched(1), - acceptFailed(2) - } - ACCESS read-write - STATUS mandatory - DESCRIPTION - "This object controls the action of the filters - associated with this channel. If this object is equal - to acceptMatched(1), packets will be accepted to this - channel if they are accepted by both the packet data - and packet status matches of an associated filter. If - this object is equal to acceptFailed(2), packets will - be accepted to this channel only if they fail either - the packet data match or the packet status match of - each of the associated filters. - - In particular, a channel with no associated filters - will match no packets if set to acceptMatched(1) - case and will match all packets in the - acceptFailed(2) case. - - This object may not be modified if the associated - channelStatus object is equal to valid(1)." - ::= { channelEntry 3 } - - channelDataControl OBJECT-TYPE - SYNTAX INTEGER { - on(1), - off(2) - } - ACCESS read-write - STATUS mandatory - DESCRIPTION - - - "This object controls the flow of data through this - channel. If this object is on(1), data, status and - events flow through this channel. If this object is - off(2), data, status and events will not flow - through this channel." - DEFVAL { off } - ::= { channelEntry 4 } - - channelTurnOnEventIndex OBJECT-TYPE - SYNTAX INTEGER (0..65535) - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The value of this object identifies the event - that is configured to turn the associated - channelDataControl from off to on when the event is - generated. The event identified by a particular value - of this object is the same event as identified by the - same value of the eventIndex object. If there is no - corresponding entry in the eventTable, then no - association exists. In fact, if no event is intended - for this channel, channelTurnOnEventIndex must be - set to zero, a non-existent event index. - - This object may not be modified if the associated - channelStatus object is equal to valid(1)." - ::= { channelEntry 5 } - - channelTurnOffEventIndex OBJECT-TYPE - SYNTAX INTEGER (0..65535) - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The value of this object identifies the event - that is configured to turn the associated - channelDataControl from on to off when the event is - generated. The event identified by a particular value - of this object is the same event as identified by the - same value of the eventIndex object. If there is no - corresponding entry in the eventTable, then no - association exists. In fact, if no event is intended - for this channel, channelTurnOffEventIndex must be - set to zero, a non-existent event index. - - This object may not be modified if the associated - channelStatus object is equal to valid(1)." - ::= { channelEntry 6 } - - - - channelEventIndex OBJECT-TYPE - SYNTAX INTEGER (0..65535) - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The value of this object identifies the event - that is configured to be generated when the - associated channelDataControl is on and a packet - is matched. The event identified by a particular - value of this object is the same event as identified - by the same value of the eventIndex object. If - there is no corresponding entry in the eventTable, - then no association exists. In fact, if no event is - intended for this channel, channelEventIndex must be - set to zero, a non-existent event index. - - This object may not be modified if the associated - channelStatus object is equal to valid(1)." - ::= { channelEntry 7 } - - channelEventStatus OBJECT-TYPE - SYNTAX INTEGER { - eventReady(1), - eventFired(2), - eventAlwaysReady(3) - } - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The event status of this channel. - - If this channel is configured to generate events - when packets are matched, a means of controlling - the flow of those events is often needed. When - this object is equal to eventReady(1), a single - event may be generated, after which this object - will be set by the probe to eventFired(2). While - in the eventFired(2) state, no events will be - generated until the object is modified to - eventReady(1) (or eventAlwaysReady(3)). The - management station can thus easily respond to a - notification of an event by re-enabling this object. - - If the management station wishes to disable this - flow control and allow events to be generated - at will, this object may be set to - eventAlwaysReady(3). Disabling the flow control - is discouraged as it can result in high network - - - traffic or other performance problems." - DEFVAL { eventReady } - ::= { channelEntry 8 } - - channelMatches OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of times this channel has matched a - packet. Note that this object is updated even when - channelDataControl is set to off." - ::= { channelEntry 9 } - - channelDescription OBJECT-TYPE - SYNTAX DisplayString (SIZE (0..127)) - ACCESS read-write - STATUS mandatory - DESCRIPTION - "A comment describing this channel." - ::= { channelEntry 10 } - - channelOwner OBJECT-TYPE - SYNTAX OwnerString - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The entity that configured this entry and is - therefore using the resources assigned to it." - ::= { channelEntry 11 } - - channelStatus OBJECT-TYPE - SYNTAX EntryStatus - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The status of this channel entry." - ::= { channelEntry 12 } - - - -- The Packet Capture Group - - -- Implementation of the Packet Capture group is optional. - -- - -- The Packet Capture Group requires implementation of the - -- Filter Group. - -- - -- The Packet Capture group allows packets to be captured - - - -- upon a filter match. The bufferControlTable controls - -- the captured packets output from a channel that is - -- associated with it. The captured packets are placed - -- in entries in the captureBufferTable. These entries are - -- associated with the bufferControlEntry on whose behalf they - -- were stored. - - bufferControlTable OBJECT-TYPE - SYNTAX SEQUENCE OF BufferControlEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "A list of buffers control entries." - ::= { capture 1 } - - bufferControlEntry OBJECT-TYPE - SYNTAX BufferControlEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "A set of parameters that control the collection of - a stream of packets that have matched filters. As - an example, an instance of the - bufferControlCaptureSliceSize object might be named - bufferControlCaptureSliceSize.3" - INDEX { bufferControlIndex } - ::= { bufferControlTable 1 } - - BufferControlEntry ::= SEQUENCE { - bufferControlIndex INTEGER (1..65535), - bufferControlChannelIndex INTEGER (1..65535), - bufferControlFullStatus INTEGER, - bufferControlFullAction INTEGER, - bufferControlCaptureSliceSize INTEGER, - bufferControlDownloadSliceSize INTEGER, - bufferControlDownloadOffset INTEGER, - bufferControlMaxOctetsRequested INTEGER, - bufferControlMaxOctetsGranted INTEGER, - bufferControlCapturedPackets INTEGER, - bufferControlTurnOnTime TimeTicks, - bufferControlOwner OwnerString, - bufferControlStatus EntryStatus - } - - bufferControlIndex OBJECT-TYPE - SYNTAX INTEGER (1..65535) - ACCESS read-only - STATUS mandatory - - - DESCRIPTION - "An index that uniquely identifies an entry - in the bufferControl table. The value of this - index shall never be zero. Each such - entry defines one set of packets that is - captured and controlled by one or more filters." - ::= { bufferControlEntry 1 } - - bufferControlChannelIndex OBJECT-TYPE - SYNTAX INTEGER (1..65535) - ACCESS read-write - STATUS mandatory - DESCRIPTION - "An index that identifies the channel that is the - source of packets for this bufferControl table. - The channel identified by a particular value of this - index is the same as identified by the same value of - the channelIndex object. - - This object may not be modified if the associated - bufferControlStatus object is equal to valid(1)." - ::= { bufferControlEntry 2 } - - bufferControlFullStatus OBJECT-TYPE - SYNTAX INTEGER { - spaceAvailable(1), - full(2) - } - ACCESS read-only - STATUS mandatory - DESCRIPTION - "This object shows whether the buffer has room to - accept new packets or if it is full. - - If the status is spaceAvailable(1), the buffer is - accepting new packets normally. If the status is - full(2) and the associated bufferControlFullAction - object is wrapWhenFull, the buffer is accepting new - packets by deleting enough of the oldest packets - to make room for new ones as they arrive. Otherwise, - if the status is full(2) and the - bufferControlFullAction object is lockWhenFull, - then the buffer has stopped collecting packets. - - When this object is set to full(2) the probe must - not later set it to spaceAvailable(1) except in the - case of a significant gain in resources such as - an increase of bufferControlOctetsGranted. In - - - particular, the wrap-mode action of deleting old - packets to make room for newly arrived packets - must not affect the value of this object." - ::= { bufferControlEntry 3 } - - bufferControlFullAction OBJECT-TYPE - SYNTAX INTEGER { - lockWhenFull(1), - wrapWhenFull(2) -- FIFO - } - ACCESS read-write - STATUS mandatory - DESCRIPTION - "Controls the action of the buffer when it - reaches the full status. When in the lockWhenFull(1) - state and a packet is added to the buffer that - fills the buffer, the bufferControlFullStatus will - be set to full(2) and this buffer will stop capturing - packets." - ::= { bufferControlEntry 4 } - - bufferControlCaptureSliceSize OBJECT-TYPE - SYNTAX INTEGER - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The maximum number of octets of each packet - that will be saved in this capture buffer. - For example, if a 1500 octet packet is received by - the probe and this object is set to 500, then only - 500 octets of the packet will be stored in the - associated capture buffer. If this variable is set - to 0, the capture buffer will save as many octets - as is possible. - - This object may not be modified if the associated - bufferControlStatus object is equal to valid(1)." - DEFVAL { 100 } - ::= { bufferControlEntry 5 } - - bufferControlDownloadSliceSize OBJECT-TYPE - SYNTAX INTEGER - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The maximum number of octets of each packet - in this capture buffer that will be returned in - an SNMP retrieval of that packet. For example, - - - if 500 octets of a packet have been stored in the - associated capture buffer, the associated - bufferControlDownloadOffset is 0, and this - object is set to 100, then the captureBufferPacket - object that contains the packet will contain only - the first 100 octets of the packet. - - A prudent manager will take into account possible - interoperability or fragmentation problems that may - occur if the download slice size is set too large. - In particular, conformant SNMP implementations are not - required to accept messages whose length exceeds 484 - octets, although they are encouraged to support larger - datagrams whenever feasible." - DEFVAL { 100 } - ::= { bufferControlEntry 6 } - - bufferControlDownloadOffset OBJECT-TYPE - SYNTAX INTEGER - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The offset of the first octet of each packet - in this capture buffer that will be returned in - an SNMP retrieval of that packet. For example, - if 500 octets of a packet have been stored in the - associated capture buffer and this object is set to - 100, then the captureBufferPacket object that - contains the packet will contain bytes starting - 100 octets into the packet." - DEFVAL { 0 } - ::= { bufferControlEntry 7 } - - bufferControlMaxOctetsRequested OBJECT-TYPE - SYNTAX INTEGER - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The requested maximum number of octets to be - saved in this captureBuffer, including any - implementation-specific overhead. If this variable - is set to -1, the capture buffer will save as many - octets as is possible. - - When this object is created or modified, the probe - should set bufferControlMaxOctetsGranted as closely - to this object as is possible for the particular probe - implementation and available resources. However, if - - - the object has the special value of -1, the probe - must set bufferControlMaxOctetsGranted to -1." - DEFVAL { -1 } - ::= { bufferControlEntry 8 } - - bufferControlMaxOctetsGranted OBJECT-TYPE - SYNTAX INTEGER - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The maximum number of octets that can be - saved in this captureBuffer, including overhead. - If this variable is -1, the capture buffer will save - as many octets as possible. - - When the bufferControlMaxOctetsRequested object is - created or modified, the probe should set this object - as closely to the requested value as is possible for - the particular probe implementation and available - resources. - However, if the request object has the special value - of -1, the probe must set this object to -1. - The probe must not lower this value except as a result - of a modification to the associated - bufferControlMaxOctetsRequested object. - - When this maximum number of octets is reached - and a new packet is to be added to this - capture buffer and the corresponding - bufferControlFullAction is set to wrapWhenFull(2), - enough of the oldest packets associated with this - capture buffer shall be deleted by the agent so - that the new packet can be added. If the - corresponding bufferControlFullAction is set to - lockWhenFull(1), the new packet shall be discarded. - In either case, the probe must set - bufferControlFullStatus to full(2). - - When the value of this object changes to a value less - than the current value, entries are deleted from - the captureBufferTable associated with this - bufferControlEntry. Enough of the - oldest of these captureBufferEntries shall be - deleted by the agent so that the number of octets - used remains less than or equal to the new value of - this object. - - When the value of this object changes to a value - - - greater than the current value, the number of - associated captureBufferEntries may be allowed to - grow." - ::= { bufferControlEntry 9 } - - bufferControlCapturedPackets OBJECT-TYPE - SYNTAX INTEGER - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of packets currently in this - captureBuffer." - ::= { bufferControlEntry 10 } - - bufferControlTurnOnTime OBJECT-TYPE - SYNTAX TimeTicks - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The value of sysUpTime when this capture buffer was - first turned on." - ::= { bufferControlEntry 11 } - - bufferControlOwner OBJECT-TYPE - SYNTAX OwnerString - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The entity that configured this entry and is - therefore using the resources assigned to it." - ::= { bufferControlEntry 12 } - - bufferControlStatus OBJECT-TYPE - SYNTAX EntryStatus - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The status of this buffer Control Entry." - ::= { bufferControlEntry 13 } - - captureBufferTable OBJECT-TYPE - SYNTAX SEQUENCE OF CaptureBufferEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "A list of packets captured off of a channel." - ::= { capture 2 } - - - - captureBufferEntry OBJECT-TYPE - SYNTAX CaptureBufferEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "A packet captured off of an attached network. As an - example, an instance of the captureBufferPacketData - object might be named captureBufferPacketData.3.1783" - INDEX { captureBufferControlIndex, captureBufferIndex } - ::= { captureBufferTable 1 } - - CaptureBufferEntry ::= SEQUENCE { - captureBufferControlIndex INTEGER (1..65535), - captureBufferIndex INTEGER (1..2147483647), - captureBufferPacketID INTEGER, - captureBufferPacketData OCTET STRING, - captureBufferPacketLength INTEGER, - captureBufferPacketTime INTEGER, - captureBufferPacketStatus INTEGER - } - - captureBufferControlIndex OBJECT-TYPE - SYNTAX INTEGER (1..65535) - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The index of the bufferControlEntry with which - this packet is associated." - ::= { captureBufferEntry 1 } - - captureBufferIndex OBJECT-TYPE - SYNTAX INTEGER (1..2147483647) - ACCESS read-only - STATUS mandatory - DESCRIPTION - "An index that uniquely identifies an entry - in the captureBuffer table associated with a - particular bufferControlEntry. This index will - start at 1 and increase by one for each new packet - added with the same captureBufferControlIndex. - - Should this value reach 2147483647, the next packet - added with the same captureBufferControlIndex shall - cause this value to wrap around to 1." - ::= { captureBufferEntry 2 } - - captureBufferPacketID OBJECT-TYPE - SYNTAX INTEGER - - - ACCESS read-only - STATUS mandatory - DESCRIPTION - "An index that describes the order of packets - that are received on a particular interface. - The packetID of a packet captured on an - interface is defined to be greater than the - packetID's of all packets captured previously on - the same interface. As the captureBufferPacketID - object has a maximum positive value of 2^31 - 1, - any captureBufferPacketID object shall have the - value of the associated packet's packetID mod 2^31." - ::= { captureBufferEntry 3 } - - captureBufferPacketData OBJECT-TYPE - SYNTAX OCTET STRING - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The data inside the packet, starting at the - beginning of the packet plus any offset specified in - the associated bufferControlDownloadOffset, - including any link level headers. The length of the - data in this object is the minimum of the length of - the captured packet minus the offset, the length of - the associated bufferControlCaptureSliceSize minus - the offset, and the associated - bufferControlDownloadSliceSize. If this minimum is - less than zero, this object shall have a length of - zero." - ::= { captureBufferEntry 4 } - - captureBufferPacketLength OBJECT-TYPE - SYNTAX INTEGER - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The actual length (off the wire) of the packet stored - in this entry, including FCS octets." - ::= { captureBufferEntry 5 } - - captureBufferPacketTime OBJECT-TYPE - SYNTAX INTEGER - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of milliseconds that had passed since - this capture buffer was first turned on when this - - - packet was captured." - ::= { captureBufferEntry 6 } - - captureBufferPacketStatus OBJECT-TYPE - SYNTAX INTEGER - ACCESS read-only - STATUS mandatory - DESCRIPTION - "A value which indicates the error status of this - packet. - - The value of this object is defined in the same way as - filterPktStatus. The value is a sum. This sum - initially takes the value zero. Then, for each - error, E, that has been discovered in this packet, - 2 raised to a value representing E is added to the - sum. - - The errors defined for a packet captured off of an - Ethernet interface are as follows: - - bit # Error - 0 Packet is longer than 1518 octets - 1 Packet is shorter than 64 octets - 2 Packet experienced a CRC or Alignment - error - 3 First packet in this capture buffer after - it was detected that some packets were - not processed correctly. - 4 Packet's order in buffer is only - approximate (May only be set for packets - sent from the probe) - - For example, an Ethernet fragment would have a - value of 6 (2^1 + 2^2). - - As this MIB is expanded to new media types, this - object will have other media-specific errors defined." - ::= { captureBufferEntry 7 } - - - -- The Event Group - - -- Implementation of the Event group is optional. - -- - -- The Event group controls the generation and notification - -- of events from this device. Each entry in the eventTable - -- describes the parameters of the event that can be - - - -- triggered. Each event entry is fired by an associated - -- condition located elsewhere in the MIB. An event entry - -- may also be associated- with a function elsewhere in the - -- MIB that will be executed when the event is generated. For - -- example, a channel may be turned on or off by the firing - -- of an event. - -- - -- Each eventEntry may optionally specify that a log entry - -- be created on its behalf whenever the event occurs. - -- Each entry may also specify that notification should - -- occur by way of SNMP trap messages. In this case, the - -- community for the trap message is given in the associated - -- eventCommunity object. The enterprise and specific trap - -- fields of the trap are determined by the condition that - -- triggered the event. Two traps are defined: risingAlarm - -- and fallingAlarm. If the eventTable is triggered by a - -- condition specified elsewhere, the enterprise and - -- specific trap fields must be specified for traps - -- generated for that condition. - - eventTable OBJECT-TYPE - SYNTAX SEQUENCE OF EventEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "A list of events to be generated." - ::= { event 1 } - - eventEntry OBJECT-TYPE - SYNTAX EventEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "A set of parameters that describe an event to be - generated when certain conditions are met. As an - example, an instance of the eventLastTimeSent object - might be named eventLastTimeSent.6" - INDEX { eventIndex } - ::= { eventTable 1 } - - EventEntry ::= SEQUENCE { - eventIndex INTEGER (1..65535), - eventDescription DisplayString (SIZE (0..127)), - eventType INTEGER, - eventCommunity OCTET STRING (SIZE (0..127)), - eventLastTimeSent TimeTicks, - eventOwner OwnerString, - eventStatus EntryStatus - - - } - - eventIndex OBJECT-TYPE - SYNTAX INTEGER (1..65535) - ACCESS read-only - STATUS mandatory - DESCRIPTION - "An index that uniquely identifies an entry in the - event table. Each such entry defines one event that - is to be generated when the appropriate conditions - occur." - ::= { eventEntry 1 } - - eventDescription OBJECT-TYPE - SYNTAX DisplayString (SIZE (0..127)) - ACCESS read-write - STATUS mandatory - DESCRIPTION - "A comment describing this event entry." - ::= { eventEntry 2 } - - eventType OBJECT-TYPE - SYNTAX INTEGER { - none(1), - log(2), - snmp-trap(3), -- send an SNMP trap - log-and-trap(4) - } - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The type of notification that the probe will make - about this event. In the case of log, an entry is - made in the log table for each event. In the case of - snmp-trap, an SNMP trap is sent to one or more - management stations." - ::= { eventEntry 3 } - - eventCommunity OBJECT-TYPE - SYNTAX OCTET STRING (SIZE (0..127)) - ACCESS read-write - STATUS mandatory - DESCRIPTION - "If an SNMP trap is to be sent, it will be sent to - the SNMP community specified by this octet string. - In the future this table will be extended to include - the party security mechanism. This object shall be - set to a string of length zero if it is intended that - - - that mechanism be used to specify the destination of - the trap." - ::= { eventEntry 4 } - - eventLastTimeSent OBJECT-TYPE - SYNTAX TimeTicks - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The value of sysUpTime at the time this event - entry last generated an event. If this entry has - not generated any events, this value will be - zero." - ::= { eventEntry 5 } - - eventOwner OBJECT-TYPE - SYNTAX OwnerString - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The entity that configured this entry and is - therefore using the resources assigned to it. - - If this object contains a string starting with - 'monitor' and has associated entries in the log - table, all connected management stations should - retrieve those log entries, as they may have - significance to all management stations connected to - this device" - ::= { eventEntry 6 } - - eventStatus OBJECT-TYPE - SYNTAX EntryStatus - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The status of this event entry. - - If this object is not equal to valid(1), all - associated log entries shall be deleted by the - agent." - ::= { eventEntry 7 } - - -- - logTable OBJECT-TYPE - SYNTAX SEQUENCE OF LogEntry - ACCESS not-accessible - STATUS mandatory - - - DESCRIPTION - "A list of events that have been logged." - ::= { event 2 } - - logEntry OBJECT-TYPE - SYNTAX LogEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "A set of data describing an event that has been - logged. For example, an instance of the - logDescription object might be named - logDescription.6.47" - INDEX { logEventIndex, logIndex } - ::= { logTable 1 } - - LogEntry ::= SEQUENCE { - logEventIndex INTEGER (1..65535), - logIndex INTEGER (1..2147483647), - logTime TimeTicks, - logDescription DisplayString (SIZE (0..255)) - } - - logEventIndex OBJECT-TYPE - SYNTAX INTEGER (1..65535) - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The event entry that generated this log - entry. The log identified by a particular - value of this index is associated with the same - eventEntry as identified by the same value - of eventIndex." - ::= { logEntry 1 } - - logIndex OBJECT-TYPE - SYNTAX INTEGER (1..2147483647) - ACCESS read-only - STATUS mandatory - DESCRIPTION - "An index that uniquely identifies an entry - in the log table amongst those generated by the - same eventEntries. These indexes are - assigned beginning with 1 and increase by one - with each new log entry. The association - between values of logIndex and logEntries - is fixed for the lifetime of each logEntry. - The agent may choose to delete the oldest - - - instances of logEntry as required because of - lack of memory. It is an implementation-specific - matter as to when this deletion may occur." - ::= { logEntry 2 } - - logTime OBJECT-TYPE - SYNTAX TimeTicks - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The value of sysUpTime when this log entry was - created." - ::= { logEntry 3 } - - logDescription OBJECT-TYPE - SYNTAX DisplayString (SIZE (0..255)) - ACCESS read-only - STATUS mandatory - DESCRIPTION - "An implementation dependent description of the - event that activated this log entry." - ::= { logEntry 4 } - - -- These definitions use the TRAP-TYPE macro as - -- defined in RFC 1215 [10] - - -- Remote Network Monitoring Traps - - risingAlarm TRAP-TYPE - ENTERPRISE rmon - VARIABLES { alarmIndex, alarmVariable, alarmSampleType, - alarmValue, alarmRisingThreshold } - DESCRIPTION - "The SNMP trap that is generated when an alarm - entry crosses its rising threshold and generates - an event that is configured for sending SNMP - traps." - ::= 1 - - fallingAlarm TRAP-TYPE - ENTERPRISE rmon - VARIABLES { alarmIndex, alarmVariable, alarmSampleType, - alarmValue, alarmFallingThreshold } - DESCRIPTION - "The SNMP trap that is generated when an alarm - entry crosses its falling threshold and generates - an event that is configured for sending SNMP - traps." - - - ::= 2 - - END +RMON-MIB DEFINITIONS ::= BEGIN + IMPORTS + MODULE-IDENTITY, OBJECT-TYPE, OBJECT-IDENTITY, + NOTIFICATION-TYPE, mib-2, Counter32, + Integer32, TimeTicks FROM SNMPv2-SMI + + TEXTUAL-CONVENTION, DisplayString FROM SNMPv2-TC + + MODULE-COMPLIANCE, OBJECT-GROUP, + NOTIFICATION-GROUP FROM SNMPv2-CONF; + + +-- Remote Network Monitoring MIB + +rmonMibModule MODULE-IDENTITY + LAST-UPDATED "200005110000Z" -- 11 May, 2000 + ORGANIZATION "IETF RMON MIB Working Group" + CONTACT-INFO + "Steve Waldbusser + Phone: +1-650-948-6500 + Fax: +1-650-745-0671 + Email: [email protected]" + DESCRIPTION + "Remote network monitoring devices, often called + monitors or probes, are instruments that exist for + the purpose of managing a network. This MIB defines + objects for managing remote network monitoring devices." + + REVISION "200005110000Z" -- 11 May, 2000 + DESCRIPTION + "Reformatted into SMIv2 format. + + This version published as RFC 2819." + + REVISION "199502010000Z" -- 1 Feb, 1995 + DESCRIPTION + "Bug fixes, clarifications and minor changes based on + implementation experience, published as RFC1757 [18]. + + Two changes were made to object definitions: + + 1) A new status bit has been defined for the + captureBufferPacketStatus object, indicating that the + packet order within the capture buffer may not be identical to + the packet order as received off the wire. This bit may only + be used for packets transmitted by the probe. Older NMS + applications can safely ignore this status bit, which might be + used by newer agents. + + 2) The packetMatch trap has been removed. This trap was never + actually 'approved' and was not added to this document along + with the risingAlarm and fallingAlarm traps. The packetMatch + trap could not be throttled, which could cause disruption of + normal network traffic under some circumstances. An NMS should + configure a risingAlarm threshold on the appropriate + channelMatches instance if a trap is desired for a packetMatch + event. Note that logging of packetMatch events is still + supported--only trap generation for such events has been + removed. + + In addition, several clarifications to individual object + definitions have been added to assist agent and NMS + implementors: + + - global definition of 'good packets' and 'bad packets' + + - more detailed text governing conceptual row creation and + modification + + - instructions for probes relating to interface changes and + disruptions + + - clarification of some ethernet counter definitions + + - recommended formula for calculating network utilization + + - clarification of channel and captureBuffer behavior for some + unusual conditions + + - examples of proper instance naming for each table" + + REVISION "199111010000Z" -- 1 Nov, 1991 + DESCRIPTION + "The original version of this MIB, published as RFC1271." + ::= { rmonConformance 8 } + + rmon OBJECT IDENTIFIER ::= { mib-2 16 } + + + -- textual conventions + +OwnerString ::= TEXTUAL-CONVENTION + STATUS current + + DESCRIPTION + "This data type is used to model an administratively + assigned name of the owner of a resource. Implementations + must accept values composed of well-formed NVT ASCII + sequences. In addition, implementations should accept + values composed of well-formed UTF-8 sequences. + + It is suggested that this name contain one or more of + the following: IP address, management station name, + network manager's name, location, or phone number. + In some cases the agent itself will be the owner of + an entry. In these cases, this string shall be set + to a string starting with 'monitor'. + + SNMP access control is articulated entirely in terms + of the contents of MIB views; access to a particular + SNMP object instance depends only upon its presence + or absence in a particular MIB view and never upon + its value or the value of related object instances. + Thus, objects of this type afford resolution of + resource contention only among cooperating + managers; they realize no access control function + with respect to uncooperative parties." + SYNTAX OCTET STRING (SIZE (0..127)) + +EntryStatus ::= TEXTUAL-CONVENTION + STATUS current + DESCRIPTION + "The status of a table entry. + + Setting this object to the value invalid(4) has the + effect of invalidating the corresponding entry. + That is, it effectively disassociates the mapping + identified with said entry. + It is an implementation-specific matter as to whether + the agent removes an invalidated entry from the table. + Accordingly, management stations must be prepared to + receive tabular information from agents that corresponds + to entries currently not in use. Proper + interpretation of such entries requires examination + of the relevant EntryStatus object. + + An existing instance of this object cannot be set to + createRequest(2). This object may only be set to + createRequest(2) when this instance is created. When + this object is created, the agent may wish to create + supplemental object instances with default values + to complete a conceptual row in this table. Because the + creation of these default objects is entirely at the option + of the agent, the manager must not assume that any will be + created, but may make use of any that are created. + Immediately after completing the create operation, the agent + must set this object to underCreation(3). + + When in the underCreation(3) state, an entry is allowed to + exist in a possibly incomplete, possibly inconsistent state, + usually to allow it to be modified in multiple PDUs. When in + this state, an entry is not fully active. + Entries shall exist in the underCreation(3) state until + the management station is finished configuring the entry + and sets this object to valid(1) or aborts, setting this + object to invalid(4). If the agent determines that an + entry has been in the underCreation(3) state for an + abnormally long time, it may decide that the management + station has crashed. If the agent makes this decision, + it may set this object to invalid(4) to reclaim the + entry. A prudent agent will understand that the + management station may need to wait for human input + and will allow for that possibility in its + determination of this abnormally long period. + + An entry in the valid(1) state is fully configured and + consistent and fully represents the configuration or + operation such a row is intended to represent. For + example, it could be a statistical function that is + configured and active, or a filter that is available + in the list of filters processed by the packet capture + process. + + A manager is restricted to changing the state of an entry in + the following ways: + + To: valid createRequest underCreation invalid + From: + valid OK NO OK OK + createRequest N/A N/A N/A N/A + underCreation OK NO OK OK + invalid NO NO NO OK + nonExistent NO OK NO OK + + In the table above, it is not applicable to move the state + from the createRequest state to any other state because the + manager will never find the variable in that state. The + nonExistent state is not a value of the enumeration, rather + it means that the entryStatus variable does not exist at all. + + An agent may allow an entryStatus variable to change state in + additional ways, so long as the semantics of the states are + followed. This allowance is made to ease the implementation of + the agent and is made despite the fact that managers should + never exercise these additional state transitions." + SYNTAX INTEGER { + valid(1), + createRequest(2), + underCreation(3), + invalid(4) + } + + statistics OBJECT IDENTIFIER ::= { rmon 1 } + history OBJECT IDENTIFIER ::= { rmon 2 } + alarm OBJECT IDENTIFIER ::= { rmon 3 } + hosts OBJECT IDENTIFIER ::= { rmon 4 } + hostTopN OBJECT IDENTIFIER ::= { rmon 5 } + matrix OBJECT IDENTIFIER ::= { rmon 6 } + filter OBJECT IDENTIFIER ::= { rmon 7 } + capture OBJECT IDENTIFIER ::= { rmon 8 } + event OBJECT IDENTIFIER ::= { rmon 9 } + rmonConformance OBJECT IDENTIFIER ::= { rmon 20 } + +-- The Ethernet Statistics Group +-- +-- Implementation of the Ethernet Statistics group is optional. +-- Consult the MODULE-COMPLIANCE macro for the authoritative +-- conformance information for this MIB. +-- +-- The ethernet statistics group contains statistics measured by the +-- probe for each monitored interface on this device. These +-- statistics take the form of free running counters that start from +-- zero when a valid entry is created. +-- +-- This group currently has statistics defined only for +-- Ethernet interfaces. Each etherStatsEntry contains statistics +-- for one Ethernet interface. The probe must create one +-- etherStats entry for each monitored Ethernet interface +-- on the device. + +etherStatsTable OBJECT-TYPE + SYNTAX SEQUENCE OF EtherStatsEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of Ethernet statistics entries." + ::= { statistics 1 } + +etherStatsEntry OBJECT-TYPE + SYNTAX EtherStatsEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A collection of statistics kept for a particular + Ethernet interface. As an example, an instance of the + etherStatsPkts object might be named etherStatsPkts.1" + INDEX { etherStatsIndex } + ::= { etherStatsTable 1 } + +EtherStatsEntry ::= SEQUENCE { + etherStatsIndex Integer32, + etherStatsDataSource OBJECT IDENTIFIER, + etherStatsDropEvents Counter32, + etherStatsOctets Counter32, + etherStatsPkts Counter32, + etherStatsBroadcastPkts Counter32, + etherStatsMulticastPkts Counter32, + etherStatsCRCAlignErrors Counter32, + etherStatsUndersizePkts Counter32, + etherStatsOversizePkts Counter32, + etherStatsFragments Counter32, + etherStatsJabbers Counter32, + etherStatsCollisions Counter32, + etherStatsPkts64Octets Counter32, + etherStatsPkts65to127Octets Counter32, + etherStatsPkts128to255Octets Counter32, + etherStatsPkts256to511Octets Counter32, + etherStatsPkts512to1023Octets Counter32, + etherStatsPkts1024to1518Octets Counter32, + etherStatsOwner OwnerString, + etherStatsStatus EntryStatus +} + +etherStatsIndex OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The value of this object uniquely identifies this + etherStats entry." + ::= { etherStatsEntry 1 } + +etherStatsDataSource OBJECT-TYPE + SYNTAX OBJECT IDENTIFIER + MAX-ACCESS read-create + STATUS current + + DESCRIPTION + "This object identifies the source of the data that + this etherStats entry is configured to analyze. This + source can be any ethernet interface on this device. + In order to identify a particular interface, this object + shall identify the instance of the ifIndex object, + defined in RFC 2233 [17], for the desired interface. + For example, if an entry were to receive data from + interface #1, this object would be set to ifIndex.1. + + The statistics in this group reflect all packets + on the local network segment attached to the identified + interface. + + An agent may or may not be able to tell if fundamental + changes to the media of the interface have occurred and + necessitate an invalidation of this entry. For example, a + hot-pluggable ethernet card could be pulled out and replaced + by a token-ring card. In such a case, if the agent has such + knowledge of the change, it is recommended that it + invalidate this entry. + + This object may not be modified if the associated + etherStatsStatus object is equal to valid(1)." + ::= { etherStatsEntry 2 } + +etherStatsDropEvents OBJECT-TYPE + SYNTAX Counter32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The total number of events in which packets + were dropped by the probe due to lack of resources. + Note that this number is not necessarily the number of + packets dropped; it is just the number of times this + condition has been detected." + ::= { etherStatsEntry 3 } + +etherStatsOctets OBJECT-TYPE + SYNTAX Counter32 + UNITS "Octets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The total number of octets of data (including + those in bad packets) received on the + network (excluding framing bits but including + FCS octets). + + This object can be used as a reasonable estimate of + 10-Megabit ethernet utilization. If greater precision is + desired, the etherStatsPkts and etherStatsOctets objects + should be sampled before and after a common interval. The + differences in the sampled values are Pkts and Octets, + respectively, and the number of seconds in the interval is + Interval. These values are used to calculate the Utilization + as follows: + + Pkts * (9.6 + 6.4) + (Octets * .8) + Utilization = ------------------------------------- + Interval * 10,000 + + The result of this equation is the value Utilization which + is the percent utilization of the ethernet segment on a + scale of 0 to 100 percent." + ::= { etherStatsEntry 4 } + +etherStatsPkts OBJECT-TYPE + SYNTAX Counter32 + UNITS "Packets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The total number of packets (including bad packets, + broadcast packets, and multicast packets) received." + ::= { etherStatsEntry 5 } + +etherStatsBroadcastPkts OBJECT-TYPE + SYNTAX Counter32 + UNITS "Packets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The total number of good packets received that were + directed to the broadcast address. Note that this + does not include multicast packets." + ::= { etherStatsEntry 6 } + +etherStatsMulticastPkts OBJECT-TYPE + SYNTAX Counter32 + UNITS "Packets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The total number of good packets received that were + directed to a multicast address. Note that this number + does not include packets directed to the broadcast + address." + ::= { etherStatsEntry 7 } + +etherStatsCRCAlignErrors OBJECT-TYPE + SYNTAX Counter32 + UNITS "Packets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The total number of packets received that + had a length (excluding framing bits, but + including FCS octets) of between 64 and 1518 + octets, inclusive, but had either a bad + Frame Check Sequence (FCS) with an integral + number of octets (FCS Error) or a bad FCS with + a non-integral number of octets (Alignment Error)." + ::= { etherStatsEntry 8 } + +etherStatsUndersizePkts OBJECT-TYPE + SYNTAX Counter32 + UNITS "Packets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The total number of packets received that were + less than 64 octets long (excluding framing bits, + but including FCS octets) and were otherwise well + formed." + ::= { etherStatsEntry 9 } + +etherStatsOversizePkts OBJECT-TYPE + SYNTAX Counter32 + UNITS "Packets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The total number of packets received that were + longer than 1518 octets (excluding framing bits, + but including FCS octets) and were otherwise + well formed." + ::= { etherStatsEntry 10 } + +etherStatsFragments OBJECT-TYPE + SYNTAX Counter32 + UNITS "Packets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The total number of packets received that were less than + 64 octets in length (excluding framing bits but including + FCS octets) and had either a bad Frame Check Sequence + (FCS) with an integral number of octets (FCS Error) or a + bad FCS with a non-integral number of octets (Alignment + Error). + + Note that it is entirely normal for etherStatsFragments to + increment. This is because it counts both runts (which are + normal occurrences due to collisions) and noise hits." + ::= { etherStatsEntry 11 } + +etherStatsJabbers OBJECT-TYPE + SYNTAX Counter32 + UNITS "Packets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The total number of packets received that were + longer than 1518 octets (excluding framing bits, + but including FCS octets), and had either a bad + Frame Check Sequence (FCS) with an integral number + of octets (FCS Error) or a bad FCS with a non-integral + number of octets (Alignment Error). + + Note that this definition of jabber is different + than the definition in IEEE-802.3 section 8.2.1.5 + (10BASE5) and section 10.3.1.4 (10BASE2). These + documents define jabber as the condition where any + packet exceeds 20 ms. The allowed range to detect + jabber is between 20 ms and 150 ms." + ::= { etherStatsEntry 12 } + +etherStatsCollisions OBJECT-TYPE + SYNTAX Counter32 + UNITS "Collisions" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The best estimate of the total number of collisions + on this Ethernet segment. + + The value returned will depend on the location of the + RMON probe. Section 8.2.1.3 (10BASE-5) and section + 10.3.1.3 (10BASE-2) of IEEE standard 802.3 states that a + station must detect a collision, in the receive mode, if + three or more stations are transmitting simultaneously. A + repeater port must detect a collision when two or more + stations are transmitting simultaneously. Thus a probe + placed on a repeater port could record more collisions + than a probe connected to a station on the same segment + would. + + Probe location plays a much smaller role when considering + 10BASE-T. 14.2.1.4 (10BASE-T) of IEEE standard 802.3 + defines a collision as the simultaneous presence of signals + on the DO and RD circuits (transmitting and receiving + at the same time). A 10BASE-T station can only detect + collisions when it is transmitting. Thus probes placed on + a station and a repeater, should report the same number of + collisions. + + Note also that an RMON probe inside a repeater should + ideally report collisions between the repeater and one or + more other hosts (transmit collisions as defined by IEEE + 802.3k) plus receiver collisions observed on any coax + segments to which the repeater is connected." + ::= { etherStatsEntry 13 } + +etherStatsPkts64Octets OBJECT-TYPE + SYNTAX Counter32 + UNITS "Packets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The total number of packets (including bad + packets) received that were 64 octets in length + (excluding framing bits but including FCS octets)." + ::= { etherStatsEntry 14 } + +etherStatsPkts65to127Octets OBJECT-TYPE + SYNTAX Counter32 + UNITS "Packets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The total number of packets (including bad + packets) received that were between + 65 and 127 octets in length inclusive + (excluding framing bits but including FCS octets)." + ::= { etherStatsEntry 15 } + +etherStatsPkts128to255Octets OBJECT-TYPE + SYNTAX Counter32 + UNITS "Packets" + MAX-ACCESS read-only + + STATUS current + DESCRIPTION + "The total number of packets (including bad + packets) received that were between + 128 and 255 octets in length inclusive + (excluding framing bits but including FCS octets)." + ::= { etherStatsEntry 16 } + +etherStatsPkts256to511Octets OBJECT-TYPE + SYNTAX Counter32 + UNITS "Packets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The total number of packets (including bad + packets) received that were between + 256 and 511 octets in length inclusive + (excluding framing bits but including FCS octets)." + ::= { etherStatsEntry 17 } + +etherStatsPkts512to1023Octets OBJECT-TYPE + SYNTAX Counter32 + UNITS "Packets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The total number of packets (including bad + packets) received that were between + 512 and 1023 octets in length inclusive + (excluding framing bits but including FCS octets)." + ::= { etherStatsEntry 18 } + +etherStatsPkts1024to1518Octets OBJECT-TYPE + SYNTAX Counter32 + UNITS "Packets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The total number of packets (including bad + packets) received that were between + 1024 and 1518 octets in length inclusive + (excluding framing bits but including FCS octets)." + ::= { etherStatsEntry 19 } + +etherStatsOwner OBJECT-TYPE + SYNTAX OwnerString + MAX-ACCESS read-create + STATUS current + + DESCRIPTION + "The entity that configured this entry and is therefore + using the resources assigned to it." + ::= { etherStatsEntry 20 } + +etherStatsStatus OBJECT-TYPE + SYNTAX EntryStatus + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The status of this etherStats entry." + ::= { etherStatsEntry 21 } + +-- The History Control Group + +-- Implementation of the History Control group is optional. +-- Consult the MODULE-COMPLIANCE macro for the authoritative +-- conformance information for this MIB. +-- +-- The history control group controls the periodic statistical +-- sampling of data from various types of networks. The +-- historyControlTable stores configuration entries that each +-- define an interface, polling period, and other parameters. +-- Once samples are taken, their data is stored in an entry +-- in a media-specific table. Each such entry defines one +-- sample, and is associated with the historyControlEntry that +-- caused the sample to be taken. Each counter in the +-- etherHistoryEntry counts the same event as its similarly-named +-- counterpart in the etherStatsEntry, except that each value here +-- is a cumulative sum during a sampling period. +-- +-- If the probe keeps track of the time of day, it should start +-- the first sample of the history at a time such that +-- when the next hour of the day begins, a sample is +-- started at that instant. This tends to make more +-- user-friendly reports, and enables comparison of reports +-- from different probes that have relatively accurate time +-- of day. +-- +-- The probe is encouraged to add two history control entries +-- per monitored interface upon initialization that describe a short +-- term and a long term polling period. Suggested parameters are 30 +-- seconds for the short term polling period and 30 minutes for +-- the long term period. + +historyControlTable OBJECT-TYPE + SYNTAX SEQUENCE OF HistoryControlEntry + MAX-ACCESS not-accessible + + STATUS current + DESCRIPTION + "A list of history control entries." + ::= { history 1 } + +historyControlEntry OBJECT-TYPE + SYNTAX HistoryControlEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of parameters that set up a periodic sampling of + statistics. As an example, an instance of the + historyControlInterval object might be named + historyControlInterval.2" + INDEX { historyControlIndex } + ::= { historyControlTable 1 } + +HistoryControlEntry ::= SEQUENCE { + historyControlIndex Integer32, + historyControlDataSource OBJECT IDENTIFIER, + historyControlBucketsRequested Integer32, + historyControlBucketsGranted Integer32, + historyControlInterval Integer32, + historyControlOwner OwnerString, + historyControlStatus EntryStatus +} + +historyControlIndex OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "An index that uniquely identifies an entry in the + historyControl table. Each such entry defines a + set of samples at a particular interval for an + interface on the device." + ::= { historyControlEntry 1 } + +historyControlDataSource OBJECT-TYPE + SYNTAX OBJECT IDENTIFIER + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "This object identifies the source of the data for + which historical data was collected and + placed in a media-specific table on behalf of this + historyControlEntry. This source can be any + interface on this device. In order to identify + a particular interface, this object shall identify + the instance of the ifIndex object, defined + in RFC 2233 [17], for the desired interface. + For example, if an entry were to receive data from + interface #1, this object would be set to ifIndex.1. + + The statistics in this group reflect all packets + on the local network segment attached to the identified + interface. + + An agent may or may not be able to tell if fundamental + changes to the media of the interface have occurred and + necessitate an invalidation of this entry. For example, a + hot-pluggable ethernet card could be pulled out and replaced + by a token-ring card. In such a case, if the agent has such + knowledge of the change, it is recommended that it + invalidate this entry. + + This object may not be modified if the associated + historyControlStatus object is equal to valid(1)." + ::= { historyControlEntry 2 } + +historyControlBucketsRequested OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The requested number of discrete time intervals + over which data is to be saved in the part of the + media-specific table associated with this + historyControlEntry. + + When this object is created or modified, the probe + should set historyControlBucketsGranted as closely to + this object as is possible for the particular probe + implementation and available resources." + DEFVAL { 50 } + ::= { historyControlEntry 3 } + +historyControlBucketsGranted OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of discrete sampling intervals + over which data shall be saved in the part of + the media-specific table associated with this + historyControlEntry. + + When the associated historyControlBucketsRequested + object is created or modified, the probe + should set this object as closely to the requested + value as is possible for the particular + probe implementation and available resources. The + probe must not lower this value except as a result + of a modification to the associated + historyControlBucketsRequested object. + + There will be times when the actual number of + buckets associated with this entry is less than + the value of this object. In this case, at the + end of each sampling interval, a new bucket will + be added to the media-specific table. + + When the number of buckets reaches the value of + this object and a new bucket is to be added to the + media-specific table, the oldest bucket associated + with this historyControlEntry shall be deleted by + the agent so that the new bucket can be added. + + When the value of this object changes to a value less + than the current value, entries are deleted + from the media-specific table associated with this + historyControlEntry. Enough of the oldest of these + entries shall be deleted by the agent so that their + number remains less than or equal to the new value of + this object. + + When the value of this object changes to a value greater + than the current value, the number of associated media- + specific entries may be allowed to grow." + ::= { historyControlEntry 4 } + +historyControlInterval OBJECT-TYPE + SYNTAX Integer32 (1..3600) + UNITS "Seconds" + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The interval in seconds over which the data is + sampled for each bucket in the part of the + media-specific table associated with this + historyControlEntry. This interval can + be set to any number of seconds between 1 and + 3600 (1 hour). + + Because the counters in a bucket may overflow at their + maximum value with no indication, a prudent manager will + take into account the possibility of overflow in any of + the associated counters. It is important to consider the + minimum time in which any counter could overflow on a + particular media type and set the historyControlInterval + object to a value less than this interval. This is + typically most important for the 'octets' counter in any + media-specific table. For example, on an Ethernet + network, the etherHistoryOctets counter could overflow + in about one hour at the Ethernet's maximum + utilization. + + This object may not be modified if the associated + historyControlStatus object is equal to valid(1)." + DEFVAL { 1800 } + ::= { historyControlEntry 5 } + +historyControlOwner OBJECT-TYPE + SYNTAX OwnerString + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The entity that configured this entry and is therefore + using the resources assigned to it." + ::= { historyControlEntry 6 } + +historyControlStatus OBJECT-TYPE + SYNTAX EntryStatus + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The status of this historyControl entry. + + Each instance of the media-specific table associated + with this historyControlEntry will be deleted by the agent + if this historyControlEntry is not equal to valid(1)." + ::= { historyControlEntry 7 } + +-- The Ethernet History Group + +-- Implementation of the Ethernet History group is optional. +-- Consult the MODULE-COMPLIANCE macro for the authoritative +-- conformance information for this MIB. +-- +-- The Ethernet History group records periodic statistical samples +-- from a network and stores them for later retrieval. +-- Once samples are taken, their data is stored in an entry +-- in a media-specific table. Each such entry defines one +-- sample, and is associated with the historyControlEntry that +-- caused the sample to be taken. This group defines the +-- etherHistoryTable, for Ethernet networks. +-- + +etherHistoryTable OBJECT-TYPE + SYNTAX SEQUENCE OF EtherHistoryEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of Ethernet history entries." + ::= { history 2 } + +etherHistoryEntry OBJECT-TYPE + SYNTAX EtherHistoryEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "An historical sample of Ethernet statistics on a particular + Ethernet interface. This sample is associated with the + historyControlEntry which set up the parameters for + a regular collection of these samples. As an example, an + instance of the etherHistoryPkts object might be named + etherHistoryPkts.2.89" + INDEX { etherHistoryIndex , etherHistorySampleIndex } + ::= { etherHistoryTable 1 } + +EtherHistoryEntry ::= SEQUENCE { + etherHistoryIndex Integer32, + etherHistorySampleIndex Integer32, + etherHistoryIntervalStart TimeTicks, + etherHistoryDropEvents Counter32, + etherHistoryOctets Counter32, + etherHistoryPkts Counter32, + etherHistoryBroadcastPkts Counter32, + etherHistoryMulticastPkts Counter32, + etherHistoryCRCAlignErrors Counter32, + etherHistoryUndersizePkts Counter32, + etherHistoryOversizePkts Counter32, + etherHistoryFragments Counter32, + etherHistoryJabbers Counter32, + etherHistoryCollisions Counter32, + etherHistoryUtilization Integer32 +} + +etherHistoryIndex OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The history of which this entry is a part. The + history identified by a particular value of this + index is the same history as identified + by the same value of historyControlIndex." + ::= { etherHistoryEntry 1 } + +etherHistorySampleIndex OBJECT-TYPE + SYNTAX Integer32 (1..2147483647) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "An index that uniquely identifies the particular + sample this entry represents among all samples + associated with the same historyControlEntry. + This index starts at 1 and increases by one + as each new sample is taken." + ::= { etherHistoryEntry 2 } + +etherHistoryIntervalStart OBJECT-TYPE + SYNTAX TimeTicks + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The value of sysUpTime at the start of the interval + over which this sample was measured. If the probe + keeps track of the time of day, it should start + the first sample of the history at a time such that + when the next hour of the day begins, a sample is + started at that instant. Note that following this + rule may require the probe to delay collecting the + first sample of the history, as each sample must be + of the same interval. Also note that the sample which + is currently being collected is not accessible in this + table until the end of its interval." + ::= { etherHistoryEntry 3 } + +etherHistoryDropEvents OBJECT-TYPE + SYNTAX Counter32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The total number of events in which packets + were dropped by the probe due to lack of resources + during this sampling interval. Note that this number + is not necessarily the number of packets dropped, it + is just the number of times this condition has been + detected." + ::= { etherHistoryEntry 4 } + +etherHistoryOctets OBJECT-TYPE + SYNTAX Counter32 + UNITS "Octets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The total number of octets of data (including + those in bad packets) received on the + network (excluding framing bits but including + FCS octets)." + ::= { etherHistoryEntry 5 } + +etherHistoryPkts OBJECT-TYPE + SYNTAX Counter32 + UNITS "Packets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of packets (including bad packets) + received during this sampling interval." + ::= { etherHistoryEntry 6 } + +etherHistoryBroadcastPkts OBJECT-TYPE + SYNTAX Counter32 + UNITS "Packets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of good packets received during this + sampling interval that were directed to the + broadcast address." + ::= { etherHistoryEntry 7 } + +etherHistoryMulticastPkts OBJECT-TYPE + SYNTAX Counter32 + UNITS "Packets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of good packets received during this + sampling interval that were directed to a + multicast address. Note that this number does not + include packets addressed to the broadcast address." + ::= { etherHistoryEntry 8 } + +etherHistoryCRCAlignErrors OBJECT-TYPE + SYNTAX Counter32 + UNITS "Packets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of packets received during this + sampling interval that had a length (excluding + framing bits but including FCS octets) between + 64 and 1518 octets, inclusive, but had either a bad Frame + Check Sequence (FCS) with an integral number of octets + (FCS Error) or a bad FCS with a non-integral number + of octets (Alignment Error)." + ::= { etherHistoryEntry 9 } + +etherHistoryUndersizePkts OBJECT-TYPE + SYNTAX Counter32 + UNITS "Packets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of packets received during this + sampling interval that were less than 64 octets + long (excluding framing bits but including FCS + octets) and were otherwise well formed." + ::= { etherHistoryEntry 10 } + +etherHistoryOversizePkts OBJECT-TYPE + SYNTAX Counter32 + UNITS "Packets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of packets received during this + sampling interval that were longer than 1518 + octets (excluding framing bits but including + FCS octets) but were otherwise well formed." + ::= { etherHistoryEntry 11 } + +etherHistoryFragments OBJECT-TYPE + SYNTAX Counter32 + UNITS "Packets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The total number of packets received during this + sampling interval that were less than 64 octets in + length (excluding framing bits but including FCS + octets) had either a bad Frame Check Sequence (FCS) + with an integral number of octets (FCS Error) or a bad + FCS with a non-integral number of octets (Alignment + Error). + + Note that it is entirely normal for etherHistoryFragments to + increment. This is because it counts both runts (which are + normal occurrences due to collisions) and noise hits." + ::= { etherHistoryEntry 12 } + +etherHistoryJabbers OBJECT-TYPE + SYNTAX Counter32 + UNITS "Packets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of packets received during this + sampling interval that were longer than 1518 octets + (excluding framing bits but including FCS octets), + and had either a bad Frame Check Sequence (FCS) + with an integral number of octets (FCS Error) or + a bad FCS with a non-integral number of octets + (Alignment Error). + + Note that this definition of jabber is different + than the definition in IEEE-802.3 section 8.2.1.5 + (10BASE5) and section 10.3.1.4 (10BASE2). These + documents define jabber as the condition where any + packet exceeds 20 ms. The allowed range to detect + jabber is between 20 ms and 150 ms." + ::= { etherHistoryEntry 13 } + +etherHistoryCollisions OBJECT-TYPE + SYNTAX Counter32 + UNITS "Collisions" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The best estimate of the total number of collisions + on this Ethernet segment during this sampling + interval. + + The value returned will depend on the location of the + RMON probe. Section 8.2.1.3 (10BASE-5) and section + 10.3.1.3 (10BASE-2) of IEEE standard 802.3 states that a + station must detect a collision, in the receive mode, if + three or more stations are transmitting simultaneously. A + repeater port must detect a collision when two or more + stations are transmitting simultaneously. Thus a probe + placed on a repeater port could record more collisions + than a probe connected to a station on the same segment + would. + + Probe location plays a much smaller role when considering + 10BASE-T. 14.2.1.4 (10BASE-T) of IEEE standard 802.3 + defines a collision as the simultaneous presence of signals + on the DO and RD circuits (transmitting and receiving + at the same time). A 10BASE-T station can only detect + collisions when it is transmitting. Thus probes placed on + a station and a repeater, should report the same number of + collisions. + + Note also that an RMON probe inside a repeater should + ideally report collisions between the repeater and one or + more other hosts (transmit collisions as defined by IEEE + 802.3k) plus receiver collisions observed on any coax + segments to which the repeater is connected." + ::= { etherHistoryEntry 14 } + +etherHistoryUtilization OBJECT-TYPE + SYNTAX Integer32 (0..10000) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The best estimate of the mean physical layer + network utilization on this interface during this + sampling interval, in hundredths of a percent." + ::= { etherHistoryEntry 15 } + +-- The Alarm Group + +-- Implementation of the Alarm group is optional. The Alarm Group +-- requires the implementation of the Event group. +-- Consult the MODULE-COMPLIANCE macro for the authoritative +-- conformance information for this MIB. +-- +-- The Alarm group periodically takes statistical samples from +-- variables in the probe and compares them to thresholds that have +-- been configured. The alarm table stores configuration +-- entries that each define a variable, polling period, and +-- threshold parameters. If a sample is found to cross the +-- threshold values, an event is generated. Only variables that +-- resolve to an ASN.1 primitive type of INTEGER (INTEGER, Integer32, +-- Counter32, Counter64, Gauge32, or TimeTicks) may be monitored in +-- this way. +-- +-- This function has a hysteresis mechanism to limit the generation +-- of events. This mechanism generates one event as a threshold +-- is crossed in the appropriate direction. No more events are +-- generated for that threshold until the opposite threshold is +-- crossed. +-- +-- In the case of a sampling a deltaValue, a probe may implement +-- this mechanism with more precision if it takes a delta sample +-- twice per period, each time comparing the sum of the latest two +-- samples to the threshold. This allows the detection of threshold +-- crossings that span the sampling boundary. Note that this does +-- not require any special configuration of the threshold value. +-- It is suggested that probes implement this more precise algorithm. + +alarmTable OBJECT-TYPE + SYNTAX SEQUENCE OF AlarmEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of alarm entries." + ::= { alarm 1 } + +alarmEntry OBJECT-TYPE + SYNTAX AlarmEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of parameters that set up a periodic checking + for alarm conditions. For example, an instance of the + alarmValue object might be named alarmValue.8" + INDEX { alarmIndex } + ::= { alarmTable 1 } + +AlarmEntry ::= SEQUENCE { + alarmIndex Integer32, + alarmInterval Integer32, + alarmVariable OBJECT IDENTIFIER, + alarmSampleType INTEGER, + alarmValue Integer32, + alarmStartupAlarm INTEGER, + alarmRisingThreshold Integer32, + alarmFallingThreshold Integer32, + alarmRisingEventIndex Integer32, + alarmFallingEventIndex Integer32, + alarmOwner OwnerString, + alarmStatus EntryStatus +} + +alarmIndex OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "An index that uniquely identifies an entry in the + alarm table. Each such entry defines a + diagnostic sample at a particular interval + for an object on the device." + ::= { alarmEntry 1 } + +alarmInterval OBJECT-TYPE + SYNTAX Integer32 + UNITS "Seconds" + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The interval in seconds over which the data is + sampled and compared with the rising and falling + thresholds. When setting this variable, care + should be taken in the case of deltaValue + sampling - the interval should be set short enough + that the sampled variable is very unlikely to + increase or decrease by more than 2^31 - 1 during + a single sampling interval. + + This object may not be modified if the associated + alarmStatus object is equal to valid(1)." + ::= { alarmEntry 2 } + +alarmVariable OBJECT-TYPE + SYNTAX OBJECT IDENTIFIER + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The object identifier of the particular variable to be + sampled. Only variables that resolve to an ASN.1 primitive + type of INTEGER (INTEGER, Integer32, Counter32, Counter64, + Gauge, or TimeTicks) may be sampled. + + Because SNMP access control is articulated entirely + in terms of the contents of MIB views, no access + control mechanism exists that can restrict the value of + this object to identify only those objects that exist + in a particular MIB view. Because there is thus no + acceptable means of restricting the read access that + could be obtained through the alarm mechanism, the + probe must only grant write access to this object in + those views that have read access to all objects on + the probe. + + During a set operation, if the supplied variable name is + not available in the selected MIB view, a badValue error + must be returned. If at any time the variable name of + an established alarmEntry is no longer available in the + selected MIB view, the probe must change the status of + this alarmEntry to invalid(4). + + This object may not be modified if the associated + alarmStatus object is equal to valid(1)." + ::= { alarmEntry 3 } + +alarmSampleType OBJECT-TYPE + SYNTAX INTEGER { + absoluteValue(1), + deltaValue(2) + } + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The method of sampling the selected variable and + calculating the value to be compared against the + thresholds. If the value of this object is + absoluteValue(1), the value of the selected variable + will be compared directly with the thresholds at the + end of the sampling interval. If the value of this + object is deltaValue(2), the value of the selected + variable at the last sample will be subtracted from + the current value, and the difference compared with + the thresholds. + + This object may not be modified if the associated + alarmStatus object is equal to valid(1)." + ::= { alarmEntry 4 } + +alarmValue OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The value of the statistic during the last sampling + period. For example, if the sample type is deltaValue, + this value will be the difference between the samples + at the beginning and end of the period. If the sample + type is absoluteValue, this value will be the sampled + value at the end of the period. + This is the value that is compared with the rising and + falling thresholds. + + The value during the current sampling period is not + made available until the period is completed and will + remain available until the next period completes." + ::= { alarmEntry 5 } + +alarmStartupAlarm OBJECT-TYPE + SYNTAX INTEGER { + risingAlarm(1), + fallingAlarm(2), + risingOrFallingAlarm(3) + } + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The alarm that may be sent when this entry is first + set to valid. If the first sample after this entry + becomes valid is greater than or equal to the + risingThreshold and alarmStartupAlarm is equal to + risingAlarm(1) or risingOrFallingAlarm(3), then a single + rising alarm will be generated. If the first sample + after this entry becomes valid is less than or equal + to the fallingThreshold and alarmStartupAlarm is equal + to fallingAlarm(2) or risingOrFallingAlarm(3), then a + single falling alarm will be generated. + + This object may not be modified if the associated + alarmStatus object is equal to valid(1)." + ::= { alarmEntry 6 } + +alarmRisingThreshold OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "A threshold for the sampled statistic. When the current + sampled value is greater than or equal to this threshold, + and the value at the last sampling interval was less than + this threshold, a single event will be generated. + A single event will also be generated if the first + sample after this entry becomes valid is greater than or + equal to this threshold and the associated + alarmStartupAlarm is equal to risingAlarm(1) or + risingOrFallingAlarm(3). + + After a rising event is generated, another such event + will not be generated until the sampled value + falls below this threshold and reaches the + alarmFallingThreshold. + + This object may not be modified if the associated + alarmStatus object is equal to valid(1)." + ::= { alarmEntry 7 } + +alarmFallingThreshold OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "A threshold for the sampled statistic. When the current + sampled value is less than or equal to this threshold, + and the value at the last sampling interval was greater than + this threshold, a single event will be generated. + A single event will also be generated if the first + sample after this entry becomes valid is less than or + equal to this threshold and the associated + alarmStartupAlarm is equal to fallingAlarm(2) or + risingOrFallingAlarm(3). + + After a falling event is generated, another such event + will not be generated until the sampled value + rises above this threshold and reaches the + alarmRisingThreshold. + + This object may not be modified if the associated + alarmStatus object is equal to valid(1)." + ::= { alarmEntry 8 } + +alarmRisingEventIndex OBJECT-TYPE + SYNTAX Integer32 (0..65535) + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The index of the eventEntry that is + used when a rising threshold is crossed. The + eventEntry identified by a particular value of + this index is the same as identified by the same value + of the eventIndex object. If there is no + corresponding entry in the eventTable, then + no association exists. In particular, if this value + is zero, no associated event will be generated, as + zero is not a valid event index. + + This object may not be modified if the associated + alarmStatus object is equal to valid(1)." + ::= { alarmEntry 9 } + +alarmFallingEventIndex OBJECT-TYPE + SYNTAX Integer32 (0..65535) + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The index of the eventEntry that is + used when a falling threshold is crossed. The + eventEntry identified by a particular value of + this index is the same as identified by the same value + of the eventIndex object. If there is no + corresponding entry in the eventTable, then + no association exists. In particular, if this value + is zero, no associated event will be generated, as + zero is not a valid event index. + + This object may not be modified if the associated + alarmStatus object is equal to valid(1)." + ::= { alarmEntry 10 } + +alarmOwner OBJECT-TYPE + SYNTAX OwnerString + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The entity that configured this entry and is therefore + using the resources assigned to it." + ::= { alarmEntry 11 } + +alarmStatus OBJECT-TYPE + SYNTAX EntryStatus + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The status of this alarm entry." + ::= { alarmEntry 12 } + +-- The Host Group + +-- Implementation of the Host group is optional. +-- Consult the MODULE-COMPLIANCE macro for the authoritative +-- conformance information for this MIB. +-- +-- The host group discovers new hosts on the network by +-- keeping a list of source and destination MAC Addresses seen +-- in good packets. For each of these addresses, the host group +-- keeps a set of statistics. The hostControlTable controls +-- which interfaces this function is performed on, and contains +-- some information about the process. On behalf of each +-- hostControlEntry, data is collected on an interface and placed +-- in both the hostTable and the hostTimeTable. If the +-- monitoring device finds itself short of resources, it may +-- delete entries as needed. It is suggested that the device +-- delete the least recently used entries first. + +-- The hostTable contains entries for each address discovered on +-- a particular interface. Each entry contains statistical +-- data about that host. This table is indexed by the +-- MAC address of the host, through which a random access +-- may be achieved. + +-- The hostTimeTable contains data in the same format as the +-- hostTable, and must contain the same set of hosts, but is +-- indexed using hostTimeCreationOrder rather than hostAddress. +-- The hostTimeCreationOrder is an integer which reflects +-- the relative order in which a particular entry was discovered +-- and thus inserted into the table. As this order, and thus +-- the index, is among those entries currently in the table, +-- the index for a particular entry may change if an +-- (earlier) entry is deleted. Thus the association between +-- hostTimeCreationOrder and hostTimeEntry may be broken at +-- any time. + +-- The hostTimeTable has two important uses. The first is the +-- fast download of this potentially large table. Because the +-- index of this table runs from 1 to the size of the table, +-- inclusive, its values are predictable. This allows very +-- efficient packing of variables into SNMP PDU's and allows +-- a table transfer to have multiple packets outstanding. +-- These benefits increase transfer rates tremendously. + +-- The second use of the hostTimeTable is the efficient discovery +-- by the management station of new entries added to the table. +-- After the management station has downloaded the entire table, +-- it knows that new entries will be added immediately after the +-- end of the current table. It can thus detect new entries there +-- and retrieve them easily. + +-- Because the association between hostTimeCreationOrder and +-- hostTimeEntry may be broken at any time, the management +-- station must monitor the related hostControlLastDeleteTime +-- object. When the management station thus detects a deletion, +-- it must assume that any such associations have been broken, +-- and invalidate any it has stored locally. This includes +-- restarting any download of the hostTimeTable that may have been +-- in progress, as well as rediscovering the end of the +-- hostTimeTable so that it may detect new entries. If the +-- management station does not detect the broken association, +-- it may continue to refer to a particular host by its +-- creationOrder while unwittingly retrieving the data associated +-- with another host entirely. If this happens while downloading +-- the host table, the management station may fail to download +-- all of the entries in the table. + + +hostControlTable OBJECT-TYPE + SYNTAX SEQUENCE OF HostControlEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of host table control entries." + ::= { hosts 1 } + +hostControlEntry OBJECT-TYPE + SYNTAX HostControlEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of parameters that set up the discovery of hosts + on a particular interface and the collection of statistics + about these hosts. For example, an instance of the + hostControlTableSize object might be named + hostControlTableSize.1" + INDEX { hostControlIndex } + ::= { hostControlTable 1 } + +HostControlEntry ::= SEQUENCE { + + hostControlIndex Integer32, + hostControlDataSource OBJECT IDENTIFIER, + hostControlTableSize Integer32, + hostControlLastDeleteTime TimeTicks, + hostControlOwner OwnerString, + hostControlStatus EntryStatus +} + +hostControlIndex OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "An index that uniquely identifies an entry in the + hostControl table. Each such entry defines + a function that discovers hosts on a particular interface + and places statistics about them in the hostTable and + the hostTimeTable on behalf of this hostControlEntry." + ::= { hostControlEntry 1 } + +hostControlDataSource OBJECT-TYPE + SYNTAX OBJECT IDENTIFIER + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "This object identifies the source of the data for + this instance of the host function. This source + can be any interface on this device. In order + to identify a particular interface, this object shall + identify the instance of the ifIndex object, defined + in RFC 2233 [17], for the desired interface. + For example, if an entry were to receive data from + interface #1, this object would be set to ifIndex.1. + + The statistics in this group reflect all packets + on the local network segment attached to the identified + interface. + + An agent may or may not be able to tell if fundamental + changes to the media of the interface have occurred and + necessitate an invalidation of this entry. For example, a + hot-pluggable ethernet card could be pulled out and replaced + by a token-ring card. In such a case, if the agent has such + knowledge of the change, it is recommended that it + invalidate this entry. + + This object may not be modified if the associated + hostControlStatus object is equal to valid(1)." + ::= { hostControlEntry 2 } + +hostControlTableSize OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of hostEntries in the hostTable and the + hostTimeTable associated with this hostControlEntry." + ::= { hostControlEntry 3 } + +hostControlLastDeleteTime OBJECT-TYPE + SYNTAX TimeTicks + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The value of sysUpTime when the last entry + was deleted from the portion of the hostTable + associated with this hostControlEntry. If no + deletions have occurred, this value shall be zero." + ::= { hostControlEntry 4 } + +hostControlOwner OBJECT-TYPE + SYNTAX OwnerString + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The entity that configured this entry and is therefore + using the resources assigned to it." + ::= { hostControlEntry 5 } + +hostControlStatus OBJECT-TYPE + SYNTAX EntryStatus + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The status of this hostControl entry. + + If this object is not equal to valid(1), all associated + entries in the hostTable, hostTimeTable, and the + hostTopNTable shall be deleted by the agent." + ::= { hostControlEntry 6 } + +hostTable OBJECT-TYPE + SYNTAX SEQUENCE OF HostEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of host entries." + ::= { hosts 2 } + +hostEntry OBJECT-TYPE + SYNTAX HostEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A collection of statistics for a particular host that has + been discovered on an interface of this device. For example, + an instance of the hostOutBroadcastPkts object might be + named hostOutBroadcastPkts.1.6.8.0.32.27.3.176" + INDEX { hostIndex, hostAddress } + ::= { hostTable 1 } + +HostEntry ::= SEQUENCE { + hostAddress OCTET STRING, + hostCreationOrder Integer32, + hostIndex Integer32, + hostInPkts Counter32, + hostOutPkts Counter32, + hostInOctets Counter32, + hostOutOctets Counter32, + hostOutErrors Counter32, + hostOutBroadcastPkts Counter32, + hostOutMulticastPkts Counter32 +} + +hostAddress OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The physical address of this host." + ::= { hostEntry 1 } + +hostCreationOrder OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "An index that defines the relative ordering of + the creation time of hosts captured for a + particular hostControlEntry. This index shall + be between 1 and N, where N is the value of + the associated hostControlTableSize. The ordering + of the indexes is based on the order of each entry's + insertion into the table, in which entries added earlier + have a lower index value than entries added later. + + It is important to note that the order for a + particular entry may change as an (earlier) entry + is deleted from the table. Because this order may + change, management stations should make use of the + hostControlLastDeleteTime variable in the + hostControlEntry associated with the relevant + portion of the hostTable. By observing + this variable, the management station may detect + the circumstances where a previous association + between a value of hostCreationOrder + and a hostEntry may no longer hold." + ::= { hostEntry 2 } + +hostIndex OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The set of collected host statistics of which + this entry is a part. The set of hosts + identified by a particular value of this + index is associated with the hostControlEntry + as identified by the same value of hostControlIndex." + ::= { hostEntry 3 } + +hostInPkts OBJECT-TYPE + SYNTAX Counter32 + UNITS "Packets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of good packets transmitted to this + address since it was added to the hostTable." + ::= { hostEntry 4 } + +hostOutPkts OBJECT-TYPE + SYNTAX Counter32 + UNITS "Packets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of packets, including bad packets, transmitted + by this address since it was added to the hostTable." + ::= { hostEntry 5 } + +hostInOctets OBJECT-TYPE + SYNTAX Counter32 + UNITS "Octets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of octets transmitted to this address since + it was added to the hostTable (excluding framing + bits but including FCS octets), except for those + octets in bad packets." + ::= { hostEntry 6 } + +hostOutOctets OBJECT-TYPE + SYNTAX Counter32 + UNITS "Octets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of octets transmitted by this address since + it was added to the hostTable (excluding framing + bits but including FCS octets), including those + octets in bad packets." + ::= { hostEntry 7 } + +hostOutErrors OBJECT-TYPE + SYNTAX Counter32 + UNITS "Packets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of bad packets transmitted by this address + since this host was added to the hostTable." + ::= { hostEntry 8 } + +hostOutBroadcastPkts OBJECT-TYPE + SYNTAX Counter32 + UNITS "Packets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of good packets transmitted by this + address that were directed to the broadcast address + since this host was added to the hostTable." + ::= { hostEntry 9 } + +hostOutMulticastPkts OBJECT-TYPE + SYNTAX Counter32 + UNITS "Packets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of good packets transmitted by this + address that were directed to a multicast address + since this host was added to the hostTable. + Note that this number does not include packets + directed to the broadcast address." + ::= { hostEntry 10 } + +-- host Time Table + +hostTimeTable OBJECT-TYPE + SYNTAX SEQUENCE OF HostTimeEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of time-ordered host table entries." + ::= { hosts 3 } + +hostTimeEntry OBJECT-TYPE + SYNTAX HostTimeEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A collection of statistics for a particular host that has + been discovered on an interface of this device. This + collection includes the relative ordering of the creation + time of this object. For example, an instance of the + hostTimeOutBroadcastPkts object might be named + hostTimeOutBroadcastPkts.1.687" + INDEX { hostTimeIndex, hostTimeCreationOrder } + ::= { hostTimeTable 1 } + +HostTimeEntry ::= SEQUENCE { + hostTimeAddress OCTET STRING, + hostTimeCreationOrder Integer32, + hostTimeIndex Integer32, + hostTimeInPkts Counter32, + hostTimeOutPkts Counter32, + hostTimeInOctets Counter32, + hostTimeOutOctets Counter32, + hostTimeOutErrors Counter32, + hostTimeOutBroadcastPkts Counter32, + hostTimeOutMulticastPkts Counter32 +} + +hostTimeAddress OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The physical address of this host." + ::= { hostTimeEntry 1 } + +hostTimeCreationOrder OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "An index that uniquely identifies an entry in + the hostTime table among those entries associated + with the same hostControlEntry. This index shall + be between 1 and N, where N is the value of + the associated hostControlTableSize. The ordering + of the indexes is based on the order of each entry's + insertion into the table, in which entries added earlier + have a lower index value than entries added later. + Thus the management station has the ability to + learn of new entries added to this table without + downloading the entire table. + + It is important to note that the index for a + particular entry may change as an (earlier) entry + is deleted from the table. Because this order may + change, management stations should make use of the + hostControlLastDeleteTime variable in the + hostControlEntry associated with the relevant + portion of the hostTimeTable. By observing + this variable, the management station may detect + the circumstances where a download of the table + may have missed entries, and where a previous + association between a value of hostTimeCreationOrder + and a hostTimeEntry may no longer hold." + ::= { hostTimeEntry 2 } + +hostTimeIndex OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The set of collected host statistics of which + this entry is a part. The set of hosts + identified by a particular value of this + index is associated with the hostControlEntry + as identified by the same value of hostControlIndex." + ::= { hostTimeEntry 3 } + +hostTimeInPkts OBJECT-TYPE + SYNTAX Counter32 + UNITS "Packets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of good packets transmitted to this + address since it was added to the hostTimeTable." + ::= { hostTimeEntry 4 } + +hostTimeOutPkts OBJECT-TYPE + SYNTAX Counter32 + UNITS "Packets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of packets, including bad packets, transmitted + by this address since it was added to the hostTimeTable." + ::= { hostTimeEntry 5 } + +hostTimeInOctets OBJECT-TYPE + SYNTAX Counter32 + UNITS "Octets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of octets transmitted to this address since + it was added to the hostTimeTable (excluding framing + bits but including FCS octets), except for those + octets in bad packets." + ::= { hostTimeEntry 6 } + +hostTimeOutOctets OBJECT-TYPE + SYNTAX Counter32 + UNITS "Octets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of octets transmitted by this address since + it was added to the hostTimeTable (excluding framing + bits but including FCS octets), including those + octets in bad packets." + ::= { hostTimeEntry 7 } + +hostTimeOutErrors OBJECT-TYPE + SYNTAX Counter32 + UNITS "Packets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of bad packets transmitted by this address + since this host was added to the hostTimeTable." + ::= { hostTimeEntry 8 } + +hostTimeOutBroadcastPkts OBJECT-TYPE + SYNTAX Counter32 + UNITS "Packets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of good packets transmitted by this + address that were directed to the broadcast address + since this host was added to the hostTimeTable." + ::= { hostTimeEntry 9 } + +hostTimeOutMulticastPkts OBJECT-TYPE + SYNTAX Counter32 + UNITS "Packets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of good packets transmitted by this + address that were directed to a multicast address + since this host was added to the hostTimeTable. + Note that this number does not include packets directed + to the broadcast address." + ::= { hostTimeEntry 10 } + +-- The Host Top "N" Group + +-- Implementation of the Host Top N group is optional. The Host Top N +-- group requires the implementation of the host group. +-- Consult the MODULE-COMPLIANCE macro for the authoritative +-- conformance information for this MIB. +-- +-- The Host Top N group is used to prepare reports that describe +-- the hosts that top a list ordered by one of their statistics. +-- The available statistics are samples of one of their +-- base statistics, over an interval specified by the management +-- station. Thus, these statistics are rate based. The management +-- station also selects how many such hosts are reported. + +-- The hostTopNControlTable is used to initiate the generation of +-- such a report. The management station may select the parameters +-- of such a report, such as which interface, which statistic, +-- how many hosts, and the start and stop times of the sampling. +-- When the report is prepared, entries are created in the +-- hostTopNTable associated with the relevant hostTopNControlEntry. +-- These entries are static for each report after it has been +-- prepared. + +hostTopNControlTable OBJECT-TYPE + SYNTAX SEQUENCE OF HostTopNControlEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of top N host control entries." + ::= { hostTopN 1 } + +hostTopNControlEntry OBJECT-TYPE + SYNTAX HostTopNControlEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A set of parameters that control the creation of a report + of the top N hosts according to several metrics. For + example, an instance of the hostTopNDuration object might + be named hostTopNDuration.3" + INDEX { hostTopNControlIndex } + ::= { hostTopNControlTable 1 } + +HostTopNControlEntry ::= SEQUENCE { + hostTopNControlIndex Integer32, + hostTopNHostIndex Integer32, + hostTopNRateBase INTEGER, + hostTopNTimeRemaining Integer32, + hostTopNDuration Integer32, + hostTopNRequestedSize Integer32, + hostTopNGrantedSize Integer32, + hostTopNStartTime TimeTicks, + hostTopNOwner OwnerString, + hostTopNStatus EntryStatus +} + +hostTopNControlIndex OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "An index that uniquely identifies an entry + in the hostTopNControl table. Each such + entry defines one top N report prepared for + one interface." + ::= { hostTopNControlEntry 1 } + +hostTopNHostIndex OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The host table for which a top N report will be prepared + on behalf of this entry. The host table identified by a + particular value of this index is associated with the same + host table as identified by the same value of + hostIndex. + + This object may not be modified if the associated + hostTopNStatus object is equal to valid(1)." + ::= { hostTopNControlEntry 2 } + +hostTopNRateBase OBJECT-TYPE + SYNTAX INTEGER { + hostTopNInPkts(1), + hostTopNOutPkts(2), + hostTopNInOctets(3), + hostTopNOutOctets(4), + hostTopNOutErrors(5), + hostTopNOutBroadcastPkts(6), + hostTopNOutMulticastPkts(7) + } + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The variable for each host that the hostTopNRate + variable is based upon. + + This object may not be modified if the associated + hostTopNStatus object is equal to valid(1)." + ::= { hostTopNControlEntry 3 } + +hostTopNTimeRemaining OBJECT-TYPE + SYNTAX Integer32 + UNITS "Seconds" + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The number of seconds left in the report currently being + collected. When this object is modified by the management + station, a new collection is started, possibly aborting + a currently running report. The new value is used + as the requested duration of this report, which is + loaded into the associated hostTopNDuration object. + + When this object is set to a non-zero value, any + associated hostTopNEntries shall be made + inaccessible by the monitor. While the value of this + object is non-zero, it decrements by one per second until + it reaches zero. During this time, all associated + hostTopNEntries shall remain inaccessible. At the time + that this object decrements to zero, the report is made + accessible in the hostTopNTable. Thus, the hostTopN + table needs to be created only at the end of the collection + interval." + DEFVAL { 0 } + ::= { hostTopNControlEntry 4 } + +hostTopNDuration OBJECT-TYPE + SYNTAX Integer32 + UNITS "Seconds" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of seconds that this report has collected + during the last sampling interval, or if this + report is currently being collected, the number + of seconds that this report is being collected + during this sampling interval. + + When the associated hostTopNTimeRemaining object is set, + this object shall be set by the probe to the same value + and shall not be modified until the next time + the hostTopNTimeRemaining is set. + + This value shall be zero if no reports have been + requested for this hostTopNControlEntry." + DEFVAL { 0 } + ::= { hostTopNControlEntry 5 } + +hostTopNRequestedSize OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The maximum number of hosts requested for the top N + table. + + When this object is created or modified, the probe + should set hostTopNGrantedSize as closely to this + object as is possible for the particular probe + implementation and available resources." + DEFVAL { 10 } + ::= { hostTopNControlEntry 6 } + +hostTopNGrantedSize OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The maximum number of hosts in the top N table. + + When the associated hostTopNRequestedSize object is + created or modified, the probe should set this + object as closely to the requested value as is possible + for the particular implementation and available + resources. The probe must not lower this value except + as a result of a set to the associated + hostTopNRequestedSize object. + + Hosts with the highest value of hostTopNRate shall be + placed in this table in decreasing order of this rate + until there is no more room or until there are no more + hosts." + ::= { hostTopNControlEntry 7 } + +hostTopNStartTime OBJECT-TYPE + SYNTAX TimeTicks + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The value of sysUpTime when this top N report was + last started. In other words, this is the time that + the associated hostTopNTimeRemaining object was + modified to start the requested report." + ::= { hostTopNControlEntry 8 } + +hostTopNOwner OBJECT-TYPE + SYNTAX OwnerString + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The entity that configured this entry and is therefore + using the resources assigned to it." + ::= { hostTopNControlEntry 9 } + +hostTopNStatus OBJECT-TYPE + SYNTAX EntryStatus + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The status of this hostTopNControl entry. + + If this object is not equal to valid(1), all associated + hostTopNEntries shall be deleted by the agent." + ::= { hostTopNControlEntry 10 } + +hostTopNTable OBJECT-TYPE + SYNTAX SEQUENCE OF HostTopNEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of top N host entries." + ::= { hostTopN 2 } + +hostTopNEntry OBJECT-TYPE + SYNTAX HostTopNEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A set of statistics for a host that is part of a top N + report. For example, an instance of the hostTopNRate + object might be named hostTopNRate.3.10" + INDEX { hostTopNReport, hostTopNIndex } + ::= { hostTopNTable 1 } + +HostTopNEntry ::= SEQUENCE { + hostTopNReport Integer32, + hostTopNIndex Integer32, + hostTopNAddress OCTET STRING, + hostTopNRate Integer32 +} + +hostTopNReport OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "This object identifies the top N report of which + this entry is a part. The set of hosts + identified by a particular value of this + object is part of the same report as identified + by the same value of the hostTopNControlIndex object." + ::= { hostTopNEntry 1 } + +hostTopNIndex OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "An index that uniquely identifies an entry in + the hostTopN table among those in the same report. + This index is between 1 and N, where N is the + number of entries in this table. Increasing values + of hostTopNIndex shall be assigned to entries with + decreasing values of hostTopNRate until index N + is assigned to the entry with the lowest value of + hostTopNRate or there are no more hostTopNEntries." + ::= { hostTopNEntry 2 } + +hostTopNAddress OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The physical address of this host." + ::= { hostTopNEntry 3 } + +hostTopNRate OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The amount of change in the selected variable + during this sampling interval. The selected + variable is this host's instance of the object + selected by hostTopNRateBase." + ::= { hostTopNEntry 4 } + +-- The Matrix Group + +-- Implementation of the Matrix group is optional. +-- Consult the MODULE-COMPLIANCE macro for the authoritative +-- conformance information for this MIB. +-- +-- The Matrix group consists of the matrixControlTable, matrixSDTable +-- and the matrixDSTable. These tables store statistics for a +-- particular conversation between two addresses. As the device +-- detects a new conversation, including those to a non-unicast +-- address, it creates a new entry in both of the matrix tables. +-- It must only create new entries based on information +-- received in good packets. If the monitoring device finds +-- itself short of resources, it may delete entries as needed. +-- It is suggested that the device delete the least recently used +-- entries first. + +matrixControlTable OBJECT-TYPE + SYNTAX SEQUENCE OF MatrixControlEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of information entries for the + traffic matrix on each interface." + ::= { matrix 1 } + +matrixControlEntry OBJECT-TYPE + SYNTAX MatrixControlEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Information about a traffic matrix on a particular + interface. For example, an instance of the + matrixControlLastDeleteTime object might be named + matrixControlLastDeleteTime.1" + INDEX { matrixControlIndex } + ::= { matrixControlTable 1 } + +MatrixControlEntry ::= SEQUENCE { + matrixControlIndex Integer32, + matrixControlDataSource OBJECT IDENTIFIER, + matrixControlTableSize Integer32, + matrixControlLastDeleteTime TimeTicks, + matrixControlOwner OwnerString, + matrixControlStatus EntryStatus +} + +matrixControlIndex OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "An index that uniquely identifies an entry in the + matrixControl table. Each such entry defines + a function that discovers conversations on a particular + interface and places statistics about them in the + matrixSDTable and the matrixDSTable on behalf of this + matrixControlEntry." + ::= { matrixControlEntry 1 } + +matrixControlDataSource OBJECT-TYPE + SYNTAX OBJECT IDENTIFIER + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "This object identifies the source of + the data from which this entry creates a traffic matrix. + This source can be any interface on this device. In + order to identify a particular interface, this object + shall identify the instance of the ifIndex object, + defined in RFC 2233 [17], for the desired + interface. For example, if an entry were to receive data + from interface #1, this object would be set to ifIndex.1. + + The statistics in this group reflect all packets + on the local network segment attached to the identified + interface. + + An agent may or may not be able to tell if fundamental + changes to the media of the interface have occurred and + necessitate an invalidation of this entry. For example, a + hot-pluggable ethernet card could be pulled out and replaced + by a token-ring card. In such a case, if the agent has such + knowledge of the change, it is recommended that it + invalidate this entry. + + This object may not be modified if the associated + matrixControlStatus object is equal to valid(1)." + ::= { matrixControlEntry 2 } + +matrixControlTableSize OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of matrixSDEntries in the matrixSDTable + for this interface. This must also be the value of + the number of entries in the matrixDSTable for this + interface." + ::= { matrixControlEntry 3 } + +matrixControlLastDeleteTime OBJECT-TYPE + SYNTAX TimeTicks + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The value of sysUpTime when the last entry + was deleted from the portion of the matrixSDTable + or matrixDSTable associated with this matrixControlEntry. + If no deletions have occurred, this value shall be + zero." + ::= { matrixControlEntry 4 } + +matrixControlOwner OBJECT-TYPE + SYNTAX OwnerString + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The entity that configured this entry and is therefore + using the resources assigned to it." + ::= { matrixControlEntry 5 } + +matrixControlStatus OBJECT-TYPE + SYNTAX EntryStatus + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The status of this matrixControl entry. + If this object is not equal to valid(1), all associated + entries in the matrixSDTable and the matrixDSTable + shall be deleted by the agent." + ::= { matrixControlEntry 6 } + +matrixSDTable OBJECT-TYPE + SYNTAX SEQUENCE OF MatrixSDEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of traffic matrix entries indexed by + source and destination MAC address." + ::= { matrix 2 } + +matrixSDEntry OBJECT-TYPE + SYNTAX MatrixSDEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A collection of statistics for communications between + two addresses on a particular interface. For example, + an instance of the matrixSDPkts object might be named + matrixSDPkts.1.6.8.0.32.27.3.176.6.8.0.32.10.8.113" + INDEX { matrixSDIndex, + matrixSDSourceAddress, matrixSDDestAddress } + ::= { matrixSDTable 1 } + +MatrixSDEntry ::= SEQUENCE { + matrixSDSourceAddress OCTET STRING, + matrixSDDestAddress OCTET STRING, + matrixSDIndex Integer32, + matrixSDPkts Counter32, + matrixSDOctets Counter32, + matrixSDErrors Counter32 +} + +matrixSDSourceAddress OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The source physical address." + ::= { matrixSDEntry 1 } + +matrixSDDestAddress OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The destination physical address." + ::= { matrixSDEntry 2 } + +matrixSDIndex OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The set of collected matrix statistics of which + this entry is a part. The set of matrix statistics + identified by a particular value of this index + is associated with the same matrixControlEntry + as identified by the same value of matrixControlIndex." + ::= { matrixSDEntry 3 } + +matrixSDPkts OBJECT-TYPE + SYNTAX Counter32 + UNITS "Packets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of packets transmitted from the source + address to the destination address (this number includes + bad packets)." + ::= { matrixSDEntry 4 } + +matrixSDOctets OBJECT-TYPE + SYNTAX Counter32 + UNITS "Octets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of octets (excluding framing bits but + including FCS octets) contained in all packets + transmitted from the source address to the + destination address." + ::= { matrixSDEntry 5 } + +matrixSDErrors OBJECT-TYPE + SYNTAX Counter32 + UNITS "Packets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of bad packets transmitted from + the source address to the destination address." + ::= { matrixSDEntry 6 } + +-- Traffic matrix tables from destination to source + +matrixDSTable OBJECT-TYPE + SYNTAX SEQUENCE OF MatrixDSEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of traffic matrix entries indexed by + destination and source MAC address." + ::= { matrix 3 } + +matrixDSEntry OBJECT-TYPE + SYNTAX MatrixDSEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A collection of statistics for communications between + two addresses on a particular interface. For example, + an instance of the matrixSDPkts object might be named + matrixSDPkts.1.6.8.0.32.10.8.113.6.8.0.32.27.3.176" + INDEX { matrixDSIndex, + matrixDSDestAddress, matrixDSSourceAddress } + ::= { matrixDSTable 1 } + +MatrixDSEntry ::= SEQUENCE { + matrixDSSourceAddress OCTET STRING, + matrixDSDestAddress OCTET STRING, + matrixDSIndex Integer32, + matrixDSPkts Counter32, + matrixDSOctets Counter32, + matrixDSErrors Counter32 +} + +matrixDSSourceAddress OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The source physical address." + ::= { matrixDSEntry 1 } + +matrixDSDestAddress OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The destination physical address." + ::= { matrixDSEntry 2 } + +matrixDSIndex OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The set of collected matrix statistics of which + this entry is a part. The set of matrix statistics + identified by a particular value of this index + is associated with the same matrixControlEntry + as identified by the same value of matrixControlIndex." + ::= { matrixDSEntry 3 } + +matrixDSPkts OBJECT-TYPE + SYNTAX Counter32 + UNITS "Packets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of packets transmitted from the source + address to the destination address (this number includes + bad packets)." + ::= { matrixDSEntry 4 } + +matrixDSOctets OBJECT-TYPE + SYNTAX Counter32 + UNITS "Octets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of octets (excluding framing bits + but including FCS octets) contained in all packets + transmitted from the source address to the + destination address." + ::= { matrixDSEntry 5 } + +matrixDSErrors OBJECT-TYPE + SYNTAX Counter32 + UNITS "Packets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of bad packets transmitted from + the source address to the destination address." + ::= { matrixDSEntry 6 } + +-- The Filter Group + +-- Implementation of the Filter group is optional. +-- Consult the MODULE-COMPLIANCE macro for the authoritative +-- conformance information for this MIB. +-- +-- The Filter group allows packets to be captured with an +-- arbitrary filter expression. A logical data and +-- event stream or "channel" is formed by the packets +-- that match the filter expression. +-- +-- This filter mechanism allows the creation of an arbitrary +-- logical expression with which to filter packets. Each +-- filter associated with a channel is OR'ed with the others. +-- Within a filter, any bits checked in the data and status are +-- AND'ed with respect to other bits in the same filter. The +-- NotMask also allows for checking for inequality. Finally, +-- the channelAcceptType object allows for inversion of the +-- whole equation. +-- +-- If a management station wishes to receive a trap to alert it +-- that new packets have been captured and are available for +-- download, it is recommended that it set up an alarm entry that +-- monitors the value of the relevant channelMatches instance. +-- +-- The channel can be turned on or off, and can also +-- generate events when packets pass through it. + +filterTable OBJECT-TYPE + SYNTAX SEQUENCE OF FilterEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of packet filter entries." + ::= { filter 1 } + +filterEntry OBJECT-TYPE + SYNTAX FilterEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A set of parameters for a packet filter applied on a + particular interface. As an example, an instance of the + filterPktData object might be named filterPktData.12" + INDEX { filterIndex } + ::= { filterTable 1 } + +FilterEntry ::= SEQUENCE { + filterIndex Integer32, + filterChannelIndex Integer32, + filterPktDataOffset Integer32, + filterPktData OCTET STRING, + filterPktDataMask OCTET STRING, + filterPktDataNotMask OCTET STRING, + filterPktStatus Integer32, + filterPktStatusMask Integer32, + filterPktStatusNotMask Integer32, + filterOwner OwnerString, + filterStatus EntryStatus +} + +filterIndex OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "An index that uniquely identifies an entry + in the filter table. Each such entry defines + one filter that is to be applied to every packet + received on an interface." + ::= { filterEntry 1 } + +filterChannelIndex OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "This object identifies the channel of which this filter + is a part. The filters identified by a particular value + of this object are associated with the same channel as + identified by the same value of the channelIndex object." + ::= { filterEntry 2 } + +filterPktDataOffset OBJECT-TYPE + SYNTAX Integer32 + UNITS "Octets" + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The offset from the beginning of each packet where + a match of packet data will be attempted. This offset + is measured from the point in the physical layer + packet after the framing bits, if any. For example, + in an Ethernet frame, this point is at the beginning of + the destination MAC address. + + This object may not be modified if the associated + filterStatus object is equal to valid(1)." + DEFVAL { 0 } + + ::= { filterEntry 3 } + +filterPktData OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The data that is to be matched with the input packet. + For each packet received, this filter and the accompanying + filterPktDataMask and filterPktDataNotMask will be + adjusted for the offset. The only bits relevant to this + match algorithm are those that have the corresponding + filterPktDataMask bit equal to one. The following three + rules are then applied to every packet: + + (1) If the packet is too short and does not have data + corresponding to part of the filterPktData, the packet + will fail this data match. + + (2) For each relevant bit from the packet with the + corresponding filterPktDataNotMask bit set to zero, if + the bit from the packet is not equal to the corresponding + bit from the filterPktData, then the packet will fail + this data match. + + (3) If for every relevant bit from the packet with the + corresponding filterPktDataNotMask bit set to one, the + bit from the packet is equal to the corresponding bit + from the filterPktData, then the packet will fail this + data match. + + Any packets that have not failed any of the three matches + above have passed this data match. In particular, a zero + length filter will match any packet. + + This object may not be modified if the associated + filterStatus object is equal to valid(1)." + ::= { filterEntry 4 } + +filterPktDataMask OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The mask that is applied to the match process. + After adjusting this mask for the offset, only those + bits in the received packet that correspond to bits set + in this mask are relevant for further processing by the + match algorithm. The offset is applied to filterPktDataMask + in the same way it is applied to the filter. For the + purposes of the matching algorithm, if the associated + filterPktData object is longer than this mask, this mask is + conceptually extended with '1' bits until it reaches the + length of the filterPktData object. + + This object may not be modified if the associated + filterStatus object is equal to valid(1)." + ::= { filterEntry 5 } + +filterPktDataNotMask OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The inversion mask that is applied to the match + process. After adjusting this mask for the offset, + those relevant bits in the received packet that correspond + to bits cleared in this mask must all be equal to their + corresponding bits in the filterPktData object for the packet + to be accepted. In addition, at least one of those relevant + bits in the received packet that correspond to bits set in + this mask must be different to its corresponding bit in the + filterPktData object. + + For the purposes of the matching algorithm, if the associated + filterPktData object is longer than this mask, this mask is + conceptually extended with '0' bits until it reaches the + length of the filterPktData object. + + This object may not be modified if the associated + filterStatus object is equal to valid(1)." + ::= { filterEntry 6 } + +filterPktStatus OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The status that is to be matched with the input packet. + The only bits relevant to this match algorithm are those that + have the corresponding filterPktStatusMask bit equal to one. + The following two rules are then applied to every packet: + + (1) For each relevant bit from the packet status with the + corresponding filterPktStatusNotMask bit set to zero, if + the bit from the packet status is not equal to the + corresponding bit from the filterPktStatus, then the + packet will fail this status match. + + (2) If for every relevant bit from the packet status with the + corresponding filterPktStatusNotMask bit set to one, the + bit from the packet status is equal to the corresponding + bit from the filterPktStatus, then the packet will fail + this status match. + + Any packets that have not failed either of the two matches + above have passed this status match. In particular, a zero + length status filter will match any packet's status. + + The value of the packet status is a sum. This sum + initially takes the value zero. Then, for each + error, E, that has been discovered in this packet, + 2 raised to a value representing E is added to the sum. + The errors and the bits that represent them are dependent + on the media type of the interface that this channel + is receiving packets from. + + The errors defined for a packet captured off of an + Ethernet interface are as follows: + + bit # Error + 0 Packet is longer than 1518 octets + 1 Packet is shorter than 64 octets + 2 Packet experienced a CRC or Alignment error + + For example, an Ethernet fragment would have a + value of 6 (2^1 + 2^2). + + As this MIB is expanded to new media types, this object + will have other media-specific errors defined. + + For the purposes of this status matching algorithm, if the + packet status is longer than this filterPktStatus object, + this object is conceptually extended with '0' bits until it + reaches the size of the packet status. + + This object may not be modified if the associated + filterStatus object is equal to valid(1)." + ::= { filterEntry 7 } + +filterPktStatusMask OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The mask that is applied to the status match process. + Only those bits in the received packet that correspond to + bits set in this mask are relevant for further processing + by the status match algorithm. For the purposes + of the matching algorithm, if the associated filterPktStatus + object is longer than this mask, this mask is conceptually + extended with '1' bits until it reaches the size of the + filterPktStatus. In addition, if a packet status is longer + than this mask, this mask is conceptually extended with '0' + bits until it reaches the size of the packet status. + + This object may not be modified if the associated + filterStatus object is equal to valid(1)." + ::= { filterEntry 8 } + +filterPktStatusNotMask OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The inversion mask that is applied to the status match + process. Those relevant bits in the received packet status + that correspond to bits cleared in this mask must all be + equal to their corresponding bits in the filterPktStatus + object for the packet to be accepted. In addition, at least + one of those relevant bits in the received packet status + that correspond to bits set in this mask must be different + to its corresponding bit in the filterPktStatus object for + the packet to be accepted. + + For the purposes of the matching algorithm, if the associated + filterPktStatus object or a packet status is longer than this + mask, this mask is conceptually extended with '0' bits until + it reaches the longer of the lengths of the filterPktStatus + object and the packet status. + + This object may not be modified if the associated + filterStatus object is equal to valid(1)." + ::= { filterEntry 9 } + +filterOwner OBJECT-TYPE + SYNTAX OwnerString + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The entity that configured this entry and is therefore + using the resources assigned to it." + ::= { filterEntry 10 } + +filterStatus OBJECT-TYPE + SYNTAX EntryStatus + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The status of this filter entry." + ::= { filterEntry 11 } + +channelTable OBJECT-TYPE + SYNTAX SEQUENCE OF ChannelEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of packet channel entries." + ::= { filter 2 } + +channelEntry OBJECT-TYPE + SYNTAX ChannelEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A set of parameters for a packet channel applied on a + particular interface. As an example, an instance of the + channelMatches object might be named channelMatches.3" + INDEX { channelIndex } + ::= { channelTable 1 } + +ChannelEntry ::= SEQUENCE { + channelIndex Integer32, + channelIfIndex Integer32, + channelAcceptType INTEGER, + channelDataControl INTEGER, + channelTurnOnEventIndex Integer32, + channelTurnOffEventIndex Integer32, + channelEventIndex Integer32, + channelEventStatus INTEGER, + channelMatches Counter32, + channelDescription DisplayString, + channelOwner OwnerString, + channelStatus EntryStatus +} + +channelIndex OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "An index that uniquely identifies an entry in the channel + table. Each such entry defines one channel, a logical + data and event stream. + + It is suggested that before creating a channel, an + application should scan all instances of the + filterChannelIndex object to make sure that there are no + pre-existing filters that would be inadvertently be linked + to the channel." + ::= { channelEntry 1 } + +channelIfIndex OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The value of this object uniquely identifies the + interface on this remote network monitoring device to which + the associated filters are applied to allow data into this + channel. The interface identified by a particular value + of this object is the same interface as identified by the + same value of the ifIndex object, defined in RFC 2233 [17]. + + The filters in this group are applied to all packets on + the local network segment attached to the identified + interface. + + An agent may or may not be able to tell if fundamental + changes to the media of the interface have occurred and + necessitate an invalidation of this entry. For example, a + hot-pluggable ethernet card could be pulled out and replaced + by a token-ring card. In such a case, if the agent has such + knowledge of the change, it is recommended that it + invalidate this entry. + + This object may not be modified if the associated + channelStatus object is equal to valid(1)." + ::= { channelEntry 2 } + +channelAcceptType OBJECT-TYPE + SYNTAX INTEGER { + acceptMatched(1), + acceptFailed(2) + } + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "This object controls the action of the filters + associated with this channel. If this object is equal + to acceptMatched(1), packets will be accepted to this + channel if they are accepted by both the packet data and + packet status matches of an associated filter. If + this object is equal to acceptFailed(2), packets will + be accepted to this channel only if they fail either + the packet data match or the packet status match of + each of the associated filters. + + In particular, a channel with no associated filters will + match no packets if set to acceptMatched(1) case and will + match all packets in the acceptFailed(2) case. + + This object may not be modified if the associated + channelStatus object is equal to valid(1)." + ::= { channelEntry 3 } + +channelDataControl OBJECT-TYPE + SYNTAX INTEGER { + on(1), + off(2) + } + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "This object controls the flow of data through this channel. + If this object is on(1), data, status and events flow + through this channel. If this object is off(2), data, + status and events will not flow through this channel." + DEFVAL { off } + ::= { channelEntry 4 } + +channelTurnOnEventIndex OBJECT-TYPE + SYNTAX Integer32 (0..65535) + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The value of this object identifies the event + that is configured to turn the associated + channelDataControl from off to on when the event is + generated. The event identified by a particular value + of this object is the same event as identified by the + same value of the eventIndex object. If there is no + corresponding entry in the eventTable, then no + association exists. In fact, if no event is intended + for this channel, channelTurnOnEventIndex must be + set to zero, a non-existent event index. + + This object may not be modified if the associated + channelStatus object is equal to valid(1)." + ::= { channelEntry 5 } + +channelTurnOffEventIndex OBJECT-TYPE + SYNTAX Integer32 (0..65535) + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The value of this object identifies the event + that is configured to turn the associated + channelDataControl from on to off when the event is + generated. The event identified by a particular value + of this object is the same event as identified by the + same value of the eventIndex object. If there is no + corresponding entry in the eventTable, then no + association exists. In fact, if no event is intended + for this channel, channelTurnOffEventIndex must be + set to zero, a non-existent event index. + + This object may not be modified if the associated + channelStatus object is equal to valid(1)." + ::= { channelEntry 6 } + +channelEventIndex OBJECT-TYPE + SYNTAX Integer32 (0..65535) + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The value of this object identifies the event + that is configured to be generated when the + associated channelDataControl is on and a packet + is matched. The event identified by a particular value + of this object is the same event as identified by the + same value of the eventIndex object. If there is no + corresponding entry in the eventTable, then no + association exists. In fact, if no event is intended + for this channel, channelEventIndex must be + set to zero, a non-existent event index. + + This object may not be modified if the associated + channelStatus object is equal to valid(1)." + ::= { channelEntry 7 } + +channelEventStatus OBJECT-TYPE + SYNTAX INTEGER { + eventReady(1), + eventFired(2), + eventAlwaysReady(3) + } + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The event status of this channel. + + If this channel is configured to generate events + when packets are matched, a means of controlling + the flow of those events is often needed. When + this object is equal to eventReady(1), a single + event may be generated, after which this object + will be set by the probe to eventFired(2). While + in the eventFired(2) state, no events will be + generated until the object is modified to + eventReady(1) (or eventAlwaysReady(3)). The + management station can thus easily respond to a + notification of an event by re-enabling this object. + + If the management station wishes to disable this + flow control and allow events to be generated + at will, this object may be set to + eventAlwaysReady(3). Disabling the flow control + is discouraged as it can result in high network + traffic or other performance problems." + DEFVAL { eventReady } + ::= { channelEntry 8 } + +channelMatches OBJECT-TYPE + SYNTAX Counter32 + UNITS "Packets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of times this channel has matched a packet. + Note that this object is updated even when + channelDataControl is set to off." + ::= { channelEntry 9 } + +channelDescription OBJECT-TYPE + SYNTAX DisplayString (SIZE (0..127)) + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "A comment describing this channel." + ::= { channelEntry 10 } + +channelOwner OBJECT-TYPE + SYNTAX OwnerString + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The entity that configured this entry and is therefore + using the resources assigned to it." + ::= { channelEntry 11 } + +channelStatus OBJECT-TYPE + SYNTAX EntryStatus + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The status of this channel entry." + ::= { channelEntry 12 } + +-- The Packet Capture Group + +-- Implementation of the Packet Capture group is optional. The Packet +-- Capture Group requires implementation of the Filter Group. +-- Consult the MODULE-COMPLIANCE macro for the authoritative +-- conformance information for this MIB. +-- +-- The Packet Capture group allows packets to be captured +-- upon a filter match. The bufferControlTable controls +-- the captured packets output from a channel that is +-- associated with it. The captured packets are placed +-- in entries in the captureBufferTable. These entries are +-- associated with the bufferControlEntry on whose behalf they +-- were stored. + +bufferControlTable OBJECT-TYPE + SYNTAX SEQUENCE OF BufferControlEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of buffers control entries." + ::= { capture 1 } + +bufferControlEntry OBJECT-TYPE + SYNTAX BufferControlEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A set of parameters that control the collection of a stream + of packets that have matched filters. As an example, an + instance of the bufferControlCaptureSliceSize object might + be named bufferControlCaptureSliceSize.3" + + INDEX { bufferControlIndex } + ::= { bufferControlTable 1 } + +BufferControlEntry ::= SEQUENCE { + bufferControlIndex Integer32, + bufferControlChannelIndex Integer32, + bufferControlFullStatus INTEGER, + bufferControlFullAction INTEGER, + bufferControlCaptureSliceSize Integer32, + bufferControlDownloadSliceSize Integer32, + bufferControlDownloadOffset Integer32, + bufferControlMaxOctetsRequested Integer32, + bufferControlMaxOctetsGranted Integer32, + bufferControlCapturedPackets Integer32, + bufferControlTurnOnTime TimeTicks, + bufferControlOwner OwnerString, + bufferControlStatus EntryStatus +} + +bufferControlIndex OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "An index that uniquely identifies an entry + in the bufferControl table. The value of this + index shall never be zero. Each such + entry defines one set of packets that is + captured and controlled by one or more filters." + ::= { bufferControlEntry 1 } + +bufferControlChannelIndex OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "An index that identifies the channel that is the + source of packets for this bufferControl table. + The channel identified by a particular value of this + index is the same as identified by the same value of + the channelIndex object. + + This object may not be modified if the associated + bufferControlStatus object is equal to valid(1)." + ::= { bufferControlEntry 2 } + +bufferControlFullStatus OBJECT-TYPE + SYNTAX INTEGER { + spaceAvailable(1), + full(2) + } + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "This object shows whether the buffer has room to + accept new packets or if it is full. + + If the status is spaceAvailable(1), the buffer is + accepting new packets normally. If the status is + full(2) and the associated bufferControlFullAction + object is wrapWhenFull, the buffer is accepting new + packets by deleting enough of the oldest packets + to make room for new ones as they arrive. Otherwise, + if the status is full(2) and the + bufferControlFullAction object is lockWhenFull, + then the buffer has stopped collecting packets. + + When this object is set to full(2) the probe must + not later set it to spaceAvailable(1) except in the + case of a significant gain in resources such as + an increase of bufferControlOctetsGranted. In + particular, the wrap-mode action of deleting old + packets to make room for newly arrived packets + must not affect the value of this object." + ::= { bufferControlEntry 3 } + +bufferControlFullAction OBJECT-TYPE + SYNTAX INTEGER { + lockWhenFull(1), + wrapWhenFull(2) -- FIFO + } + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "Controls the action of the buffer when it + reaches the full status. When in the lockWhenFull(1) + state and a packet is added to the buffer that + fills the buffer, the bufferControlFullStatus will + be set to full(2) and this buffer will stop capturing + packets." + ::= { bufferControlEntry 4 } + +bufferControlCaptureSliceSize OBJECT-TYPE + SYNTAX Integer32 + UNITS "Octets" + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The maximum number of octets of each packet + that will be saved in this capture buffer. + For example, if a 1500 octet packet is received by + the probe and this object is set to 500, then only + 500 octets of the packet will be stored in the + associated capture buffer. If this variable is set + to 0, the capture buffer will save as many octets + as is possible. + + This object may not be modified if the associated + bufferControlStatus object is equal to valid(1)." + DEFVAL { 100 } + ::= { bufferControlEntry 5 } + +bufferControlDownloadSliceSize OBJECT-TYPE + SYNTAX Integer32 + UNITS "Octets" + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The maximum number of octets of each packet + in this capture buffer that will be returned in + an SNMP retrieval of that packet. For example, + if 500 octets of a packet have been stored in the + associated capture buffer, the associated + bufferControlDownloadOffset is 0, and this + object is set to 100, then the captureBufferPacket + object that contains the packet will contain only + the first 100 octets of the packet. + + A prudent manager will take into account possible + interoperability or fragmentation problems that may + occur if the download slice size is set too large. + In particular, conformant SNMP implementations are not + required to accept messages whose length exceeds 484 + octets, although they are encouraged to support larger + datagrams whenever feasible." + DEFVAL { 100 } + ::= { bufferControlEntry 6 } + +bufferControlDownloadOffset OBJECT-TYPE + SYNTAX Integer32 + UNITS "Octets" + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The offset of the first octet of each packet + in this capture buffer that will be returned in + an SNMP retrieval of that packet. For example, + if 500 octets of a packet have been stored in the + associated capture buffer and this object is set to + 100, then the captureBufferPacket object that + contains the packet will contain bytes starting + 100 octets into the packet." + DEFVAL { 0 } + ::= { bufferControlEntry 7 } + +bufferControlMaxOctetsRequested OBJECT-TYPE + SYNTAX Integer32 + UNITS "Octets" + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The requested maximum number of octets to be + saved in this captureBuffer, including any + implementation-specific overhead. If this variable + is set to -1, the capture buffer will save as many + octets as is possible. + + When this object is created or modified, the probe + should set bufferControlMaxOctetsGranted as closely + to this object as is possible for the particular probe + implementation and available resources. However, if + the object has the special value of -1, the probe + must set bufferControlMaxOctetsGranted to -1." + DEFVAL { -1 } + ::= { bufferControlEntry 8 } + +bufferControlMaxOctetsGranted OBJECT-TYPE + SYNTAX Integer32 + UNITS "Octets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The maximum number of octets that can be + saved in this captureBuffer, including overhead. + If this variable is -1, the capture buffer will save + as many octets as possible. + + When the bufferControlMaxOctetsRequested object is + created or modified, the probe should set this object + as closely to the requested value as is possible for the + particular probe implementation and available resources. + However, if the request object has the special value + of -1, the probe must set this object to -1. + + The probe must not lower this value except as a result of + a modification to the associated + bufferControlMaxOctetsRequested object. + + When this maximum number of octets is reached + and a new packet is to be added to this + capture buffer and the corresponding + bufferControlFullAction is set to wrapWhenFull(2), + enough of the oldest packets associated with this + capture buffer shall be deleted by the agent so + that the new packet can be added. If the corresponding + bufferControlFullAction is set to lockWhenFull(1), + the new packet shall be discarded. In either case, + the probe must set bufferControlFullStatus to + full(2). + + When the value of this object changes to a value less + than the current value, entries are deleted from + the captureBufferTable associated with this + bufferControlEntry. Enough of the + oldest of these captureBufferEntries shall be + deleted by the agent so that the number of octets + used remains less than or equal to the new value of + this object. + + When the value of this object changes to a value greater + than the current value, the number of associated + captureBufferEntries may be allowed to grow." + ::= { bufferControlEntry 9 } + +bufferControlCapturedPackets OBJECT-TYPE + SYNTAX Integer32 + UNITS "Packets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of packets currently in this captureBuffer." + ::= { bufferControlEntry 10 } + +bufferControlTurnOnTime OBJECT-TYPE + SYNTAX TimeTicks + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The value of sysUpTime when this capture buffer was + first turned on." + ::= { bufferControlEntry 11 } + +bufferControlOwner OBJECT-TYPE + SYNTAX OwnerString + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The entity that configured this entry and is therefore + using the resources assigned to it." + ::= { bufferControlEntry 12 } + +bufferControlStatus OBJECT-TYPE + SYNTAX EntryStatus + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The status of this buffer Control Entry." + ::= { bufferControlEntry 13 } + +captureBufferTable OBJECT-TYPE + SYNTAX SEQUENCE OF CaptureBufferEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of packets captured off of a channel." + ::= { capture 2 } + +captureBufferEntry OBJECT-TYPE + SYNTAX CaptureBufferEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A packet captured off of an attached network. As an + example, an instance of the captureBufferPacketData + object might be named captureBufferPacketData.3.1783" + INDEX { captureBufferControlIndex, captureBufferIndex } + ::= { captureBufferTable 1 } + +CaptureBufferEntry ::= SEQUENCE { + captureBufferControlIndex Integer32, + captureBufferIndex Integer32, + captureBufferPacketID Integer32, + captureBufferPacketData OCTET STRING, + captureBufferPacketLength Integer32, + captureBufferPacketTime Integer32, + captureBufferPacketStatus Integer32 +} + +captureBufferControlIndex OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The index of the bufferControlEntry with which + this packet is associated." + ::= { captureBufferEntry 1 } + +captureBufferIndex OBJECT-TYPE + SYNTAX Integer32 (1..2147483647) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "An index that uniquely identifies an entry + in the captureBuffer table associated with a + particular bufferControlEntry. This index will + start at 1 and increase by one for each new packet + added with the same captureBufferControlIndex. + + Should this value reach 2147483647, the next packet + added with the same captureBufferControlIndex shall + cause this value to wrap around to 1." + ::= { captureBufferEntry 2 } + +captureBufferPacketID OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "An index that describes the order of packets + that are received on a particular interface. + The packetID of a packet captured on an + interface is defined to be greater than the + packetID's of all packets captured previously on + the same interface. As the captureBufferPacketID + object has a maximum positive value of 2^31 - 1, + any captureBufferPacketID object shall have the + value of the associated packet's packetID mod 2^31." + ::= { captureBufferEntry 3 } + +captureBufferPacketData OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The data inside the packet, starting at the beginning + of the packet plus any offset specified in the + associated bufferControlDownloadOffset, including any + link level headers. The length of the data in this object + is the minimum of the length of the captured packet minus + the offset, the length of the associated + bufferControlCaptureSliceSize minus the offset, and the + associated bufferControlDownloadSliceSize. If this minimum + is less than zero, this object shall have a length of zero." + ::= { captureBufferEntry 4 } + +captureBufferPacketLength OBJECT-TYPE + SYNTAX Integer32 + UNITS "Octets" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The actual length (off the wire) of the packet stored + in this entry, including FCS octets." + ::= { captureBufferEntry 5 } + +captureBufferPacketTime OBJECT-TYPE + SYNTAX Integer32 + UNITS "Milliseconds" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of milliseconds that had passed since + this capture buffer was first turned on when this + packet was captured." + ::= { captureBufferEntry 6 } + +captureBufferPacketStatus OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "A value which indicates the error status of this packet. + + The value of this object is defined in the same way as + filterPktStatus. The value is a sum. This sum + initially takes the value zero. Then, for each + error, E, that has been discovered in this packet, + 2 raised to a value representing E is added to the sum. + + The errors defined for a packet captured off of an + Ethernet interface are as follows: + + bit # Error + 0 Packet is longer than 1518 octets + 1 Packet is shorter than 64 octets + 2 Packet experienced a CRC or Alignment error + 3 First packet in this capture buffer after + it was detected that some packets were + not processed correctly. + 4 Packet's order in buffer is only approximate + (May only be set for packets sent from + the probe) + + For example, an Ethernet fragment would have a + value of 6 (2^1 + 2^2). + + As this MIB is expanded to new media types, this object + will have other media-specific errors defined." + ::= { captureBufferEntry 7 } + +-- The Event Group + +-- Implementation of the Event group is optional. +-- Consult the MODULE-COMPLIANCE macro for the authoritative +-- conformance information for this MIB. +-- +-- The Event group controls the generation and notification +-- of events from this device. Each entry in the eventTable +-- describes the parameters of the event that can be triggered. +-- Each event entry is fired by an associated condition located +-- elsewhere in the MIB. An event entry may also be associated +-- with a function elsewhere in the MIB that will be executed +-- when the event is generated. For example, a channel may +-- be turned on or off by the firing of an event. +-- +-- Each eventEntry may optionally specify that a log entry +-- be created on its behalf whenever the event occurs. +-- Each entry may also specify that notification should +-- occur by way of SNMP trap messages. In this case, the +-- community for the trap message is given in the associated +-- eventCommunity object. The enterprise and specific trap +-- fields of the trap are determined by the condition that +-- triggered the event. Two traps are defined: risingAlarm and +-- fallingAlarm. If the eventTable is triggered by a condition +-- specified elsewhere, the enterprise and specific trap fields +-- must be specified for traps generated for that condition. + +eventTable OBJECT-TYPE + SYNTAX SEQUENCE OF EventEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of events to be generated." + ::= { event 1 } + +eventEntry OBJECT-TYPE + SYNTAX EventEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A set of parameters that describe an event to be generated + when certain conditions are met. As an example, an instance + of the eventLastTimeSent object might be named + eventLastTimeSent.6" + INDEX { eventIndex } + ::= { eventTable 1 } + +EventEntry ::= SEQUENCE { + eventIndex Integer32, + eventDescription DisplayString, + eventType INTEGER, + eventCommunity OCTET STRING, + eventLastTimeSent TimeTicks, + eventOwner OwnerString, + eventStatus EntryStatus +} + +eventIndex OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "An index that uniquely identifies an entry in the + event table. Each such entry defines one event that + is to be generated when the appropriate conditions + occur." + ::= { eventEntry 1 } + +eventDescription OBJECT-TYPE + SYNTAX DisplayString (SIZE (0..127)) + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "A comment describing this event entry." + ::= { eventEntry 2 } + +eventType OBJECT-TYPE + SYNTAX INTEGER { + none(1), + log(2), + snmptrap(3), -- send an SNMP trap + logandtrap(4) + } + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The type of notification that the probe will make + about this event. In the case of log, an entry is + made in the log table for each event. In the case of + snmp-trap, an SNMP trap is sent to one or more + management stations." + ::= { eventEntry 3 } + +eventCommunity OBJECT-TYPE + SYNTAX OCTET STRING (SIZE (0..127)) + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "If an SNMP trap is to be sent, it will be sent to + the SNMP community specified by this octet string." + ::= { eventEntry 4 } + +eventLastTimeSent OBJECT-TYPE + SYNTAX TimeTicks + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The value of sysUpTime at the time this event + entry last generated an event. If this entry has + not generated any events, this value will be + zero." + ::= { eventEntry 5 } + +eventOwner OBJECT-TYPE + SYNTAX OwnerString + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The entity that configured this entry and is therefore + using the resources assigned to it. + + If this object contains a string starting with 'monitor' + and has associated entries in the log table, all connected + management stations should retrieve those log entries, + as they may have significance to all management stations + connected to this device" + ::= { eventEntry 6 } + +eventStatus OBJECT-TYPE + SYNTAX EntryStatus + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The status of this event entry. + + If this object is not equal to valid(1), all associated + log entries shall be deleted by the agent." + ::= { eventEntry 7 } + +-- +logTable OBJECT-TYPE + SYNTAX SEQUENCE OF LogEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of events that have been logged." + ::= { event 2 } + +logEntry OBJECT-TYPE + SYNTAX LogEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A set of data describing an event that has been + logged. For example, an instance of the logDescription + object might be named logDescription.6.47" + INDEX { logEventIndex, logIndex } + ::= { logTable 1 } + +LogEntry ::= SEQUENCE { + logEventIndex Integer32, + logIndex Integer32, + logTime TimeTicks, + logDescription DisplayString +} + +logEventIndex OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The event entry that generated this log + entry. The log identified by a particular + value of this index is associated with the same + eventEntry as identified by the same value + of eventIndex." + ::= { logEntry 1 } + +logIndex OBJECT-TYPE + SYNTAX Integer32 (1..2147483647) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "An index that uniquely identifies an entry + in the log table amongst those generated by the + same eventEntries. These indexes are + assigned beginning with 1 and increase by one + with each new log entry. The association + between values of logIndex and logEntries + is fixed for the lifetime of each logEntry. + The agent may choose to delete the oldest + instances of logEntry as required because of + lack of memory. It is an implementation-specific + matter as to when this deletion may occur." + ::= { logEntry 2 } + +logTime OBJECT-TYPE + SYNTAX TimeTicks + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The value of sysUpTime when this log entry was created." + ::= { logEntry 3 } + +logDescription OBJECT-TYPE + SYNTAX DisplayString (SIZE (0..255)) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "An implementation dependent description of the + event that activated this log entry." + ::= { logEntry 4 } + +-- Remote Network Monitoring Traps + +rmonEventsV2 OBJECT-IDENTITY + STATUS current + DESCRIPTION "Definition point for RMON notifications." + ::= { rmon 0 } + +risingAlarm NOTIFICATION-TYPE + OBJECTS { alarmIndex, alarmVariable, alarmSampleType, + alarmValue, alarmRisingThreshold } + STATUS current + DESCRIPTION + "The SNMP trap that is generated when an alarm + entry crosses its rising threshold and generates + an event that is configured for sending SNMP + traps." + ::= { rmonEventsV2 1 } + +fallingAlarm NOTIFICATION-TYPE + OBJECTS { alarmIndex, alarmVariable, alarmSampleType, + alarmValue, alarmFallingThreshold } + STATUS current + DESCRIPTION + "The SNMP trap that is generated when an alarm + entry crosses its falling threshold and generates + an event that is configured for sending SNMP + traps." + ::= { rmonEventsV2 2 } + +-- Conformance information + +rmonCompliances OBJECT IDENTIFIER ::= { rmonConformance 9 } +rmonGroups OBJECT IDENTIFIER ::= { rmonConformance 10 } + +-- Compliance Statements +rmonCompliance MODULE-COMPLIANCE + STATUS current + DESCRIPTION + "The requirements for conformance to the RMON MIB. At least + one of the groups in this module must be implemented to + conform to the RMON MIB. Implementations of this MIB + must also implement the system group of MIB-II [16] and the + IF-MIB [17]." + MODULE -- this module + + GROUP rmonEtherStatsGroup + DESCRIPTION + "The RMON Ethernet Statistics Group is optional." + + GROUP rmonHistoryControlGroup + DESCRIPTION + "The RMON History Control Group is optional." + + GROUP rmonEthernetHistoryGroup + DESCRIPTION + "The RMON Ethernet History Group is optional." + + GROUP rmonAlarmGroup + DESCRIPTION + "The RMON Alarm Group is optional." + + GROUP rmonHostGroup + DESCRIPTION + "The RMON Host Group is mandatory when the + rmonHostTopNGroup is implemented." + + GROUP rmonHostTopNGroup + DESCRIPTION + "The RMON Host Top N Group is optional." + + GROUP rmonMatrixGroup + DESCRIPTION + "The RMON Matrix Group is optional." + + GROUP rmonFilterGroup + DESCRIPTION + "The RMON Filter Group is mandatory when the + rmonPacketCaptureGroup is implemented." + + GROUP rmonPacketCaptureGroup + DESCRIPTION + "The RMON Packet Capture Group is optional." + + GROUP rmonEventGroup + DESCRIPTION + "The RMON Event Group is mandatory when the + rmonAlarmGroup is implemented." + ::= { rmonCompliances 1 } + + rmonEtherStatsGroup OBJECT-GROUP + OBJECTS { + etherStatsIndex, etherStatsDataSource, + etherStatsDropEvents, etherStatsOctets, etherStatsPkts, + etherStatsBroadcastPkts, etherStatsMulticastPkts, + etherStatsCRCAlignErrors, etherStatsUndersizePkts, + etherStatsOversizePkts, etherStatsFragments, + etherStatsJabbers, etherStatsCollisions, + etherStatsPkts64Octets, etherStatsPkts65to127Octets, + etherStatsPkts128to255Octets, + etherStatsPkts256to511Octets, + etherStatsPkts512to1023Octets, + etherStatsPkts1024to1518Octets, + etherStatsOwner, etherStatsStatus + } + STATUS current + DESCRIPTION + "The RMON Ethernet Statistics Group." + ::= { rmonGroups 1 } + + rmonHistoryControlGroup OBJECT-GROUP + OBJECTS { + historyControlIndex, historyControlDataSource, + historyControlBucketsRequested, + historyControlBucketsGranted, historyControlInterval, + historyControlOwner, historyControlStatus + } + STATUS current + DESCRIPTION + "The RMON History Control Group." + ::= { rmonGroups 2 } + + rmonEthernetHistoryGroup OBJECT-GROUP + OBJECTS { + etherHistoryIndex, etherHistorySampleIndex, + etherHistoryIntervalStart, etherHistoryDropEvents, + etherHistoryOctets, etherHistoryPkts, + etherHistoryBroadcastPkts, etherHistoryMulticastPkts, + etherHistoryCRCAlignErrors, etherHistoryUndersizePkts, + etherHistoryOversizePkts, etherHistoryFragments, + etherHistoryJabbers, etherHistoryCollisions, + etherHistoryUtilization + } + STATUS current + DESCRIPTION + "The RMON Ethernet History Group." + ::= { rmonGroups 3 } + + rmonAlarmGroup OBJECT-GROUP + OBJECTS { + alarmIndex, alarmInterval, alarmVariable, + alarmSampleType, alarmValue, alarmStartupAlarm, + alarmRisingThreshold, alarmFallingThreshold, + alarmRisingEventIndex, alarmFallingEventIndex, + alarmOwner, alarmStatus + } + STATUS current + DESCRIPTION + "The RMON Alarm Group." + ::= { rmonGroups 4 } + + rmonHostGroup OBJECT-GROUP + OBJECTS { + hostControlIndex, hostControlDataSource, + hostControlTableSize, hostControlLastDeleteTime, + hostControlOwner, hostControlStatus, + hostAddress, hostCreationOrder, hostIndex, + hostInPkts, hostOutPkts, hostInOctets, + hostOutOctets, hostOutErrors, hostOutBroadcastPkts, + hostOutMulticastPkts, hostTimeAddress, + hostTimeCreationOrder, hostTimeIndex, + hostTimeInPkts, hostTimeOutPkts, hostTimeInOctets, + hostTimeOutOctets, hostTimeOutErrors, + hostTimeOutBroadcastPkts, hostTimeOutMulticastPkts + } + STATUS current + DESCRIPTION + "The RMON Host Group." + ::= { rmonGroups 5 } + + rmonHostTopNGroup OBJECT-GROUP + OBJECTS { + hostTopNControlIndex, hostTopNHostIndex, + hostTopNRateBase, hostTopNTimeRemaining, + hostTopNDuration, hostTopNRequestedSize, + hostTopNGrantedSize, hostTopNStartTime, + hostTopNOwner, hostTopNStatus, + hostTopNReport, hostTopNIndex, + hostTopNAddress, hostTopNRate + } + STATUS current + DESCRIPTION + "The RMON Host Top 'N' Group." + ::= { rmonGroups 6 } + + rmonMatrixGroup OBJECT-GROUP + OBJECTS { + matrixControlIndex, matrixControlDataSource, + matrixControlTableSize, matrixControlLastDeleteTime, + matrixControlOwner, matrixControlStatus, + matrixSDSourceAddress, matrixSDDestAddress, + matrixSDIndex, matrixSDPkts, + matrixSDOctets, matrixSDErrors, + matrixDSSourceAddress, matrixDSDestAddress, + matrixDSIndex, matrixDSPkts, + matrixDSOctets, matrixDSErrors + } + STATUS current + DESCRIPTION + "The RMON Matrix Group." + ::= { rmonGroups 7 } + + rmonFilterGroup OBJECT-GROUP + OBJECTS { + filterIndex, filterChannelIndex, filterPktDataOffset, + filterPktData, filterPktDataMask, + filterPktDataNotMask, filterPktStatus, + filterPktStatusMask, filterPktStatusNotMask, + filterOwner, filterStatus, + channelIndex, channelIfIndex, channelAcceptType, + channelDataControl, channelTurnOnEventIndex, + channelTurnOffEventIndex, channelEventIndex, + channelEventStatus, channelMatches, + channelDescription, channelOwner, channelStatus + } + STATUS current + DESCRIPTION + "The RMON Filter Group." + ::= { rmonGroups 8 } + + rmonPacketCaptureGroup OBJECT-GROUP + OBJECTS { + bufferControlIndex, bufferControlChannelIndex, + bufferControlFullStatus, bufferControlFullAction, + bufferControlCaptureSliceSize, + bufferControlDownloadSliceSize, + bufferControlDownloadOffset, + bufferControlMaxOctetsRequested, + bufferControlMaxOctetsGranted, + bufferControlCapturedPackets, + bufferControlTurnOnTime, + bufferControlOwner, bufferControlStatus, + captureBufferControlIndex, captureBufferIndex, + captureBufferPacketID, captureBufferPacketData, + captureBufferPacketLength, captureBufferPacketTime, + captureBufferPacketStatus + } + STATUS current + DESCRIPTION + "The RMON Packet Capture Group." + ::= { rmonGroups 9 } + + rmonEventGroup OBJECT-GROUP + OBJECTS { + eventIndex, eventDescription, eventType, + eventCommunity, eventLastTimeSent, + eventOwner, eventStatus, + logEventIndex, logIndex, logTime, + logDescription + } + STATUS current + DESCRIPTION + "The RMON Event Group." + ::= { rmonGroups 10 } + + rmonNotificationGroup NOTIFICATION-GROUP + NOTIFICATIONS { risingAlarm, fallingAlarm } + STATUS current + DESCRIPTION + "The RMON Notification Group." + ::= { rmonGroups 11 } +END diff --git a/lib/snmp/vsn.mk b/lib/snmp/vsn.mk index fb1dcb6c41..36b9764bc8 100644 --- a/lib/snmp/vsn.mk +++ b/lib/snmp/vsn.mk @@ -18,6 +18,6 @@ # %CopyrightEnd% APPLICATION = snmp -SNMP_VSN = 4.21.7 +SNMP_VSN = 4.22 PRE_VSN = APP_VSN = "$(APPLICATION)-$(SNMP_VSN)$(PRE_VSN)" diff --git a/lib/stdlib/test/edlin_expand_SUITE.erl b/lib/stdlib/test/edlin_expand_SUITE.erl index a0e198ce09..f8d4fb4b6a 100644 --- a/lib/stdlib/test/edlin_expand_SUITE.erl +++ b/lib/stdlib/test/edlin_expand_SUITE.erl @@ -46,10 +46,10 @@ groups() -> []. init_per_suite(Config) -> - true = code:delete(expand_test), - true = code:delete(expand_test1), - true = code:delete('ExpandTestCaps'), - true = code:delete('ExpandTestCaps1'), + (catch code:delete(expand_test)), + (catch code:delete(expand_test1)), + (catch code:delete('ExpandTestCaps')), + (catch code:delete('ExpandTestCaps1')), Config. end_per_suite(_Config) -> diff --git a/lib/stdlib/test/io_proto_SUITE.erl b/lib/stdlib/test/io_proto_SUITE.erl index b69cd74edb..0b74d04b85 100644 --- a/lib/stdlib/test/io_proto_SUITE.erl +++ b/lib/stdlib/test/io_proto_SUITE.erl @@ -50,7 +50,7 @@ -define(privdir(Conf), ?config(priv_dir, Conf)). -endif. --define(debug, true). +%%-define(debug, true). -ifdef(debug). -define(format(S, A), io:format(S, A)). diff --git a/lib/stdlib/test/qlc_SUITE.erl b/lib/stdlib/test/qlc_SUITE.erl index 50a76cdfb5..1e74ad7727 100644 --- a/lib/stdlib/test/qlc_SUITE.erl +++ b/lib/stdlib/test/qlc_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2011. All Rights Reserved. +%% Copyright Ericsson AB 2004-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -7927,15 +7927,23 @@ run_test(Config, Extra, {cres, Body, Opts, ExpectedCompileReturn}) -> ok end, + wait_for_expected(R, Before, SourceFile, true), + code:purge(Mod); +run_test(Config, Extra, Body) -> + run_test(Config, Extra, {cres,Body,[]}). + +wait_for_expected(R, Before, SourceFile, Wait) -> Ms = erlang:process_info(self(),messages), After = {get(), pps(), ets:all(), Ms}, - code:purge(Mod), case {R, After} of - {ok, Before} -> ok; - _ -> expected({ok,Before}, {R,After}, SourceFile) - end; -run_test(Config, Extra, Body) -> - run_test(Config, Extra, {cres,Body,[]}). + {ok, Before} -> + ok; + _ when Wait -> + timer:sleep(1000), + wait_for_expected(R, Before, SourceFile, false); + _ -> + expected({ok,Before}, {R,After}, SourceFile) + end. unload_pt() -> erlang:garbage_collect(), % get rid of references to qlc_pt... diff --git a/lib/test_server/src/test_server_ctrl.erl b/lib/test_server/src/test_server_ctrl.erl index 50720a45c8..79c45de071 100644 --- a/lib/test_server/src/test_server_ctrl.erl +++ b/lib/test_server/src/test_server_ctrl.erl @@ -650,8 +650,8 @@ init([Param]) -> contact_main_target(local) -> %% When used by a general framework, global registration of %% test_server should not be required. - case os:getenv("TEST_SERVER_FRAMEWORK") of - FW when FW =:= false; FW =:= "undefined" -> + case get_fw_mod(undefined) of + undefined -> %% Local target! The global test_server process implemented by %% test_server.erl will not be started, so we simulate it by %% globally registering this process instead. @@ -1381,6 +1381,18 @@ init_tester(Mod, Func, Args, Dir, Name, {SumLev,MajLev,MinLev}, put(test_server_create_priv_dir, CreatePrivDir), put(test_server_random_seed, proplists:get_value(random_seed, ExtraTools)), put(test_server_testcase_callback, TCCallback), + case os:getenv("TEST_SERVER_FRAMEWORK") of + FW when FW =:= false; FW =:= "undefined" -> + put(test_server_framework, '$none'); + FW -> + put(test_server_framework_name, list_to_atom(FW)), + case os:getenv("TEST_SERVER_FRAMEWORK_NAME") of + FWName when FWName =:= false; FWName =:= "undefined" -> + put(test_server_framework_name, '$none'); + FWName -> + put(test_server_framework_name, list_to_atom(FWName)) + end + end, %% before first print, read and set logging options LogOpts = test_server_sup:framework_call(get_logopts, [], []), put(test_server_logopts, LogOpts), @@ -1700,11 +1712,7 @@ do_test_cases(TopCases, SkipCases, Config, TimetrapData) when is_list(TopCases), is_tuple(TimetrapData) -> {ok,TestDir} = start_log_file(), - FwMod = - case os:getenv("TEST_SERVER_FRAMEWORK") of - FW when FW =:= false; FW =:= "undefined" -> ?MODULE; - FW -> list_to_atom(FW) - end, + FwMod = get_fw_mod(?MODULE), case collect_all_cases(TopCases, SkipCases) of {error,Why} -> print(1, "Error starting: ~p", [Why]), @@ -2129,17 +2137,17 @@ add_init_and_end_per_suite([{make,_,_}=Case|Cases], LastMod, LastRef, FwMod) -> add_init_and_end_per_suite([{skip_case,{{Mod,all},_}}=Case|Cases], LastMod, LastRef, FwMod) when Mod =/= LastMod -> {PreCases, NextMod, NextRef} = - do_add_end_per_suite_and_skip(LastMod, LastRef, Mod), + do_add_end_per_suite_and_skip(LastMod, LastRef, Mod, FwMod), PreCases ++ [Case|add_init_and_end_per_suite(Cases, NextMod, NextRef, FwMod)]; add_init_and_end_per_suite([{skip_case,{{Mod,_},_}}=Case|Cases], LastMod, LastRef, FwMod) when Mod =/= LastMod -> {PreCases, NextMod, NextRef} = - do_add_init_and_end_per_suite(LastMod, LastRef, Mod), + do_add_init_and_end_per_suite(LastMod, LastRef, Mod, FwMod), PreCases ++ [Case|add_init_and_end_per_suite(Cases, NextMod, NextRef, FwMod)]; add_init_and_end_per_suite([{skip_case,{conf,_,{Mod,_},_}}=Case|Cases], LastMod, LastRef, FwMod) when Mod =/= LastMod -> {PreCases, NextMod, NextRef} = - do_add_init_and_end_per_suite(LastMod, LastRef, Mod), + do_add_init_and_end_per_suite(LastMod, LastRef, Mod, FwMod), PreCases ++ [Case|add_init_and_end_per_suite(Cases, NextMod, NextRef, FwMod)]; add_init_and_end_per_suite([{skip_case,_}=Case|Cases], LastMod, LastRef, FwMod) -> [Case|add_init_and_end_per_suite(Cases, LastMod, LastRef, FwMod)]; @@ -2151,7 +2159,7 @@ add_init_and_end_per_suite([{conf,Ref,Props,{FwMod,Func}}=Case|Cases], LastMod, case proplists:get_value(suite, Props) of Suite when Suite =/= undefined, Suite =/= LastMod -> {PreCases, NextMod, NextRef} = - do_add_init_and_end_per_suite(LastMod, LastRef, Suite), + do_add_init_and_end_per_suite(LastMod, LastRef, Suite, FwMod), Case1 = {conf,Ref,proplists:delete(suite,Props),{FwMod,Func}}, PreCases ++ [Case1|add_init_and_end_per_suite(Cases, NextMod, NextRef, FwMod)]; @@ -2161,19 +2169,19 @@ add_init_and_end_per_suite([{conf,Ref,Props,{FwMod,Func}}=Case|Cases], LastMod, add_init_and_end_per_suite([{conf,_,_,{Mod,_}}=Case|Cases], LastMod, LastRef, FwMod) when Mod =/= LastMod, Mod =/= FwMod -> {PreCases, NextMod, NextRef} = - do_add_init_and_end_per_suite(LastMod, LastRef, Mod), + do_add_init_and_end_per_suite(LastMod, LastRef, Mod, FwMod), PreCases ++ [Case|add_init_and_end_per_suite(Cases, NextMod, NextRef, FwMod)]; add_init_and_end_per_suite([{conf,_,_,_}=Case|Cases], LastMod, LastRef, FwMod) -> [Case|add_init_and_end_per_suite(Cases, LastMod, LastRef, FwMod)]; add_init_and_end_per_suite([{Mod,_}=Case|Cases], LastMod, LastRef, FwMod) when Mod =/= LastMod, Mod =/= FwMod -> {PreCases, NextMod, NextRef} = - do_add_init_and_end_per_suite(LastMod, LastRef, Mod), + do_add_init_and_end_per_suite(LastMod, LastRef, Mod, FwMod), PreCases ++ [Case|add_init_and_end_per_suite(Cases, NextMod, NextRef, FwMod)]; add_init_and_end_per_suite([{Mod,_,_}=Case|Cases], LastMod, LastRef, FwMod) when Mod =/= LastMod, Mod =/= FwMod -> {PreCases, NextMod, NextRef} = - do_add_init_and_end_per_suite(LastMod, LastRef, Mod), + do_add_init_and_end_per_suite(LastMod, LastRef, Mod, FwMod), PreCases ++ [Case|add_init_and_end_per_suite(Cases, NextMod, NextRef, FwMod)]; add_init_and_end_per_suite([Case|Cases], LastMod, LastRef, FwMod)-> [Case|add_init_and_end_per_suite(Cases, LastMod, LastRef, FwMod)]; @@ -2181,10 +2189,23 @@ add_init_and_end_per_suite([], _LastMod, undefined, _FwMod) -> []; add_init_and_end_per_suite([], _LastMod, skipped_suite, _FwMod) -> []; -add_init_and_end_per_suite([], LastMod, LastRef, _FwMod) -> - [{conf,LastRef,[],{LastMod,end_per_suite}}]. +add_init_and_end_per_suite([], LastMod, LastRef, FwMod) -> + %% we'll add end_per_suite here even if it's not exported + %% (and simply let the call fail if it's missing) + case erlang:function_exported(LastMod, end_per_suite, 1) of + true -> + [{conf,LastRef,[],{LastMod,end_per_suite}}]; + false -> + %% let's call a "fake" end_per_suite if it exists + case erlang:function_exported(FwMod, end_per_suite, 1) of + true -> + [{conf,LastRef,[{suite,LastMod}],{FwMod,end_per_suite}}]; + false -> + [{conf,LastRef,[],{LastMod,end_per_suite}}] + end + end. -do_add_init_and_end_per_suite(LastMod, LastRef, Mod) -> +do_add_init_and_end_per_suite(LastMod, LastRef, Mod, FwMod) -> case code:is_loaded(Mod) of false -> code:load_file(Mod); _ -> ok @@ -2195,7 +2216,16 @@ do_add_init_and_end_per_suite(LastMod, LastRef, Mod) -> Ref = make_ref(), {[{conf,Ref,[],{Mod,init_per_suite}}],Mod,Ref}; false -> - {[],Mod,undefined} + %% let's call a "fake" init_per_suite if it exists + case erlang:function_exported(FwMod, init_per_suite, 1) of + true -> + Ref = make_ref(), + {[{conf,Ref,[{suite,Mod}], + {FwMod,init_per_suite}}],Mod,Ref}; + false -> + {[],Mod,undefined} + end + end, Cases = if LastRef==undefined -> @@ -2203,20 +2233,44 @@ do_add_init_and_end_per_suite(LastMod, LastRef, Mod) -> LastRef==skipped_suite -> Init; true -> - %% Adding end_per_suite here without checking if the - %% function is actually exported. This is because a - %% conf case must have an end case - so if it doesn't - %% exist, it will only fail... - [{conf,LastRef,[],{LastMod,end_per_suite}}|Init] + %% we'll add end_per_suite here even if it's not exported + %% (and simply let the call fail if it's missing) + case erlang:function_exported(LastMod, end_per_suite, 1) of + true -> + [{conf,LastRef,[],{LastMod,end_per_suite}}|Init]; + false -> + %% let's call a "fake" end_per_suite if it exists + case erlang:function_exported(FwMod, end_per_suite, 1) of + true -> + [{conf,LastRef,[{suite,Mod}], + {FwMod,end_per_suite}}|Init]; + false -> + [{conf,LastRef,[],{LastMod,end_per_suite}}|Init] + end + end end, {Cases,NextMod,NextRef}. -do_add_end_per_suite_and_skip(LastMod, LastRef, Mod) -> +do_add_end_per_suite_and_skip(LastMod, LastRef, Mod, FwMod) -> case LastRef of No when No==undefined ; No==skipped_suite -> {[],Mod,skipped_suite}; _Ref -> - {[{conf,LastRef,[],{LastMod,end_per_suite}}],Mod,skipped_suite} + case erlang:function_exported(LastMod, end_per_suite, 1) of + true -> + {[{conf,LastRef,[],{LastMod,end_per_suite}}], + Mod,skipped_suite}; + false -> + case erlang:function_exported(FwMod, end_per_suite, 1) of + true -> + %% let's call "fake" end_per_suite if it exists + {[{conf,LastRef,[],{FwMod,end_per_suite}}], + Mod,skipped_suite}; + false -> + {[{conf,LastRef,[],{LastMod,end_per_suite}}], + Mod,skipped_suite} + end + end end. @@ -2794,7 +2848,8 @@ run_test_cases_loop([{conf,Ref,Props,{Mod,Func}}|_Cases]=Cs0, end, Mode0), update_config(hd(Config), TSDirs ++ [{tc_group_path,GroupPath} | CfgProps]) - end, + end, + CurrMode = curr_mode(Ref, Mode0, Mode), ConfCaseResult = run_test_case(Ref, 0, Mod, Func, [ActualCfg], skip_init, target, TimetrapData, CurrMode), @@ -3289,7 +3344,7 @@ skip_case1(Type, CaseNum, Mod, Func, Comment, Mode) -> print(major, "=started ~s", [lists:flatten(timestamp_get(""))]), print(major, "=result skipped: ~s", [Comment1]), print(2,"*** Skipping test case #~w ~p ***", [CaseNum,{Mod,Func}]), - TR = xhtml("<tr valign=\"top\">", ["<tr class=\"",odd_or_even(),"\">"]), + TR = xhtml("<tr valign=\"top\">", ["<tr class=\"",odd_or_even(),"\">"]), GroupName = case get_name(Mode) of undefined -> ""; Name -> cast_to_list(Name) @@ -3303,7 +3358,7 @@ skip_case1(Type, CaseNum, Mod, Func, Comment, Mode) -> "<td>" ++ Col0 ++ "0.000s" ++ Col1 ++ "</td>" "<td><font color=\"~s\">SKIPPED</font></td>" "<td>~s</td></tr>\n", - [num2str(CaseNum),Mod,GroupName,Func,ResultCol,Comment1]), + [num2str(CaseNum),fw_name(Mod),GroupName,Func,ResultCol,Comment1]), if CaseNum > 0 -> {US,AS} = get(test_server_skipped), case Type of @@ -3742,7 +3797,8 @@ run_test_case1(Ref, Num, Mod, Func, Args, RunInit, Where, "<td>" ++ Col0 ++ "~s" ++ Col1 ++ "</td>" "<td><a href=\"~s\">~p</a></td>" "<td><a href=\"~s#top\"><</a> <a href=\"~s#end\">></a></td>", - [num2str(Num),Mod,GroupName,MinorBase,Func,MinorBase,MinorBase]), + [num2str(Num),fw_name(Mod),GroupName,MinorBase,Func, + MinorBase,MinorBase]), do_if_parallel(Main, ok, fun erlang:yield/0), %% run the test case @@ -4189,6 +4245,46 @@ progress(ok, _CaseNum, Mod, Func, _Loc, RetVal, Time, %%-------------------------------------------------------------------- %% various help functions +get_fw_mod(Mod) -> + case get(test_server_framework) of + undefined -> + case os:getenv("TEST_SERVER_FRAMEWORK") of + FW when FW =:= false; FW =:= "undefined" -> + Mod; + FW -> + list_to_atom(FW) + end; + '$none' -> Mod; + FW -> FW + end. + +fw_name(?MODULE) -> + test_server; +fw_name(Mod) -> + case get(test_server_framework_name) of + undefined -> + case get_fw_mod(undefined) of + undefined -> + Mod; + Mod -> + case os:getenv("TEST_SERVER_FRAMEWORK_NAME") of + FWName when FWName =:= false; FWName =:= "undefined" -> + Mod; + FWName -> + list_to_atom(FWName) + end; + _ -> + Mod + end; + '$none' -> + Mod; + FWName -> + case get_fw_mod(Mod) of + Mod -> FWName; + _ -> Mod + end + end. + if_auto_skip(Reason={failed,{_,init_per_testcase,_}}, True, _False) -> {Reason,True()}; if_auto_skip({_T,{skip,Reason={failed,{_,init_per_testcase,_}}},_Opts}, True, _False) -> @@ -4292,8 +4388,8 @@ get_font_style1(default) -> %% set to false. format_exception(Reason={_Error,Stack}) when is_list(Stack) -> - case os:getenv("TEST_SERVER_FRAMEWORK") of - FW when FW =:= false; FW =:= "undefined" -> + case get_fw_mod(undefined) of + undefined -> case application:get_env(test_server, format_exception) of {ok,false} -> {"~p",Reason}; @@ -4301,7 +4397,7 @@ format_exception(Reason={_Error,Stack}) when is_list(Stack) -> do_format_exception(Reason) end; FW -> - case application:get_env(list_to_atom(FW), format_exception) of + case application:get_env(FW, format_exception) of {ok,false} -> {"~p",Reason}; _ -> @@ -4897,8 +4993,8 @@ collect_case([Case | Cases], St, Acc) -> collect_case(Cases, NewSt, Acc ++ FlatCases). collect_case_invoke(Mod, Case, MFA, St) -> - case os:getenv("TEST_SERVER_FRAMEWORK") of - FW when FW =:= false; FW =:= "undefined" -> + case get_fw_mod(undefined) of + undefined -> case catch apply(Mod, Case, [suite]) of {'EXIT',_} -> {ok,[MFA],St}; @@ -4906,7 +5002,9 @@ collect_case_invoke(Mod, Case, MFA, St) -> collect_subcases(Mod, Case, MFA, St, Suite) end; _ -> - Suite = test_server_sup:framework_call(get_suite, [?pl2a(Mod),Case], []), + Suite = test_server_sup:framework_call(get_suite, + [?pl2a(Mod),Case], + []), collect_subcases(Mod, Case, MFA, St, Suite) end. diff --git a/lib/wx/api_gen/gl_gen.erl b/lib/wx/api_gen/gl_gen.erl index ce0cb922e9..331ba32ba4 100644 --- a/lib/wx/api_gen/gl_gen.erl +++ b/lib/wx/api_gen/gl_gen.erl @@ -190,14 +190,17 @@ parse_define([#xmlElement{name=initializer,content=[#xmlText{value=V}]}|_],Def,_ try case Val0 of "0x" ++ Val1 -> - Val = http_util:hexlist_to_integer(Val1), - Def#def{val=Val, type=hex}; + _ = http_util:hexlist_to_integer(Val1), + Def#def{val=Val1, type=hex}; _ -> Val = list_to_integer(Val0), Def#def{val=Val, type=int} end - catch _:_ -> - Def#def{val=Val0, type=string} + catch _:_ -> + case catch list_to_float(Val0) of + {'EXIT', _} -> Def#def{val=Val0, type=string}; + _ -> Def#def{val=Val0, type=float_str} + end end; parse_define([_|R], D, Opts) -> parse_define(R, D, Opts); diff --git a/lib/wx/api_gen/gl_gen_erl.erl b/lib/wx/api_gen/gl_gen_erl.erl index f77b2d8e24..25f89e4ad4 100644 --- a/lib/wx/api_gen/gl_gen_erl.erl +++ b/lib/wx/api_gen/gl_gen_erl.erl @@ -54,8 +54,10 @@ glu_defines(Defs) -> gen_define(#def{name=N, val=Val, type=int}) -> w("-define(~s, ~p).~n", [N,Val]); +gen_define(#def{name=N, val=Val, type=float_str}) -> + w("-define(~s, ~s).~n", [N,Val]); gen_define(#def{name=N, val=Val, type=hex}) -> - w("-define(~s, ~.16#).~n", [N,Val]); + w("-define(~s, 16#~s).~n", [N,Val]); gen_define(#def{name=N, val=Val, type=string}) -> w("-define(~s, ?~s).~n", [N,Val]); gen_define(#def{name="GLEXT_64_TYPES"++_, val=undefined, type=undefined}) -> diff --git a/lib/wx/api_gen/wx_gen_cpp.erl b/lib/wx/api_gen/wx_gen_cpp.erl index 69e7510a95..2209e4a53b 100644 --- a/lib/wx/api_gen/wx_gen_cpp.erl +++ b/lib/wx/api_gen/wx_gen_cpp.erl @@ -350,8 +350,12 @@ declare_type(N,false,_,#type{name="wxDateTime"}) -> w(" wxDateTime ~s;~n", [N]); declare_type(N,false,_,#type{name="wxColour"}) -> w(" wxColour ~s;~n", [N]); +declare_type(N,false,_,#type{name=Type, base=int, ref=reference}) -> + w(" ~s ~s;~n", [Type,N]); declare_type(N,false,_,#type{name=Type, base=int64, ref=reference}) -> w(" ~s ~s;~n", [Type,N]); +declare_type(N,false,_,#type{base={comp,_,_},single=true,name=Type,ref=reference}) -> + w(" ~s ~s;~n", [Type,N]); declare_type(N,true,Def,#type{base=Base,single=true,name=Type,by_val=true}) when Base =:= int; Base =:= long; Base =:= float; Base =:= double; Base =:= bool -> w(" ~s ~s=~s;~n", [Type,N,Def]); @@ -812,6 +816,7 @@ call_arg(#param{name=N,in=false,type=#type{by_val=false, single=true}}) -> "&" + call_arg(#param{name=N,def=Def,type=#type{base={comp,_,_},ref={pointer,1},single=true}}) when Def =:= none -> "&" ++N; +call_arg(#param{name=N,type=#type{base=int, ref=reference, single=true}}) -> "*" ++ N; call_arg(#param{name=N,type=#type{by_val=false}}) -> N; call_arg(#param{name=N,type={merged,_,#type{base={class,_},single=true, by_val=ByVal, @@ -888,7 +893,7 @@ build_return_vals(Type,Ps) -> build_ret_types(void,Ps) -> Calc = fun(#param{name=N,in=False,type=T}, Free) when False =/= true -> - case build_ret(N, False, T) of + case build_ret(N, {arg, False}, T) of ok -> Free; Other -> [Other|Free] end; @@ -896,12 +901,12 @@ build_ret_types(void,Ps) -> end, lists:foldl(Calc, [], Ps); build_ret_types(Type,Ps) -> - Free = case build_ret("Result", out, Type) of + Free = case build_ret("Result", {ret, out}, Type) of ok -> []; FreeStr -> [FreeStr] end, Calc = fun(#param{name=N,in=False,type=T}, FreeAcc) when False =/= true -> - case build_ret(N, False, T) of + case build_ret(N, {arg, False}, T) of ok -> FreeAcc; FreeMe -> [FreeMe|FreeAcc] end; @@ -927,13 +932,13 @@ build_ret(Name,_,#type{base={enum,_Type},single=true}) -> w(" rt.addInt(~s);~n",[Name]); build_ret(Name,_,#type{base={comp,_,{record, _}},single=true}) -> w(" rt.add(~s);~n", [Name]); -build_ret(Name,_,#type{base={comp,_,_},single=true, ref=reference}) -> +build_ret(Name,{ret,_},#type{base={comp,_,_},single=true, ref=reference}) -> w(" rt.add((*~s));~n",[Name]); build_ret(Name,_,#type{base={comp,_,_},single=true}) -> w(" rt.add(~s);~n",[Name]); build_ret(Name,_,#type{base=bool,single=true,by_val=true}) -> w(" rt.addBool(~s);~n",[Name]); -build_ret(Name,both,#type{base=int,single=true,mod=M}) -> +build_ret(Name,{arg, both},#type{base=int,single=true,mod=M}) -> case lists:member(unsigned, M) of true -> w(" rt.addUint(*~s);~n",[Name]); false -> w(" rt.addInt(*~s);~n",[Name]) diff --git a/lib/wx/api_gen/wx_gen_erl.erl b/lib/wx/api_gen/wx_gen_erl.erl index aac57586bc..6159b7c4bd 100644 --- a/lib/wx/api_gen/wx_gen_erl.erl +++ b/lib/wx/api_gen/wx_gen_erl.erl @@ -177,7 +177,18 @@ parents_check([Parent|Ps]) -> w("parent_class(~s) -> true;~n",[Parent]), parents_check(Ps). -check_class(#type{base={class,"wx"}}) -> ok; +check_class(#type{name="wxObject", base={class,"wx"}}) -> + "wx:wx_object()"; +check_class(#type{name="wxIconLocation", base={class,"wx"}}) -> + "wx:wx_object()"; +check_class(#type{name="wxToolBarToolBase", base={class,"wx"}, mod=Mod}) -> + %% Implement this some day + "wx:wx_object()"; +check_class(#type{name="wxValidator", base={class,"wx"}, mod=Mod}) -> + %% Implement this some day + "wx:wx_object()"; +check_class(#type{name=Name, base={class,"wx"}}) -> + exit({class, Name}); check_class(#type{base={class,Name},xml=Xml}) -> case get({class,Name}) of undefined -> @@ -190,12 +201,15 @@ check_class(#type{base={class,Name},xml=Xml}) -> _ -> ?warning("~s:~s: Class ~p used but not defined~n (see ~p)~n", [get(current_class),get(current_func),Name, Xml]) - end; + end, + "wx:wx_object()"; _ -> ?warning("~s:~s: Class ~p used is enum~n", - [get(current_class),get(current_func),Name]) + [get(current_class),get(current_func),Name]), + exit(class_enum) end; - _ -> ok + _ -> + Name ++ ":" ++ Name ++ "()" end. gen_export(#class{name=Class,abstract=Abs},Ms0) -> @@ -766,21 +780,21 @@ doc_arg_type3(#type{base=eventType}, _) -> "atom()"; doc_arg_type3(#type{base={ref,N}}, _) -> N++"()"; doc_arg_type3(#type{base={term,_N}}, _) -> "term()"; doc_arg_type3(T=#type{base={class,N}}, _) -> - check_class(T), - case get(current_class) of - N -> N ++ "()"; - _ -> N++":" ++ N++"()" + ClassType = check_class(T), + Current = get(current_class), + if N =:= Current -> N ++ "()"; + true -> ClassType end; doc_arg_type3({merged,_,T1=#type{base={class,N1}},_,_,T2=#type{base={class,N2}},_}, _) -> - check_class(T1), - check_class(T2), + CT1 = check_class(T1), + CT2 = check_class(T2), Curr = get(current_class), if - N1 =:= Curr, N2 =:= Curr -> N1++"() | "++ N2++"()"; - N1 =:= Curr -> N1++"() | "++ N2++":" ++ N2++"()"; - N2 =:= Curr -> N1++":" ++ N1++"() | "++ N2++"()"; + N1 =:= Curr, N2 =:= Curr -> N1++"()"; + N1 =:= Curr -> N1++"() | "++ CT2; + N2 =:= Curr -> CT1 ++ " | "++ N2++"()"; true -> - N1++":" ++ N1++"() | "++ N2++":" ++ N2++"()" + CT1 ++ " | " ++ CT2 end; %% doc_arg_type3(#type{base={enum,{_,N}}}, _) -> uppercase(N); %% doc_arg_type3(#type{base={enum,N}}, _) -> uppercase(N); @@ -1010,12 +1024,13 @@ enum_name(Name) -> gen_enums_ints() -> %% open_write("../include/wx.hrl"), opened in gen_event_recs w("~n%% Hardcoded Records~n", []), - w("-record(wxMouseState, {x, y, %% integer()~n" - " leftDown, middleDown, rightDown, %% bool()~n" - " controlDown, shiftDown, altDown, metaDown, cmdDown %% bool()~n" + w("-record(wxMouseState, {x :: integer(), y :: integer(),~n" + " leftDown :: boolean(), middleDown :: boolean, rightDown :: boolean, ~n" + " controlDown :: boolean(), shiftDown :: boolean(),~n" + " altDown :: boolean(), metaDown :: boolean(), cmdDown :: boolean()~n" " }).~n", []), w("-record(wxHtmlLinkInfo, {~n" - " href, target %% unicode:chardata()~n" + " href :: unicode:chardata(), target :: unicode:chardata()~n" " }).~n", []), w("~n%% Hardcoded Defines~n", []), Enums = [E || {{enum,_},E = #enum{as_atom=false}} <- get()], @@ -1045,16 +1060,16 @@ build_enum_ints(#enum{from=From, vals=Vals},Done) -> Format = fun(#const{name="wxEVT_" ++ _}) -> ignore; %% Ignore event macros they are not valid in our event model - (#const{name=Name,val=Value,is_const=true}) when is_integer(Value) -> + (#const{name=Name,val=Value,is_const=true}) when is_number(Value) -> w("-define(~s, ~p).~n", [enum_name(Name),Value]); - (#const{name=Name,val=Value,is_const=false}) when is_integer(Value) -> + (#const{name=Name,val=Value,is_const=false}) when is_number(Value) -> w("-define(~s, wxe_util:get_const(~s)).~n", [enum_name(Name),enum_name(Name)]); (#const{name=Name,val={Str,0}}) -> case string:tokens(Str, " |()") of [Token] -> - w("-define(~s, ?~s).~n", [enum_name(Name),Token]); + w("-define(~s, ~s).~n", [enum_name(Name),const_value(Token)]); Tokens -> - Def = args(fun(T) -> [$?|T] end, " bor ", Tokens), + Def = args(fun(T) -> const_value(T) end, " bor ", Tokens), w("-define(~s, (~s)).~n", [enum_name(Name),Def]) end; (#const{name=Name,val={Str,N}}) -> @@ -1079,6 +1094,17 @@ build_enum_ints(#enum{from=From, vals=Vals},Done) -> end, lists:foldl(Write, Done, Vals). +const_value(V) when is_integer(V) -> integer_to_list(V); +const_value(V = "16#" ++ IntList) -> + _ = http_util:hexlist_to_integer(IntList), %% ASSERT + V; +const_value(V0) -> + try + _ = list_to_integer(V0), + V0 + catch _:_ -> [$?|V0] + end. + gen_event_recs() -> open_write("../include/wx.hrl"), erl_copyright(), diff --git a/lib/wx/api_gen/wxapi.conf b/lib/wx/api_gen/wxapi.conf index 383addfe3f..1f6225ce60 100644 --- a/lib/wx/api_gen/wxapi.conf +++ b/lib/wx/api_gen/wxapi.conf @@ -776,10 +776,12 @@ 'GetEditControl', 'GetImageList','GetItem','GetItemBackgroundColour', 'GetItemCount',{'GetItemData', [{return, {base,int}}]}, - 'GetItemFont','GetItemPosition','GetItemRect', - 'GetItemSpacing','GetItemState','GetItemText','GetItemTextColour', + 'GetItemFont', {'GetItemPosition', [{"pos", out}]},{'GetItemRect',[{"rect", out}]}, + 'GetItemSpacing','GetItemState', + 'GetItemText','GetItemTextColour', 'GetNextItem','GetSelectedItemCount','GetTextColour','GetTopItem', - 'GetViewRect',{'HitTest',[{"pSubItem",nowhere}]},'InsertColumn','InsertItem', + 'GetViewRect',{'HitTest',[{"pSubItem",nowhere}, {"flags", in}]}, + 'InsertColumn','InsertItem', %%'OnGetItemAttr', 'OnGetItemImage','OnGetItemText', 'RefreshItem','RefreshItems','ScrollList', 'SetBackgroundColour','SetColumn','SetColumnWidth','SetImageList','SetItem', diff --git a/lib/wx/c_src/gen/wxe_funcs.cpp b/lib/wx/c_src/gen/wxe_funcs.cpp index c81b3c88c0..15012011ed 100644 --- a/lib/wx/c_src/gen/wxe_funcs.cpp +++ b/lib/wx/c_src/gen/wxe_funcs.cpp @@ -15420,25 +15420,21 @@ case wxListCtrl_GetItemFont: { // wxListCtrl::GetItemFont break; } case wxListCtrl_GetItemPosition: { // wxListCtrl::GetItemPosition + wxPoint pos; wxListCtrl *This = (wxListCtrl *) getPtr(bp,memenv); bp += 4; int * item = (int *) bp; bp += 4; - int * posX = (int *) bp; bp += 4; - int * posY = (int *) bp; bp += 4; - wxPoint pos = wxPoint(*posX,*posY); if(!This) throw wxe_badarg(0); bool Result = This->GetItemPosition((long) *item,pos); rt.addBool(Result); + rt.add(pos); + rt.addTupleCount(2); break; } case wxListCtrl_GetItemRect: { // wxListCtrl::GetItemRect + wxRect rect; int code=wxLIST_RECT_BOUNDS; wxListCtrl *This = (wxListCtrl *) getPtr(bp,memenv); bp += 4; int * item = (int *) bp; bp += 4; - int * rectX = (int *) bp; bp += 4; - int * rectY = (int *) bp; bp += 4; - int * rectW = (int *) bp; bp += 4; - int * rectH = (int *) bp; bp += 4; - wxRect rect = wxRect(*rectX,*rectY,*rectW,*rectH); while( * (int*) bp) { switch (* (int*) bp) { case 1: {bp += 4; code = (int)*(int *) bp; bp += 4; @@ -15447,6 +15443,8 @@ case wxListCtrl_GetItemRect: { // wxListCtrl::GetItemRect if(!This) throw wxe_badarg(0); bool Result = This->GetItemRect((long) *item,rect,code); rt.addBool(Result); + rt.add(rect); + rt.addTupleCount(2); break; } case wxListCtrl_GetItemSpacing: { // wxListCtrl::GetItemSpacing @@ -15528,16 +15526,14 @@ case wxListCtrl_GetViewRect: { // wxListCtrl::GetViewRect break; } case wxListCtrl_HitTest: { // wxListCtrl::HitTest - int flags; wxListCtrl *This = (wxListCtrl *) getPtr(bp,memenv); bp += 4; int * pointX = (int *) bp; bp += 4; int * pointY = (int *) bp; bp += 4; wxPoint point = wxPoint(*pointX,*pointY); + int * flags = (int *) bp; bp += 4; if(!This) throw wxe_badarg(0); - long Result = This->HitTest(point,flags); + long Result = This->HitTest(point,*flags); rt.addInt(Result); - rt.addInt(flags); - rt.addTupleCount(2); break; } case wxListCtrl_InsertColumn_2: { // wxListCtrl::InsertColumn diff --git a/lib/wx/include/gl.hrl b/lib/wx/include/gl.hrl index c643ae0962..9004a8aa31 100644 --- a/lib/wx/include/gl.hrl +++ b/lib/wx/include/gl.hrl @@ -37,16 +37,16 @@ -define(GL_3_BYTES, 16#1408). -define(GL_4_BYTES, 16#1409). -define(GL_DOUBLE, 16#140A). --define(GL_POINTS, 16#0). --define(GL_LINES, 16#1). --define(GL_LINE_LOOP, 16#2). --define(GL_LINE_STRIP, 16#3). --define(GL_TRIANGLES, 16#4). --define(GL_TRIANGLE_STRIP, 16#5). --define(GL_TRIANGLE_FAN, 16#6). --define(GL_QUADS, 16#7). --define(GL_QUAD_STRIP, 16#8). --define(GL_POLYGON, 16#9). +-define(GL_POINTS, 16#0000). +-define(GL_LINES, 16#0001). +-define(GL_LINE_LOOP, 16#0002). +-define(GL_LINE_STRIP, 16#0003). +-define(GL_TRIANGLES, 16#0004). +-define(GL_TRIANGLE_STRIP, 16#0005). +-define(GL_TRIANGLE_FAN, 16#0006). +-define(GL_QUADS, 16#0007). +-define(GL_QUAD_STRIP, 16#0008). +-define(GL_POLYGON, 16#0009). -define(GL_VERTEX_ARRAY, 16#8074). -define(GL_NORMAL_ARRAY, 16#8075). -define(GL_COLOR_ARRAY, 16#8076). @@ -87,35 +87,35 @@ -define(GL_T2F_N3F_V3F, 16#2A2B). -define(GL_T2F_C4F_N3F_V3F, 16#2A2C). -define(GL_T4F_C4F_N3F_V4F, 16#2A2D). --define(GL_MATRIX_MODE, 16#BA0). +-define(GL_MATRIX_MODE, 16#0BA0). -define(GL_MODELVIEW, 16#1700). -define(GL_PROJECTION, 16#1701). -define(GL_TEXTURE, 16#1702). --define(GL_POINT_SMOOTH, 16#B10). --define(GL_POINT_SIZE, 16#B11). --define(GL_POINT_SIZE_GRANULARITY, 16#B13). --define(GL_POINT_SIZE_RANGE, 16#B12). --define(GL_LINE_SMOOTH, 16#B20). --define(GL_LINE_STIPPLE, 16#B24). --define(GL_LINE_STIPPLE_PATTERN, 16#B25). --define(GL_LINE_STIPPLE_REPEAT, 16#B26). --define(GL_LINE_WIDTH, 16#B21). --define(GL_LINE_WIDTH_GRANULARITY, 16#B23). --define(GL_LINE_WIDTH_RANGE, 16#B22). +-define(GL_POINT_SMOOTH, 16#0B10). +-define(GL_POINT_SIZE, 16#0B11). +-define(GL_POINT_SIZE_GRANULARITY, 16#0B13). +-define(GL_POINT_SIZE_RANGE, 16#0B12). +-define(GL_LINE_SMOOTH, 16#0B20). +-define(GL_LINE_STIPPLE, 16#0B24). +-define(GL_LINE_STIPPLE_PATTERN, 16#0B25). +-define(GL_LINE_STIPPLE_REPEAT, 16#0B26). +-define(GL_LINE_WIDTH, 16#0B21). +-define(GL_LINE_WIDTH_GRANULARITY, 16#0B23). +-define(GL_LINE_WIDTH_RANGE, 16#0B22). -define(GL_POINT, 16#1B00). -define(GL_LINE, 16#1B01). -define(GL_FILL, 16#1B02). --define(GL_CW, 16#900). --define(GL_CCW, 16#901). --define(GL_FRONT, 16#404). --define(GL_BACK, 16#405). --define(GL_POLYGON_MODE, 16#B40). --define(GL_POLYGON_SMOOTH, 16#B41). --define(GL_POLYGON_STIPPLE, 16#B42). --define(GL_EDGE_FLAG, 16#B43). --define(GL_CULL_FACE, 16#B44). --define(GL_CULL_FACE_MODE, 16#B45). --define(GL_FRONT_FACE, 16#B46). +-define(GL_CW, 16#0900). +-define(GL_CCW, 16#0901). +-define(GL_FRONT, 16#0404). +-define(GL_BACK, 16#0405). +-define(GL_POLYGON_MODE, 16#0B40). +-define(GL_POLYGON_SMOOTH, 16#0B41). +-define(GL_POLYGON_STIPPLE, 16#0B42). +-define(GL_EDGE_FLAG, 16#0B43). +-define(GL_CULL_FACE, 16#0B44). +-define(GL_CULL_FACE_MODE, 16#0B45). +-define(GL_FRONT_FACE, 16#0B46). -define(GL_POLYGON_OFFSET_FACTOR, 16#8038). -define(GL_POLYGON_OFFSET_UNITS, 16#2A00). -define(GL_POLYGON_OFFSET_POINT, 16#2A01). @@ -123,25 +123,25 @@ -define(GL_POLYGON_OFFSET_FILL, 16#8037). -define(GL_COMPILE, 16#1300). -define(GL_COMPILE_AND_EXECUTE, 16#1301). --define(GL_LIST_BASE, 16#B32). --define(GL_LIST_INDEX, 16#B33). --define(GL_LIST_MODE, 16#B30). --define(GL_NEVER, 16#200). --define(GL_LESS, 16#201). --define(GL_EQUAL, 16#202). --define(GL_LEQUAL, 16#203). --define(GL_GREATER, 16#204). --define(GL_NOTEQUAL, 16#205). --define(GL_GEQUAL, 16#206). --define(GL_ALWAYS, 16#207). --define(GL_DEPTH_TEST, 16#B71). --define(GL_DEPTH_BITS, 16#D56). --define(GL_DEPTH_CLEAR_VALUE, 16#B73). --define(GL_DEPTH_FUNC, 16#B74). --define(GL_DEPTH_RANGE, 16#B70). --define(GL_DEPTH_WRITEMASK, 16#B72). +-define(GL_LIST_BASE, 16#0B32). +-define(GL_LIST_INDEX, 16#0B33). +-define(GL_LIST_MODE, 16#0B30). +-define(GL_NEVER, 16#0200). +-define(GL_LESS, 16#0201). +-define(GL_EQUAL, 16#0202). +-define(GL_LEQUAL, 16#0203). +-define(GL_GREATER, 16#0204). +-define(GL_NOTEQUAL, 16#0205). +-define(GL_GEQUAL, 16#0206). +-define(GL_ALWAYS, 16#0207). +-define(GL_DEPTH_TEST, 16#0B71). +-define(GL_DEPTH_BITS, 16#0D56). +-define(GL_DEPTH_CLEAR_VALUE, 16#0B73). +-define(GL_DEPTH_FUNC, 16#0B74). +-define(GL_DEPTH_RANGE, 16#0B70). +-define(GL_DEPTH_WRITEMASK, 16#0B72). -define(GL_DEPTH_COMPONENT, 16#1902). --define(GL_LIGHTING, 16#B50). +-define(GL_LIGHTING, 16#0B50). -define(GL_LIGHT0, 16#4000). -define(GL_LIGHT1, 16#4001). -define(GL_LIGHT2, 16#4002). @@ -164,85 +164,85 @@ -define(GL_SPOT_DIRECTION, 16#1204). -define(GL_AMBIENT_AND_DIFFUSE, 16#1602). -define(GL_COLOR_INDEXES, 16#1603). --define(GL_LIGHT_MODEL_TWO_SIDE, 16#B52). --define(GL_LIGHT_MODEL_LOCAL_VIEWER, 16#B51). --define(GL_LIGHT_MODEL_AMBIENT, 16#B53). --define(GL_FRONT_AND_BACK, 16#408). --define(GL_SHADE_MODEL, 16#B54). +-define(GL_LIGHT_MODEL_TWO_SIDE, 16#0B52). +-define(GL_LIGHT_MODEL_LOCAL_VIEWER, 16#0B51). +-define(GL_LIGHT_MODEL_AMBIENT, 16#0B53). +-define(GL_FRONT_AND_BACK, 16#0408). +-define(GL_SHADE_MODEL, 16#0B54). -define(GL_FLAT, 16#1D00). -define(GL_SMOOTH, 16#1D01). --define(GL_COLOR_MATERIAL, 16#B57). --define(GL_COLOR_MATERIAL_FACE, 16#B55). --define(GL_COLOR_MATERIAL_PARAMETER, 16#B56). --define(GL_NORMALIZE, 16#BA1). +-define(GL_COLOR_MATERIAL, 16#0B57). +-define(GL_COLOR_MATERIAL_FACE, 16#0B55). +-define(GL_COLOR_MATERIAL_PARAMETER, 16#0B56). +-define(GL_NORMALIZE, 16#0BA1). -define(GL_CLIP_PLANE0, 16#3000). -define(GL_CLIP_PLANE1, 16#3001). -define(GL_CLIP_PLANE2, 16#3002). -define(GL_CLIP_PLANE3, 16#3003). -define(GL_CLIP_PLANE4, 16#3004). -define(GL_CLIP_PLANE5, 16#3005). --define(GL_ACCUM_RED_BITS, 16#D58). --define(GL_ACCUM_GREEN_BITS, 16#D59). --define(GL_ACCUM_BLUE_BITS, 16#D5A). --define(GL_ACCUM_ALPHA_BITS, 16#D5B). --define(GL_ACCUM_CLEAR_VALUE, 16#B80). --define(GL_ACCUM, 16#100). --define(GL_ADD, 16#104). --define(GL_LOAD, 16#101). --define(GL_MULT, 16#103). --define(GL_RETURN, 16#102). --define(GL_ALPHA_TEST, 16#BC0). --define(GL_ALPHA_TEST_REF, 16#BC2). --define(GL_ALPHA_TEST_FUNC, 16#BC1). --define(GL_BLEND, 16#BE2). --define(GL_BLEND_SRC, 16#BE1). --define(GL_BLEND_DST, 16#BE0). +-define(GL_ACCUM_RED_BITS, 16#0D58). +-define(GL_ACCUM_GREEN_BITS, 16#0D59). +-define(GL_ACCUM_BLUE_BITS, 16#0D5A). +-define(GL_ACCUM_ALPHA_BITS, 16#0D5B). +-define(GL_ACCUM_CLEAR_VALUE, 16#0B80). +-define(GL_ACCUM, 16#0100). +-define(GL_ADD, 16#0104). +-define(GL_LOAD, 16#0101). +-define(GL_MULT, 16#0103). +-define(GL_RETURN, 16#0102). +-define(GL_ALPHA_TEST, 16#0BC0). +-define(GL_ALPHA_TEST_REF, 16#0BC2). +-define(GL_ALPHA_TEST_FUNC, 16#0BC1). +-define(GL_BLEND, 16#0BE2). +-define(GL_BLEND_SRC, 16#0BE1). +-define(GL_BLEND_DST, 16#0BE0). -define(GL_ZERO, 16#0). -define(GL_ONE, 16#1). --define(GL_SRC_COLOR, 16#300). --define(GL_ONE_MINUS_SRC_COLOR, 16#301). --define(GL_SRC_ALPHA, 16#302). --define(GL_ONE_MINUS_SRC_ALPHA, 16#303). --define(GL_DST_ALPHA, 16#304). --define(GL_ONE_MINUS_DST_ALPHA, 16#305). --define(GL_DST_COLOR, 16#306). --define(GL_ONE_MINUS_DST_COLOR, 16#307). --define(GL_SRC_ALPHA_SATURATE, 16#308). +-define(GL_SRC_COLOR, 16#0300). +-define(GL_ONE_MINUS_SRC_COLOR, 16#0301). +-define(GL_SRC_ALPHA, 16#0302). +-define(GL_ONE_MINUS_SRC_ALPHA, 16#0303). +-define(GL_DST_ALPHA, 16#0304). +-define(GL_ONE_MINUS_DST_ALPHA, 16#0305). +-define(GL_DST_COLOR, 16#0306). +-define(GL_ONE_MINUS_DST_COLOR, 16#0307). +-define(GL_SRC_ALPHA_SATURATE, 16#0308). -define(GL_FEEDBACK, 16#1C01). -define(GL_RENDER, 16#1C00). -define(GL_SELECT, 16#1C02). --define(GL_2D, 16#600). --define(GL_3D, 16#601). --define(GL_3D_COLOR, 16#602). --define(GL_3D_COLOR_TEXTURE, 16#603). --define(GL_4D_COLOR_TEXTURE, 16#604). --define(GL_POINT_TOKEN, 16#701). --define(GL_LINE_TOKEN, 16#702). --define(GL_LINE_RESET_TOKEN, 16#707). --define(GL_POLYGON_TOKEN, 16#703). --define(GL_BITMAP_TOKEN, 16#704). --define(GL_DRAW_PIXEL_TOKEN, 16#705). --define(GL_COPY_PIXEL_TOKEN, 16#706). --define(GL_PASS_THROUGH_TOKEN, 16#700). --define(GL_FEEDBACK_BUFFER_POINTER, 16#DF0). --define(GL_FEEDBACK_BUFFER_SIZE, 16#DF1). --define(GL_FEEDBACK_BUFFER_TYPE, 16#DF2). --define(GL_SELECTION_BUFFER_POINTER, 16#DF3). --define(GL_SELECTION_BUFFER_SIZE, 16#DF4). --define(GL_FOG, 16#B60). --define(GL_FOG_MODE, 16#B65). --define(GL_FOG_DENSITY, 16#B62). --define(GL_FOG_COLOR, 16#B66). --define(GL_FOG_INDEX, 16#B61). --define(GL_FOG_START, 16#B63). --define(GL_FOG_END, 16#B64). +-define(GL_2D, 16#0600). +-define(GL_3D, 16#0601). +-define(GL_3D_COLOR, 16#0602). +-define(GL_3D_COLOR_TEXTURE, 16#0603). +-define(GL_4D_COLOR_TEXTURE, 16#0604). +-define(GL_POINT_TOKEN, 16#0701). +-define(GL_LINE_TOKEN, 16#0702). +-define(GL_LINE_RESET_TOKEN, 16#0707). +-define(GL_POLYGON_TOKEN, 16#0703). +-define(GL_BITMAP_TOKEN, 16#0704). +-define(GL_DRAW_PIXEL_TOKEN, 16#0705). +-define(GL_COPY_PIXEL_TOKEN, 16#0706). +-define(GL_PASS_THROUGH_TOKEN, 16#0700). +-define(GL_FEEDBACK_BUFFER_POINTER, 16#0DF0). +-define(GL_FEEDBACK_BUFFER_SIZE, 16#0DF1). +-define(GL_FEEDBACK_BUFFER_TYPE, 16#0DF2). +-define(GL_SELECTION_BUFFER_POINTER, 16#0DF3). +-define(GL_SELECTION_BUFFER_SIZE, 16#0DF4). +-define(GL_FOG, 16#0B60). +-define(GL_FOG_MODE, 16#0B65). +-define(GL_FOG_DENSITY, 16#0B62). +-define(GL_FOG_COLOR, 16#0B66). +-define(GL_FOG_INDEX, 16#0B61). +-define(GL_FOG_START, 16#0B63). +-define(GL_FOG_END, 16#0B64). -define(GL_LINEAR, 16#2601). --define(GL_EXP, 16#800). --define(GL_EXP2, 16#801). --define(GL_LOGIC_OP, 16#BF1). --define(GL_INDEX_LOGIC_OP, 16#BF1). --define(GL_COLOR_LOGIC_OP, 16#BF2). --define(GL_LOGIC_OP_MODE, 16#BF0). +-define(GL_EXP, 16#0800). +-define(GL_EXP2, 16#0801). +-define(GL_LOGIC_OP, 16#0BF1). +-define(GL_INDEX_LOGIC_OP, 16#0BF1). +-define(GL_COLOR_LOGIC_OP, 16#0BF2). +-define(GL_LOGIC_OP_MODE, 16#0BF0). -define(GL_CLEAR, 16#1500). -define(GL_SET, 16#150F). -define(GL_COPY, 16#1503). @@ -259,32 +259,32 @@ -define(GL_AND_INVERTED, 16#1504). -define(GL_OR_REVERSE, 16#150B). -define(GL_OR_INVERTED, 16#150D). --define(GL_STENCIL_BITS, 16#D57). --define(GL_STENCIL_TEST, 16#B90). --define(GL_STENCIL_CLEAR_VALUE, 16#B91). --define(GL_STENCIL_FUNC, 16#B92). --define(GL_STENCIL_VALUE_MASK, 16#B93). --define(GL_STENCIL_FAIL, 16#B94). --define(GL_STENCIL_PASS_DEPTH_FAIL, 16#B95). --define(GL_STENCIL_PASS_DEPTH_PASS, 16#B96). --define(GL_STENCIL_REF, 16#B97). --define(GL_STENCIL_WRITEMASK, 16#B98). +-define(GL_STENCIL_BITS, 16#0D57). +-define(GL_STENCIL_TEST, 16#0B90). +-define(GL_STENCIL_CLEAR_VALUE, 16#0B91). +-define(GL_STENCIL_FUNC, 16#0B92). +-define(GL_STENCIL_VALUE_MASK, 16#0B93). +-define(GL_STENCIL_FAIL, 16#0B94). +-define(GL_STENCIL_PASS_DEPTH_FAIL, 16#0B95). +-define(GL_STENCIL_PASS_DEPTH_PASS, 16#0B96). +-define(GL_STENCIL_REF, 16#0B97). +-define(GL_STENCIL_WRITEMASK, 16#0B98). -define(GL_STENCIL_INDEX, 16#1901). -define(GL_KEEP, 16#1E00). -define(GL_REPLACE, 16#1E01). -define(GL_INCR, 16#1E02). -define(GL_DECR, 16#1E03). -define(GL_NONE, 16#0). --define(GL_LEFT, 16#406). --define(GL_RIGHT, 16#407). --define(GL_FRONT_LEFT, 16#400). --define(GL_FRONT_RIGHT, 16#401). --define(GL_BACK_LEFT, 16#402). --define(GL_BACK_RIGHT, 16#403). --define(GL_AUX0, 16#409). --define(GL_AUX1, 16#40A). --define(GL_AUX2, 16#40B). --define(GL_AUX3, 16#40C). +-define(GL_LEFT, 16#0406). +-define(GL_RIGHT, 16#0407). +-define(GL_FRONT_LEFT, 16#0400). +-define(GL_FRONT_RIGHT, 16#0401). +-define(GL_BACK_LEFT, 16#0402). +-define(GL_BACK_RIGHT, 16#0403). +-define(GL_AUX0, 16#0409). +-define(GL_AUX1, 16#040A). +-define(GL_AUX2, 16#040B). +-define(GL_AUX3, 16#040C). -define(GL_COLOR_INDEX, 16#1900). -define(GL_RED, 16#1903). -define(GL_GREEN, 16#1904). @@ -292,161 +292,161 @@ -define(GL_ALPHA, 16#1906). -define(GL_LUMINANCE, 16#1909). -define(GL_LUMINANCE_ALPHA, 16#190A). --define(GL_ALPHA_BITS, 16#D55). --define(GL_RED_BITS, 16#D52). --define(GL_GREEN_BITS, 16#D53). --define(GL_BLUE_BITS, 16#D54). --define(GL_INDEX_BITS, 16#D51). --define(GL_SUBPIXEL_BITS, 16#D50). --define(GL_AUX_BUFFERS, 16#C00). --define(GL_READ_BUFFER, 16#C02). --define(GL_DRAW_BUFFER, 16#C01). --define(GL_DOUBLEBUFFER, 16#C32). --define(GL_STEREO, 16#C33). +-define(GL_ALPHA_BITS, 16#0D55). +-define(GL_RED_BITS, 16#0D52). +-define(GL_GREEN_BITS, 16#0D53). +-define(GL_BLUE_BITS, 16#0D54). +-define(GL_INDEX_BITS, 16#0D51). +-define(GL_SUBPIXEL_BITS, 16#0D50). +-define(GL_AUX_BUFFERS, 16#0C00). +-define(GL_READ_BUFFER, 16#0C02). +-define(GL_DRAW_BUFFER, 16#0C01). +-define(GL_DOUBLEBUFFER, 16#0C32). +-define(GL_STEREO, 16#0C33). -define(GL_BITMAP, 16#1A00). -define(GL_COLOR, 16#1800). -define(GL_DEPTH, 16#1801). -define(GL_STENCIL, 16#1802). --define(GL_DITHER, 16#BD0). +-define(GL_DITHER, 16#0BD0). -define(GL_RGB, 16#1907). -define(GL_RGBA, 16#1908). --define(GL_MAX_LIST_NESTING, 16#B31). --define(GL_MAX_EVAL_ORDER, 16#D30). --define(GL_MAX_LIGHTS, 16#D31). --define(GL_MAX_CLIP_PLANES, 16#D32). --define(GL_MAX_TEXTURE_SIZE, 16#D33). --define(GL_MAX_PIXEL_MAP_TABLE, 16#D34). --define(GL_MAX_ATTRIB_STACK_DEPTH, 16#D35). --define(GL_MAX_MODELVIEW_STACK_DEPTH, 16#D36). --define(GL_MAX_NAME_STACK_DEPTH, 16#D37). --define(GL_MAX_PROJECTION_STACK_DEPTH, 16#D38). --define(GL_MAX_TEXTURE_STACK_DEPTH, 16#D39). --define(GL_MAX_VIEWPORT_DIMS, 16#D3A). --define(GL_MAX_CLIENT_ATTRIB_STACK_DEPTH, 16#D3B). --define(GL_ATTRIB_STACK_DEPTH, 16#BB0). --define(GL_CLIENT_ATTRIB_STACK_DEPTH, 16#BB1). --define(GL_COLOR_CLEAR_VALUE, 16#C22). --define(GL_COLOR_WRITEMASK, 16#C23). --define(GL_CURRENT_INDEX, 16#B01). --define(GL_CURRENT_COLOR, 16#B00). --define(GL_CURRENT_NORMAL, 16#B02). --define(GL_CURRENT_RASTER_COLOR, 16#B04). --define(GL_CURRENT_RASTER_DISTANCE, 16#B09). --define(GL_CURRENT_RASTER_INDEX, 16#B05). --define(GL_CURRENT_RASTER_POSITION, 16#B07). --define(GL_CURRENT_RASTER_TEXTURE_COORDS, 16#B06). --define(GL_CURRENT_RASTER_POSITION_VALID, 16#B08). --define(GL_CURRENT_TEXTURE_COORDS, 16#B03). --define(GL_INDEX_CLEAR_VALUE, 16#C20). --define(GL_INDEX_MODE, 16#C30). --define(GL_INDEX_WRITEMASK, 16#C21). --define(GL_MODELVIEW_MATRIX, 16#BA6). --define(GL_MODELVIEW_STACK_DEPTH, 16#BA3). --define(GL_NAME_STACK_DEPTH, 16#D70). --define(GL_PROJECTION_MATRIX, 16#BA7). --define(GL_PROJECTION_STACK_DEPTH, 16#BA4). --define(GL_RENDER_MODE, 16#C40). --define(GL_RGBA_MODE, 16#C31). --define(GL_TEXTURE_MATRIX, 16#BA8). --define(GL_TEXTURE_STACK_DEPTH, 16#BA5). --define(GL_VIEWPORT, 16#BA2). --define(GL_AUTO_NORMAL, 16#D80). --define(GL_MAP1_COLOR_4, 16#D90). --define(GL_MAP1_INDEX, 16#D91). --define(GL_MAP1_NORMAL, 16#D92). --define(GL_MAP1_TEXTURE_COORD_1, 16#D93). --define(GL_MAP1_TEXTURE_COORD_2, 16#D94). --define(GL_MAP1_TEXTURE_COORD_3, 16#D95). --define(GL_MAP1_TEXTURE_COORD_4, 16#D96). --define(GL_MAP1_VERTEX_3, 16#D97). --define(GL_MAP1_VERTEX_4, 16#D98). --define(GL_MAP2_COLOR_4, 16#DB0). --define(GL_MAP2_INDEX, 16#DB1). --define(GL_MAP2_NORMAL, 16#DB2). --define(GL_MAP2_TEXTURE_COORD_1, 16#DB3). --define(GL_MAP2_TEXTURE_COORD_2, 16#DB4). --define(GL_MAP2_TEXTURE_COORD_3, 16#DB5). --define(GL_MAP2_TEXTURE_COORD_4, 16#DB6). --define(GL_MAP2_VERTEX_3, 16#DB7). --define(GL_MAP2_VERTEX_4, 16#DB8). --define(GL_MAP1_GRID_DOMAIN, 16#DD0). --define(GL_MAP1_GRID_SEGMENTS, 16#DD1). --define(GL_MAP2_GRID_DOMAIN, 16#DD2). --define(GL_MAP2_GRID_SEGMENTS, 16#DD3). --define(GL_COEFF, 16#A00). --define(GL_ORDER, 16#A01). --define(GL_DOMAIN, 16#A02). --define(GL_PERSPECTIVE_CORRECTION_HINT, 16#C50). --define(GL_POINT_SMOOTH_HINT, 16#C51). --define(GL_LINE_SMOOTH_HINT, 16#C52). --define(GL_POLYGON_SMOOTH_HINT, 16#C53). --define(GL_FOG_HINT, 16#C54). +-define(GL_MAX_LIST_NESTING, 16#0B31). +-define(GL_MAX_EVAL_ORDER, 16#0D30). +-define(GL_MAX_LIGHTS, 16#0D31). +-define(GL_MAX_CLIP_PLANES, 16#0D32). +-define(GL_MAX_TEXTURE_SIZE, 16#0D33). +-define(GL_MAX_PIXEL_MAP_TABLE, 16#0D34). +-define(GL_MAX_ATTRIB_STACK_DEPTH, 16#0D35). +-define(GL_MAX_MODELVIEW_STACK_DEPTH, 16#0D36). +-define(GL_MAX_NAME_STACK_DEPTH, 16#0D37). +-define(GL_MAX_PROJECTION_STACK_DEPTH, 16#0D38). +-define(GL_MAX_TEXTURE_STACK_DEPTH, 16#0D39). +-define(GL_MAX_VIEWPORT_DIMS, 16#0D3A). +-define(GL_MAX_CLIENT_ATTRIB_STACK_DEPTH, 16#0D3B). +-define(GL_ATTRIB_STACK_DEPTH, 16#0BB0). +-define(GL_CLIENT_ATTRIB_STACK_DEPTH, 16#0BB1). +-define(GL_COLOR_CLEAR_VALUE, 16#0C22). +-define(GL_COLOR_WRITEMASK, 16#0C23). +-define(GL_CURRENT_INDEX, 16#0B01). +-define(GL_CURRENT_COLOR, 16#0B00). +-define(GL_CURRENT_NORMAL, 16#0B02). +-define(GL_CURRENT_RASTER_COLOR, 16#0B04). +-define(GL_CURRENT_RASTER_DISTANCE, 16#0B09). +-define(GL_CURRENT_RASTER_INDEX, 16#0B05). +-define(GL_CURRENT_RASTER_POSITION, 16#0B07). +-define(GL_CURRENT_RASTER_TEXTURE_COORDS, 16#0B06). +-define(GL_CURRENT_RASTER_POSITION_VALID, 16#0B08). +-define(GL_CURRENT_TEXTURE_COORDS, 16#0B03). +-define(GL_INDEX_CLEAR_VALUE, 16#0C20). +-define(GL_INDEX_MODE, 16#0C30). +-define(GL_INDEX_WRITEMASK, 16#0C21). +-define(GL_MODELVIEW_MATRIX, 16#0BA6). +-define(GL_MODELVIEW_STACK_DEPTH, 16#0BA3). +-define(GL_NAME_STACK_DEPTH, 16#0D70). +-define(GL_PROJECTION_MATRIX, 16#0BA7). +-define(GL_PROJECTION_STACK_DEPTH, 16#0BA4). +-define(GL_RENDER_MODE, 16#0C40). +-define(GL_RGBA_MODE, 16#0C31). +-define(GL_TEXTURE_MATRIX, 16#0BA8). +-define(GL_TEXTURE_STACK_DEPTH, 16#0BA5). +-define(GL_VIEWPORT, 16#0BA2). +-define(GL_AUTO_NORMAL, 16#0D80). +-define(GL_MAP1_COLOR_4, 16#0D90). +-define(GL_MAP1_INDEX, 16#0D91). +-define(GL_MAP1_NORMAL, 16#0D92). +-define(GL_MAP1_TEXTURE_COORD_1, 16#0D93). +-define(GL_MAP1_TEXTURE_COORD_2, 16#0D94). +-define(GL_MAP1_TEXTURE_COORD_3, 16#0D95). +-define(GL_MAP1_TEXTURE_COORD_4, 16#0D96). +-define(GL_MAP1_VERTEX_3, 16#0D97). +-define(GL_MAP1_VERTEX_4, 16#0D98). +-define(GL_MAP2_COLOR_4, 16#0DB0). +-define(GL_MAP2_INDEX, 16#0DB1). +-define(GL_MAP2_NORMAL, 16#0DB2). +-define(GL_MAP2_TEXTURE_COORD_1, 16#0DB3). +-define(GL_MAP2_TEXTURE_COORD_2, 16#0DB4). +-define(GL_MAP2_TEXTURE_COORD_3, 16#0DB5). +-define(GL_MAP2_TEXTURE_COORD_4, 16#0DB6). +-define(GL_MAP2_VERTEX_3, 16#0DB7). +-define(GL_MAP2_VERTEX_4, 16#0DB8). +-define(GL_MAP1_GRID_DOMAIN, 16#0DD0). +-define(GL_MAP1_GRID_SEGMENTS, 16#0DD1). +-define(GL_MAP2_GRID_DOMAIN, 16#0DD2). +-define(GL_MAP2_GRID_SEGMENTS, 16#0DD3). +-define(GL_COEFF, 16#0A00). +-define(GL_ORDER, 16#0A01). +-define(GL_DOMAIN, 16#0A02). +-define(GL_PERSPECTIVE_CORRECTION_HINT, 16#0C50). +-define(GL_POINT_SMOOTH_HINT, 16#0C51). +-define(GL_LINE_SMOOTH_HINT, 16#0C52). +-define(GL_POLYGON_SMOOTH_HINT, 16#0C53). +-define(GL_FOG_HINT, 16#0C54). -define(GL_DONT_CARE, 16#1100). -define(GL_FASTEST, 16#1101). -define(GL_NICEST, 16#1102). --define(GL_SCISSOR_BOX, 16#C10). --define(GL_SCISSOR_TEST, 16#C11). --define(GL_MAP_COLOR, 16#D10). --define(GL_MAP_STENCIL, 16#D11). --define(GL_INDEX_SHIFT, 16#D12). --define(GL_INDEX_OFFSET, 16#D13). --define(GL_RED_SCALE, 16#D14). --define(GL_RED_BIAS, 16#D15). --define(GL_GREEN_SCALE, 16#D18). --define(GL_GREEN_BIAS, 16#D19). --define(GL_BLUE_SCALE, 16#D1A). --define(GL_BLUE_BIAS, 16#D1B). --define(GL_ALPHA_SCALE, 16#D1C). --define(GL_ALPHA_BIAS, 16#D1D). --define(GL_DEPTH_SCALE, 16#D1E). --define(GL_DEPTH_BIAS, 16#D1F). --define(GL_PIXEL_MAP_S_TO_S_SIZE, 16#CB1). --define(GL_PIXEL_MAP_I_TO_I_SIZE, 16#CB0). --define(GL_PIXEL_MAP_I_TO_R_SIZE, 16#CB2). --define(GL_PIXEL_MAP_I_TO_G_SIZE, 16#CB3). --define(GL_PIXEL_MAP_I_TO_B_SIZE, 16#CB4). --define(GL_PIXEL_MAP_I_TO_A_SIZE, 16#CB5). --define(GL_PIXEL_MAP_R_TO_R_SIZE, 16#CB6). --define(GL_PIXEL_MAP_G_TO_G_SIZE, 16#CB7). --define(GL_PIXEL_MAP_B_TO_B_SIZE, 16#CB8). --define(GL_PIXEL_MAP_A_TO_A_SIZE, 16#CB9). --define(GL_PIXEL_MAP_S_TO_S, 16#C71). --define(GL_PIXEL_MAP_I_TO_I, 16#C70). --define(GL_PIXEL_MAP_I_TO_R, 16#C72). --define(GL_PIXEL_MAP_I_TO_G, 16#C73). --define(GL_PIXEL_MAP_I_TO_B, 16#C74). --define(GL_PIXEL_MAP_I_TO_A, 16#C75). --define(GL_PIXEL_MAP_R_TO_R, 16#C76). --define(GL_PIXEL_MAP_G_TO_G, 16#C77). --define(GL_PIXEL_MAP_B_TO_B, 16#C78). --define(GL_PIXEL_MAP_A_TO_A, 16#C79). --define(GL_PACK_ALIGNMENT, 16#D05). --define(GL_PACK_LSB_FIRST, 16#D01). --define(GL_PACK_ROW_LENGTH, 16#D02). --define(GL_PACK_SKIP_PIXELS, 16#D04). --define(GL_PACK_SKIP_ROWS, 16#D03). --define(GL_PACK_SWAP_BYTES, 16#D00). --define(GL_UNPACK_ALIGNMENT, 16#CF5). --define(GL_UNPACK_LSB_FIRST, 16#CF1). --define(GL_UNPACK_ROW_LENGTH, 16#CF2). --define(GL_UNPACK_SKIP_PIXELS, 16#CF4). --define(GL_UNPACK_SKIP_ROWS, 16#CF3). --define(GL_UNPACK_SWAP_BYTES, 16#CF0). --define(GL_ZOOM_X, 16#D16). --define(GL_ZOOM_Y, 16#D17). +-define(GL_SCISSOR_BOX, 16#0C10). +-define(GL_SCISSOR_TEST, 16#0C11). +-define(GL_MAP_COLOR, 16#0D10). +-define(GL_MAP_STENCIL, 16#0D11). +-define(GL_INDEX_SHIFT, 16#0D12). +-define(GL_INDEX_OFFSET, 16#0D13). +-define(GL_RED_SCALE, 16#0D14). +-define(GL_RED_BIAS, 16#0D15). +-define(GL_GREEN_SCALE, 16#0D18). +-define(GL_GREEN_BIAS, 16#0D19). +-define(GL_BLUE_SCALE, 16#0D1A). +-define(GL_BLUE_BIAS, 16#0D1B). +-define(GL_ALPHA_SCALE, 16#0D1C). +-define(GL_ALPHA_BIAS, 16#0D1D). +-define(GL_DEPTH_SCALE, 16#0D1E). +-define(GL_DEPTH_BIAS, 16#0D1F). +-define(GL_PIXEL_MAP_S_TO_S_SIZE, 16#0CB1). +-define(GL_PIXEL_MAP_I_TO_I_SIZE, 16#0CB0). +-define(GL_PIXEL_MAP_I_TO_R_SIZE, 16#0CB2). +-define(GL_PIXEL_MAP_I_TO_G_SIZE, 16#0CB3). +-define(GL_PIXEL_MAP_I_TO_B_SIZE, 16#0CB4). +-define(GL_PIXEL_MAP_I_TO_A_SIZE, 16#0CB5). +-define(GL_PIXEL_MAP_R_TO_R_SIZE, 16#0CB6). +-define(GL_PIXEL_MAP_G_TO_G_SIZE, 16#0CB7). +-define(GL_PIXEL_MAP_B_TO_B_SIZE, 16#0CB8). +-define(GL_PIXEL_MAP_A_TO_A_SIZE, 16#0CB9). +-define(GL_PIXEL_MAP_S_TO_S, 16#0C71). +-define(GL_PIXEL_MAP_I_TO_I, 16#0C70). +-define(GL_PIXEL_MAP_I_TO_R, 16#0C72). +-define(GL_PIXEL_MAP_I_TO_G, 16#0C73). +-define(GL_PIXEL_MAP_I_TO_B, 16#0C74). +-define(GL_PIXEL_MAP_I_TO_A, 16#0C75). +-define(GL_PIXEL_MAP_R_TO_R, 16#0C76). +-define(GL_PIXEL_MAP_G_TO_G, 16#0C77). +-define(GL_PIXEL_MAP_B_TO_B, 16#0C78). +-define(GL_PIXEL_MAP_A_TO_A, 16#0C79). +-define(GL_PACK_ALIGNMENT, 16#0D05). +-define(GL_PACK_LSB_FIRST, 16#0D01). +-define(GL_PACK_ROW_LENGTH, 16#0D02). +-define(GL_PACK_SKIP_PIXELS, 16#0D04). +-define(GL_PACK_SKIP_ROWS, 16#0D03). +-define(GL_PACK_SWAP_BYTES, 16#0D00). +-define(GL_UNPACK_ALIGNMENT, 16#0CF5). +-define(GL_UNPACK_LSB_FIRST, 16#0CF1). +-define(GL_UNPACK_ROW_LENGTH, 16#0CF2). +-define(GL_UNPACK_SKIP_PIXELS, 16#0CF4). +-define(GL_UNPACK_SKIP_ROWS, 16#0CF3). +-define(GL_UNPACK_SWAP_BYTES, 16#0CF0). +-define(GL_ZOOM_X, 16#0D16). +-define(GL_ZOOM_Y, 16#0D17). -define(GL_TEXTURE_ENV, 16#2300). -define(GL_TEXTURE_ENV_MODE, 16#2200). --define(GL_TEXTURE_1D, 16#DE0). --define(GL_TEXTURE_2D, 16#DE1). +-define(GL_TEXTURE_1D, 16#0DE0). +-define(GL_TEXTURE_2D, 16#0DE1). -define(GL_TEXTURE_WRAP_S, 16#2802). -define(GL_TEXTURE_WRAP_T, 16#2803). -define(GL_TEXTURE_MAG_FILTER, 16#2800). -define(GL_TEXTURE_MIN_FILTER, 16#2801). -define(GL_TEXTURE_ENV_COLOR, 16#2201). --define(GL_TEXTURE_GEN_S, 16#C60). --define(GL_TEXTURE_GEN_T, 16#C61). --define(GL_TEXTURE_GEN_R, 16#C62). --define(GL_TEXTURE_GEN_Q, 16#C63). +-define(GL_TEXTURE_GEN_S, 16#0C60). +-define(GL_TEXTURE_GEN_T, 16#0C61). +-define(GL_TEXTURE_GEN_R, 16#0C62). +-define(GL_TEXTURE_GEN_Q, 16#0C63). -define(GL_TEXTURE_GEN_MODE, 16#2500). -define(GL_TEXTURE_BORDER_COLOR, 16#1004). -define(GL_TEXTURE_WIDTH, 16#1000). @@ -482,33 +482,33 @@ -define(GL_VERSION, 16#1F02). -define(GL_EXTENSIONS, 16#1F03). -define(GL_NO_ERROR, 16#0). --define(GL_INVALID_ENUM, 16#500). --define(GL_INVALID_VALUE, 16#501). --define(GL_INVALID_OPERATION, 16#502). --define(GL_STACK_OVERFLOW, 16#503). --define(GL_STACK_UNDERFLOW, 16#504). --define(GL_OUT_OF_MEMORY, 16#505). --define(GL_CURRENT_BIT, 16#1). --define(GL_POINT_BIT, 16#2). --define(GL_LINE_BIT, 16#4). --define(GL_POLYGON_BIT, 16#8). --define(GL_POLYGON_STIPPLE_BIT, 16#10). --define(GL_PIXEL_MODE_BIT, 16#20). --define(GL_LIGHTING_BIT, 16#40). --define(GL_FOG_BIT, 16#80). --define(GL_DEPTH_BUFFER_BIT, 16#100). --define(GL_ACCUM_BUFFER_BIT, 16#200). --define(GL_STENCIL_BUFFER_BIT, 16#400). --define(GL_VIEWPORT_BIT, 16#800). --define(GL_TRANSFORM_BIT, 16#1000). --define(GL_ENABLE_BIT, 16#2000). --define(GL_COLOR_BUFFER_BIT, 16#4000). --define(GL_HINT_BIT, 16#8000). --define(GL_EVAL_BIT, 16#10000). --define(GL_LIST_BIT, 16#20000). --define(GL_TEXTURE_BIT, 16#40000). --define(GL_SCISSOR_BIT, 16#80000). --define(GL_ALL_ATTRIB_BITS, 16#FFFFF). +-define(GL_INVALID_ENUM, 16#0500). +-define(GL_INVALID_VALUE, 16#0501). +-define(GL_INVALID_OPERATION, 16#0502). +-define(GL_STACK_OVERFLOW, 16#0503). +-define(GL_STACK_UNDERFLOW, 16#0504). +-define(GL_OUT_OF_MEMORY, 16#0505). +-define(GL_CURRENT_BIT, 16#00000001). +-define(GL_POINT_BIT, 16#00000002). +-define(GL_LINE_BIT, 16#00000004). +-define(GL_POLYGON_BIT, 16#00000008). +-define(GL_POLYGON_STIPPLE_BIT, 16#00000010). +-define(GL_PIXEL_MODE_BIT, 16#00000020). +-define(GL_LIGHTING_BIT, 16#00000040). +-define(GL_FOG_BIT, 16#00000080). +-define(GL_DEPTH_BUFFER_BIT, 16#00000100). +-define(GL_ACCUM_BUFFER_BIT, 16#00000200). +-define(GL_STENCIL_BUFFER_BIT, 16#00000400). +-define(GL_VIEWPORT_BIT, 16#00000800). +-define(GL_TRANSFORM_BIT, 16#00001000). +-define(GL_ENABLE_BIT, 16#00002000). +-define(GL_COLOR_BUFFER_BIT, 16#00004000). +-define(GL_HINT_BIT, 16#00008000). +-define(GL_EVAL_BIT, 16#00010000). +-define(GL_LIST_BIT, 16#00020000). +-define(GL_TEXTURE_BIT, 16#00040000). +-define(GL_SCISSOR_BIT, 16#00080000). +-define(GL_ALL_ATTRIB_BITS, 16#000FFFFF). -define(GL_PROXY_TEXTURE_1D, 16#8063). -define(GL_PROXY_TEXTURE_2D, 16#8064). -define(GL_TEXTURE_PRIORITY, 16#8066). @@ -549,8 +549,8 @@ -define(GL_RGB10_A2, 16#8059). -define(GL_RGBA12, 16#805A). -define(GL_RGBA16, 16#805B). --define(GL_CLIENT_PIXEL_STORE_BIT, 16#1). --define(GL_CLIENT_VERTEX_ARRAY_BIT, 16#2). +-define(GL_CLIENT_PIXEL_STORE_BIT, 16#00000001). +-define(GL_CLIENT_VERTEX_ARRAY_BIT, 16#00000002). -define(GL_ALL_CLIENT_ATTRIB_BITS, 16#FFFFFFFF). -define(GL_CLIENT_ALL_ATTRIB_BITS, 16#FFFFFFFF). -define(GL_RESCALE_NORMAL, 16#803A). @@ -578,10 +578,10 @@ -define(GL_TEXTURE_MAX_LOD, 16#813B). -define(GL_TEXTURE_BASE_LEVEL, 16#813C). -define(GL_TEXTURE_MAX_LEVEL, 16#813D). --define(GL_SMOOTH_POINT_SIZE_RANGE, 16#B12). --define(GL_SMOOTH_POINT_SIZE_GRANULARITY, 16#B13). --define(GL_SMOOTH_LINE_WIDTH_RANGE, 16#B22). --define(GL_SMOOTH_LINE_WIDTH_GRANULARITY, 16#B23). +-define(GL_SMOOTH_POINT_SIZE_RANGE, 16#0B12). +-define(GL_SMOOTH_POINT_SIZE_GRANULARITY, 16#0B13). +-define(GL_SMOOTH_LINE_WIDTH_RANGE, 16#0B22). +-define(GL_SMOOTH_LINE_WIDTH_GRANULARITY, 16#0B23). -define(GL_ALIASED_POINT_SIZE_RANGE, 16#846D). -define(GL_ALIASED_LINE_WIDTH_RANGE, 16#846E). -define(GL_PACK_SKIP_IMAGES, 16#806B). @@ -808,14 +808,14 @@ -define(GL_UNSIGNED_SHORT_15_1_MESA, 16#8753). -define(GL_UNSIGNED_SHORT_1_15_REV_MESA, 16#8754). -define(GL_MESA_program_debug, 1). --define(GL_FRAGMENT_PROGRAM_POSITION_MESA, 16#8BB0). --define(GL_FRAGMENT_PROGRAM_CALLBACK_MESA, 16#8BB1). --define(GL_FRAGMENT_PROGRAM_CALLBACK_FUNC_MESA, 16#8BB2). --define(GL_FRAGMENT_PROGRAM_CALLBACK_DATA_MESA, 16#8BB3). --define(GL_VERTEX_PROGRAM_POSITION_MESA, 16#8BB4). --define(GL_VERTEX_PROGRAM_CALLBACK_MESA, 16#8BB5). --define(GL_VERTEX_PROGRAM_CALLBACK_FUNC_MESA, 16#8BB6). --define(GL_VERTEX_PROGRAM_CALLBACK_DATA_MESA, 16#8BB7). +-define(GL_FRAGMENT_PROGRAM_POSITION_MESA, 16#8bb0). +-define(GL_FRAGMENT_PROGRAM_CALLBACK_MESA, 16#8bb1). +-define(GL_FRAGMENT_PROGRAM_CALLBACK_FUNC_MESA, 16#8bb2). +-define(GL_FRAGMENT_PROGRAM_CALLBACK_DATA_MESA, 16#8bb3). +-define(GL_VERTEX_PROGRAM_POSITION_MESA, 16#8bb4). +-define(GL_VERTEX_PROGRAM_CALLBACK_MESA, 16#8bb5). +-define(GL_VERTEX_PROGRAM_CALLBACK_FUNC_MESA, 16#8bb6). +-define(GL_VERTEX_PROGRAM_CALLBACK_DATA_MESA, 16#8bb7). -define(GL_MESA_texture_array, 1). -define(GL_TEXTURE_1D_ARRAY_EXT, 16#8C18). -define(GL_PROXY_TEXTURE_1D_ARRAY_EXT, 16#8C19). @@ -1034,14 +1034,14 @@ -define(GL_CLIP_DISTANCE5, 16#3005). -define(GL_CLIP_DISTANCE6, 16#3006). -define(GL_CLIP_DISTANCE7, 16#3007). --define(GL_MAX_CLIP_DISTANCES, 16#D32). +-define(GL_MAX_CLIP_DISTANCES, 16#0D32). -define(GL_MAJOR_VERSION, 16#821B). -define(GL_MINOR_VERSION, 16#821C). -define(GL_NUM_EXTENSIONS, 16#821D). -define(GL_CONTEXT_FLAGS, 16#821E). -define(GL_COMPRESSED_RED, 16#8225). -define(GL_COMPRESSED_RG, 16#8226). --define(GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT, 16#1). +-define(GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT, 16#0001). -define(GL_RGBA32F, 16#8814). -define(GL_RGB32F, 16#8815). -define(GL_RGBA16F, 16#881A). @@ -1159,12 +1159,12 @@ -define(GL_SIGNED_NORMALIZED, 16#8F9C). -define(GL_PRIMITIVE_RESTART, 16#8F9D). -define(GL_PRIMITIVE_RESTART_INDEX, 16#8F9E). --define(GL_CONTEXT_CORE_PROFILE_BIT, 16#1). --define(GL_CONTEXT_COMPATIBILITY_PROFILE_BIT, 16#2). --define(GL_LINES_ADJACENCY, 16#A). --define(GL_LINE_STRIP_ADJACENCY, 16#B). --define(GL_TRIANGLES_ADJACENCY, 16#C). --define(GL_TRIANGLE_STRIP_ADJACENCY, 16#D). +-define(GL_CONTEXT_CORE_PROFILE_BIT, 16#00000001). +-define(GL_CONTEXT_COMPATIBILITY_PROFILE_BIT, 16#00000002). +-define(GL_LINES_ADJACENCY, 16#000A). +-define(GL_LINE_STRIP_ADJACENCY, 16#000B). +-define(GL_TRIANGLES_ADJACENCY, 16#000C). +-define(GL_TRIANGLE_STRIP_ADJACENCY, 16#000D). -define(GL_PROGRAM_POINT_SIZE, 16#8642). -define(GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS, 16#8C29). -define(GL_FRAMEBUFFER_ATTACHMENT_LAYERED, 16#8DA7). @@ -1551,7 +1551,7 @@ -define(GL_DEPTH_COMPONENT32F, 16#8CAC). -define(GL_DEPTH32F_STENCIL8, 16#8CAD). -define(GL_FLOAT_32_UNSIGNED_INT_24_8_REV, 16#8DAD). --define(GL_INVALID_FRAMEBUFFER_OPERATION, 16#506). +-define(GL_INVALID_FRAMEBUFFER_OPERATION, 16#0506). -define(GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING, 16#8210). -define(GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE, 16#8211). -define(GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE, 16#8212). @@ -1632,10 +1632,10 @@ -define(GL_TEXTURE_LUMINANCE_TYPE, 16#8C14). -define(GL_TEXTURE_INTENSITY_TYPE, 16#8C15). -define(GL_FRAMEBUFFER_SRGB, 16#8DB9). --define(GL_LINES_ADJACENCY_ARB, 16#A). --define(GL_LINE_STRIP_ADJACENCY_ARB, 16#B). --define(GL_TRIANGLES_ADJACENCY_ARB, 16#C). --define(GL_TRIANGLE_STRIP_ADJACENCY_ARB, 16#D). +-define(GL_LINES_ADJACENCY_ARB, 16#000A). +-define(GL_LINE_STRIP_ADJACENCY_ARB, 16#000B). +-define(GL_TRIANGLES_ADJACENCY_ARB, 16#000C). +-define(GL_TRIANGLE_STRIP_ADJACENCY_ARB, 16#000D). -define(GL_PROGRAM_POINT_SIZE_ARB, 16#8642). -define(GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB, 16#8C29). -define(GL_FRAMEBUFFER_ATTACHMENT_LAYERED_ARB, 16#8DA7). @@ -1652,12 +1652,12 @@ -define(GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB, 16#8DE1). -define(GL_HALF_FLOAT, 16#140B). -define(GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB, 16#88FE). --define(GL_MAP_READ_BIT, 16#1). --define(GL_MAP_WRITE_BIT, 16#2). --define(GL_MAP_INVALIDATE_RANGE_BIT, 16#4). --define(GL_MAP_INVALIDATE_BUFFER_BIT, 16#8). --define(GL_MAP_FLUSH_EXPLICIT_BIT, 16#10). --define(GL_MAP_UNSYNCHRONIZED_BIT, 16#20). +-define(GL_MAP_READ_BIT, 16#0001). +-define(GL_MAP_WRITE_BIT, 16#0002). +-define(GL_MAP_INVALIDATE_RANGE_BIT, 16#0004). +-define(GL_MAP_INVALIDATE_BUFFER_BIT, 16#0008). +-define(GL_MAP_FLUSH_EXPLICIT_BIT, 16#0010). +-define(GL_MAP_UNSYNCHRONIZED_BIT, 16#0020). -define(GL_TEXTURE_BUFFER_ARB, 16#8C2A). -define(GL_MAX_TEXTURE_BUFFER_SIZE_ARB, 16#8C2B). -define(GL_TEXTURE_BINDING_BUFFER_ARB, 16#8C2C). @@ -1722,7 +1722,7 @@ -define(GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER, 16#8A44). -define(GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER, 16#8A45). -define(GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER, 16#8A46). --define(GL_INVALID_INDEX, 16#FFFFFFFF). +-define(GL_INVALID_INDEX, 16#FFFFFFFFu). -define(GL_COPY_READ_BUFFER, 16#8F36). -define(GL_COPY_WRITE_BUFFER, 16#8F37). -define(GL_DEPTH_CLAMP, 16#864F). @@ -1744,8 +1744,8 @@ -define(GL_TIMEOUT_EXPIRED, 16#911B). -define(GL_CONDITION_SATISFIED, 16#911C). -define(GL_WAIT_FAILED, 16#911D). --define(GL_SYNC_FLUSH_COMMANDS_BIT, 16#1). --define(GL_TIMEOUT_IGNORED, 16#FFFFFFFFFFFFFFFF). +-define(GL_SYNC_FLUSH_COMMANDS_BIT, 16#00000001). +-define(GL_TIMEOUT_IGNORED, 16#FFFFFFFFFFFFFFFFull). -define(GL_SAMPLE_POSITION, 16#8E50). -define(GL_SAMPLE_MASK, 16#8E51). -define(GL_SAMPLE_MASK_VALUE, 16#8E52). @@ -1828,7 +1828,7 @@ -define(GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS, 16#8DE8). -define(GL_NUM_COMPATIBLE_SUBROUTINES, 16#8E4A). -define(GL_COMPATIBLE_SUBROUTINES, 16#8E4B). --define(GL_PATCHES, 16#E). +-define(GL_PATCHES, 16#000E). -define(GL_PATCH_VERTICES, 16#8E72). -define(GL_PATCH_DEFAULT_INNER_LEVEL, 16#8E73). -define(GL_PATCH_DEFAULT_OUTER_LEVEL, 16#8E74). @@ -1884,11 +1884,11 @@ -define(GL_PROGRAM_BINARY_LENGTH, 16#8741). -define(GL_NUM_PROGRAM_BINARY_FORMATS, 16#87FE). -define(GL_PROGRAM_BINARY_FORMATS, 16#87FF). --define(GL_VERTEX_SHADER_BIT, 16#1). --define(GL_FRAGMENT_SHADER_BIT, 16#2). --define(GL_GEOMETRY_SHADER_BIT, 16#4). --define(GL_TESS_CONTROL_SHADER_BIT, 16#8). --define(GL_TESS_EVALUATION_SHADER_BIT, 16#10). +-define(GL_VERTEX_SHADER_BIT, 16#00000001). +-define(GL_FRAGMENT_SHADER_BIT, 16#00000002). +-define(GL_GEOMETRY_SHADER_BIT, 16#00000004). +-define(GL_TESS_CONTROL_SHADER_BIT, 16#00000008). +-define(GL_TESS_EVALUATION_SHADER_BIT, 16#00000010). -define(GL_ALL_SHADER_BITS, 16#FFFFFFFF). -define(GL_PROGRAM_SEPARABLE, 16#8258). -define(GL_ACTIVE_PROGRAM, 16#8259). @@ -1923,7 +1923,7 @@ -define(GL_DEBUG_SEVERITY_HIGH_ARB, 16#9146). -define(GL_DEBUG_SEVERITY_MEDIUM_ARB, 16#9147). -define(GL_DEBUG_SEVERITY_LOW_ARB, 16#9148). --define(GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB, 16#4). +-define(GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB, 16#00000004). -define(GL_LOSE_CONTEXT_ON_RESET_ARB, 16#8252). -define(GL_GUILTY_CONTEXT_RESET_ARB, 16#8253). -define(GL_INNOCENT_CONTEXT_RESET_ARB, 16#8254). @@ -1969,18 +1969,18 @@ -define(GL_ACTIVE_ATOMIC_COUNTER_BUFFERS, 16#92D9). -define(GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX, 16#92DA). -define(GL_UNSIGNED_INT_ATOMIC_COUNTER, 16#92DB). --define(GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT, 16#1). --define(GL_ELEMENT_ARRAY_BARRIER_BIT, 16#2). --define(GL_UNIFORM_BARRIER_BIT, 16#4). --define(GL_TEXTURE_FETCH_BARRIER_BIT, 16#8). --define(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT, 16#20). --define(GL_COMMAND_BARRIER_BIT, 16#40). --define(GL_PIXEL_BUFFER_BARRIER_BIT, 16#80). --define(GL_TEXTURE_UPDATE_BARRIER_BIT, 16#100). --define(GL_BUFFER_UPDATE_BARRIER_BIT, 16#200). --define(GL_FRAMEBUFFER_BARRIER_BIT, 16#400). --define(GL_TRANSFORM_FEEDBACK_BARRIER_BIT, 16#800). --define(GL_ATOMIC_COUNTER_BARRIER_BIT, 16#1000). +-define(GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT, 16#00000001). +-define(GL_ELEMENT_ARRAY_BARRIER_BIT, 16#00000002). +-define(GL_UNIFORM_BARRIER_BIT, 16#00000004). +-define(GL_TEXTURE_FETCH_BARRIER_BIT, 16#00000008). +-define(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT, 16#00000020). +-define(GL_COMMAND_BARRIER_BIT, 16#00000040). +-define(GL_PIXEL_BUFFER_BARRIER_BIT, 16#00000080). +-define(GL_TEXTURE_UPDATE_BARRIER_BIT, 16#00000100). +-define(GL_BUFFER_UPDATE_BARRIER_BIT, 16#00000200). +-define(GL_FRAMEBUFFER_BARRIER_BIT, 16#00000400). +-define(GL_TRANSFORM_FEEDBACK_BARRIER_BIT, 16#00000800). +-define(GL_ATOMIC_COUNTER_BARRIER_BIT, 16#00001000). -define(GL_ALL_BARRIER_BITS, 16#FFFFFFFF). -define(GL_MAX_IMAGE_UNITS, 16#8F38). -define(GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS, 16#8F39). @@ -2337,8 +2337,8 @@ -define(GL_FRAMEZOOM_SGIX, 16#818B). -define(GL_FRAMEZOOM_FACTOR_SGIX, 16#818C). -define(GL_MAX_FRAMEZOOM_FACTOR_SGIX, 16#818D). --define(GL_TEXTURE_DEFORMATION_BIT_SGIX, 16#1). --define(GL_GEOMETRY_DEFORMATION_BIT_SGIX, 16#2). +-define(GL_TEXTURE_DEFORMATION_BIT_SGIX, 16#00000001). +-define(GL_GEOMETRY_DEFORMATION_BIT_SGIX, 16#00000002). -define(GL_GEOMETRY_DEFORMATION_SGIX, 16#8194). -define(GL_TEXTURE_DEFORMATION_SGIX, 16#8195). -define(GL_DEFORMATIONS_MASK_SGIX, 16#8196). @@ -2377,24 +2377,24 @@ -define(GL_VERTEX_CONSISTENT_HINT_PGI, 16#1A22B). -define(GL_MATERIAL_SIDE_HINT_PGI, 16#1A22C). -define(GL_MAX_VERTEX_HINT_PGI, 16#1A22D). --define(GL_COLOR3_BIT_PGI, 16#10000). --define(GL_COLOR4_BIT_PGI, 16#20000). --define(GL_EDGEFLAG_BIT_PGI, 16#40000). --define(GL_INDEX_BIT_PGI, 16#80000). --define(GL_MAT_AMBIENT_BIT_PGI, 16#100000). --define(GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI, 16#200000). --define(GL_MAT_DIFFUSE_BIT_PGI, 16#400000). --define(GL_MAT_EMISSION_BIT_PGI, 16#800000). --define(GL_MAT_COLOR_INDEXES_BIT_PGI, 16#1000000). --define(GL_MAT_SHININESS_BIT_PGI, 16#2000000). --define(GL_MAT_SPECULAR_BIT_PGI, 16#4000000). --define(GL_NORMAL_BIT_PGI, 16#8000000). +-define(GL_COLOR3_BIT_PGI, 16#00010000). +-define(GL_COLOR4_BIT_PGI, 16#00020000). +-define(GL_EDGEFLAG_BIT_PGI, 16#00040000). +-define(GL_INDEX_BIT_PGI, 16#00080000). +-define(GL_MAT_AMBIENT_BIT_PGI, 16#00100000). +-define(GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI, 16#00200000). +-define(GL_MAT_DIFFUSE_BIT_PGI, 16#00400000). +-define(GL_MAT_EMISSION_BIT_PGI, 16#00800000). +-define(GL_MAT_COLOR_INDEXES_BIT_PGI, 16#01000000). +-define(GL_MAT_SHININESS_BIT_PGI, 16#02000000). +-define(GL_MAT_SPECULAR_BIT_PGI, 16#04000000). +-define(GL_NORMAL_BIT_PGI, 16#08000000). -define(GL_TEXCOORD1_BIT_PGI, 16#10000000). -define(GL_TEXCOORD2_BIT_PGI, 16#20000000). -define(GL_TEXCOORD3_BIT_PGI, 16#40000000). -define(GL_TEXCOORD4_BIT_PGI, 16#80000000). --define(GL_VERTEX23_BIT_PGI, 16#4). --define(GL_VERTEX4_BIT_PGI, 16#8). +-define(GL_VERTEX23_BIT_PGI, 16#00000004). +-define(GL_VERTEX4_BIT_PGI, 16#00000008). -define(GL_PREFER_DOUBLEBUFFER_HINT_PGI, 16#1A1F8). -define(GL_CONSERVE_MEMORY_HINT_PGI, 16#1A1FD). -define(GL_RECLAIM_MEMORY_HINT_PGI, 16#1A1FE). @@ -2591,9 +2591,9 @@ -define(GL_TEXTURE_CONSTANT_DATA_SUNX, 16#81D6). -define(GL_GLOBAL_ALPHA_SUN, 16#81D9). -define(GL_GLOBAL_ALPHA_FACTOR_SUN, 16#81DA). --define(GL_RESTART_SUN, 16#1). --define(GL_REPLACE_MIDDLE_SUN, 16#2). --define(GL_REPLACE_OLDEST_SUN, 16#3). +-define(GL_RESTART_SUN, 16#0001). +-define(GL_REPLACE_MIDDLE_SUN, 16#0002). +-define(GL_REPLACE_OLDEST_SUN, 16#0003). -define(GL_TRIANGLE_LIST_SUN, 16#81D7). -define(GL_REPLACEMENT_CODE_SUN, 16#81D8). -define(GL_REPLACEMENT_CODE_ARRAY_SUN, 16#85C0). @@ -3112,19 +3112,19 @@ -define(GL_SWIZZLE_STQ_DQ_ATI, 16#8979). -define(GL_SWIZZLE_STRQ_ATI, 16#897A). -define(GL_SWIZZLE_STRQ_DQ_ATI, 16#897B). --define(GL_RED_BIT_ATI, 16#1). --define(GL_GREEN_BIT_ATI, 16#2). --define(GL_BLUE_BIT_ATI, 16#4). --define(GL_2X_BIT_ATI, 16#1). --define(GL_4X_BIT_ATI, 16#2). --define(GL_8X_BIT_ATI, 16#4). --define(GL_HALF_BIT_ATI, 16#8). --define(GL_QUARTER_BIT_ATI, 16#10). --define(GL_EIGHTH_BIT_ATI, 16#20). --define(GL_SATURATE_BIT_ATI, 16#40). --define(GL_COMP_BIT_ATI, 16#2). --define(GL_NEGATE_BIT_ATI, 16#4). --define(GL_BIAS_BIT_ATI, 16#8). +-define(GL_RED_BIT_ATI, 16#00000001). +-define(GL_GREEN_BIT_ATI, 16#00000002). +-define(GL_BLUE_BIT_ATI, 16#00000004). +-define(GL_2X_BIT_ATI, 16#00000001). +-define(GL_4X_BIT_ATI, 16#00000002). +-define(GL_8X_BIT_ATI, 16#00000004). +-define(GL_HALF_BIT_ATI, 16#00000008). +-define(GL_QUARTER_BIT_ATI, 16#00000010). +-define(GL_EIGHTH_BIT_ATI, 16#00000020). +-define(GL_SATURATE_BIT_ATI, 16#00000040). +-define(GL_COMP_BIT_ATI, 16#00000002). +-define(GL_NEGATE_BIT_ATI, 16#00000004). +-define(GL_BIAS_BIT_ATI, 16#00000008). -define(GL_PN_TRIANGLES_ATI, 16#87F0). -define(GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI, 16#87F1). -define(GL_PN_TRIANGLES_POINT_MODE_ATI, 16#87F2). @@ -3409,7 +3409,7 @@ -define(GL_MAX_PROGRAM_IF_DEPTH_NV, 16#88F6). -define(GL_MAX_PROGRAM_LOOP_DEPTH_NV, 16#88F7). -define(GL_MAX_PROGRAM_LOOP_COUNT_NV, 16#88F8). --define(GL_INVALID_FRAMEBUFFER_OPERATION_EXT, 16#506). +-define(GL_INVALID_FRAMEBUFFER_OPERATION_EXT, 16#0506). -define(GL_MAX_RENDERBUFFER_SIZE_EXT, 16#84E8). -define(GL_FRAMEBUFFER_BINDING_EXT, 16#8CA6). -define(GL_RENDERBUFFER_BINDING_EXT, 16#8CA7). @@ -3506,10 +3506,10 @@ -define(GL_MAX_PROGRAM_RESULT_COMPONENTS_NV, 16#8909). -define(GL_MAX_PROGRAM_GENERIC_ATTRIBS_NV, 16#8DA5). -define(GL_MAX_PROGRAM_GENERIC_RESULTS_NV, 16#8DA6). --define(GL_LINES_ADJACENCY_EXT, 16#A). --define(GL_LINE_STRIP_ADJACENCY_EXT, 16#B). --define(GL_TRIANGLES_ADJACENCY_EXT, 16#C). --define(GL_TRIANGLE_STRIP_ADJACENCY_EXT, 16#D). +-define(GL_LINES_ADJACENCY_EXT, 16#000A). +-define(GL_LINE_STRIP_ADJACENCY_EXT, 16#000B). +-define(GL_TRIANGLES_ADJACENCY_EXT, 16#000C). +-define(GL_TRIANGLE_STRIP_ADJACENCY_EXT, 16#000D). -define(GL_GEOMETRY_PROGRAM_NV, 16#8C26). -define(GL_MAX_PROGRAM_OUTPUT_VERTICES_NV, 16#8C27). -define(GL_MAX_PROGRAM_TOTAL_OUTPUT_COMPONENTS_NV, 16#8C28). @@ -3891,18 +3891,18 @@ -define(GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT, 16#906C). -define(GL_MAX_IMAGE_SAMPLES_EXT, 16#906D). -define(GL_IMAGE_BINDING_FORMAT_EXT, 16#906E). --define(GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT_EXT, 16#1). --define(GL_ELEMENT_ARRAY_BARRIER_BIT_EXT, 16#2). --define(GL_UNIFORM_BARRIER_BIT_EXT, 16#4). --define(GL_TEXTURE_FETCH_BARRIER_BIT_EXT, 16#8). --define(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT_EXT, 16#20). --define(GL_COMMAND_BARRIER_BIT_EXT, 16#40). --define(GL_PIXEL_BUFFER_BARRIER_BIT_EXT, 16#80). --define(GL_TEXTURE_UPDATE_BARRIER_BIT_EXT, 16#100). --define(GL_BUFFER_UPDATE_BARRIER_BIT_EXT, 16#200). --define(GL_FRAMEBUFFER_BARRIER_BIT_EXT, 16#400). --define(GL_TRANSFORM_FEEDBACK_BARRIER_BIT_EXT, 16#800). --define(GL_ATOMIC_COUNTER_BARRIER_BIT_EXT, 16#1000). +-define(GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT_EXT, 16#00000001). +-define(GL_ELEMENT_ARRAY_BARRIER_BIT_EXT, 16#00000002). +-define(GL_UNIFORM_BARRIER_BIT_EXT, 16#00000004). +-define(GL_TEXTURE_FETCH_BARRIER_BIT_EXT, 16#00000008). +-define(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT_EXT, 16#00000020). +-define(GL_COMMAND_BARRIER_BIT_EXT, 16#00000040). +-define(GL_PIXEL_BUFFER_BARRIER_BIT_EXT, 16#00000080). +-define(GL_TEXTURE_UPDATE_BARRIER_BIT_EXT, 16#00000100). +-define(GL_BUFFER_UPDATE_BARRIER_BIT_EXT, 16#00000200). +-define(GL_FRAMEBUFFER_BARRIER_BIT_EXT, 16#00000400). +-define(GL_TRANSFORM_FEEDBACK_BARRIER_BIT_EXT, 16#00000800). +-define(GL_ATOMIC_COUNTER_BARRIER_BIT_EXT, 16#00001000). -define(GL_ALL_BARRIER_BITS_EXT, 16#FFFFFFFF). -define(GL_DOUBLE_VEC2_EXT, 16#8FFC). -define(GL_DOUBLE_VEC3_EXT, 16#8FFD). @@ -3952,7 +3952,7 @@ -define(GL_FLOAT16_VEC2_NV, 16#8FF9). -define(GL_FLOAT16_VEC3_NV, 16#8FFA). -define(GL_FLOAT16_VEC4_NV, 16#8FFB). --define(GL_SHADER_GLOBAL_ACCESS_BARRIER_BIT_NV, 16#10). +-define(GL_SHADER_GLOBAL_ACCESS_BARRIER_BIT_NV, 16#00000010). -define(GL_MAX_PROGRAM_PATCH_ATTRIBS_NV, 16#86D8). -define(GL_TESS_CONTROL_PROGRAM_NV, 16#891E). -define(GL_TESS_EVALUATION_PROGRAM_NV, 16#891F). diff --git a/lib/wx/include/glu.hrl b/lib/wx/include/glu.hrl index a2ab55d054..dc55c5bb96 100644 --- a/lib/wx/include/glu.hrl +++ b/lib/wx/include/glu.hrl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2010. All Rights Reserved. +%% Copyright Ericsson AB 2008-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -174,4 +174,4 @@ -define(GLU_TESS_WINDING_POSITIVE, 100132). -define(GLU_TESS_WINDING_NEGATIVE, 100133). -define(GLU_TESS_WINDING_ABS_GEQ_TWO, 100134). --define(GLU_TESS_MAX_COORD, ?1.0e150). +-define(GLU_TESS_MAX_COORD, 1.0e150). diff --git a/lib/wx/include/wx.hrl b/lib/wx/include/wx.hrl index fba99a1f07..62979908a6 100644 --- a/lib/wx/include/wx.hrl +++ b/lib/wx/include/wx.hrl @@ -316,12 +316,13 @@ -type wxEventType() :: wxAuiManagerEventType() | wxAuiNotebookEventType() | wxCalendarEventType() | wxChildFocusEventType() | wxCloseEventType() | wxColourPickerEventType() | wxCommandEventType() | wxContextMenuEventType() | wxDateEventType() | wxDisplayChangedEventType() | wxEraseEventType() | wxFileDirPickerEventType() | wxFocusEventType() | wxFontPickerEventType() | wxGridEventType() | wxHelpEventType() | wxHtmlLinkEventType() | wxIconizeEventType() | wxIdleEventType() | wxJoystickEventType() | wxKeyEventType() | wxListEventType() | wxMaximizeEventType() | wxMenuEventType() | wxMouseCaptureChangedEventType() | wxMouseEventType() | wxMoveEventType() | wxNavigationKeyEventType() | wxNcPaintEventType() | wxNotebookEventType() | wxPaintEventType() | wxPaletteChangedEventType() | wxQueryNewPaletteEventType() | wxSashEventType() | wxScrollEventType() | wxScrollWinEventType() | wxSetCursorEventType() | wxShowEventType() | wxSizeEventType() | wxSpinEventType() | wxSplitterEventType() | wxStyledTextEventType() | wxSysColourChangedEventType() | wxTaskBarIconEventType() | wxTreeEventType() | wxUpdateUIEventType() | wxWindowCreateEventType() | wxWindowDestroyEventType(). %% Hardcoded Records --record(wxMouseState, {x, y, %% integer() - leftDown, middleDown, rightDown, %% bool() - controlDown, shiftDown, altDown, metaDown, cmdDown %% bool() +-record(wxMouseState, {x :: integer(), y :: integer(), + leftDown :: boolean(), middleDown :: boolean, rightDown :: boolean, + controlDown :: boolean(), shiftDown :: boolean(), + altDown :: boolean(), metaDown :: boolean(), cmdDown :: boolean() }). -record(wxHtmlLinkInfo, { - href, target %% unicode:chardata() + href :: unicode:chardata(), target :: unicode:chardata() }). %% Hardcoded Defines @@ -984,7 +985,7 @@ -define(wxRESET, 16384). -define(wxBACKWARD, 8192). -define(wxFORWARD, 4096). --define(wxICON_MASK, (?16#00000100 bor ?16#00000200 bor ?16#00000400 bor ?16#00000800)). +-define(wxICON_MASK, (16#00000100 bor 16#00000200 bor 16#00000400 bor 16#00000800)). -define(wxICON_ASTERISK, ?wxICON_INFORMATION). -define(wxICON_STOP, ?wxICON_HAND). -define(wxICON_INFORMATION, 2048). diff --git a/lib/wx/src/gen/wxAuiManager.erl b/lib/wx/src/gen/wxAuiManager.erl index 95dd5d64a5..71e851f706 100644 --- a/lib/wx/src/gen/wxAuiManager.erl +++ b/lib/wx/src/gen/wxAuiManager.erl @@ -119,7 +119,7 @@ detachPane(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=WindowT,ref=WindowRef}) <<ThisRef:32/?UI,WindowRef:32/?UI>>). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxauimanager.html#wxauimanagergetallpanes">external documentation</a>. --spec getAllPanes(This) -> wxAuiPaneInfoArray:wxAuiPaneInfoArray() when +-spec getAllPanes(This) -> wx:wx_object() when This::wxAuiManager(). getAllPanes(#wx_ref{type=ThisT,ref=ThisRef}) -> ?CLASS(ThisT,wxAuiManager), diff --git a/lib/wx/src/gen/wxBitmapButton.erl b/lib/wx/src/gen/wxBitmapButton.erl index 79e51da801..ddddbbc1dd 100644 --- a/lib/wx/src/gen/wxBitmapButton.erl +++ b/lib/wx/src/gen/wxBitmapButton.erl @@ -101,7 +101,7 @@ new(Parent,Id,Bitmap) Option :: {pos, {X::integer(), Y::integer()}} | {size, {W::integer(), H::integer()}} | {style, integer()} - | {validator, wx:wx()}. + | {validator, wx:wx_object()}. new(#wx_ref{type=ParentT,ref=ParentRef},Id,#wx_ref{type=BitmapT,ref=BitmapRef}, Options) when is_integer(Id),is_list(Options) -> ?CLASS(ParentT,wxWindow), @@ -129,7 +129,7 @@ create(This,Parent,Id,Bitmap) Option :: {pos, {X::integer(), Y::integer()}} | {size, {W::integer(), H::integer()}} | {style, integer()} - | {validator, wx:wx()}. + | {validator, wx:wx_object()}. create(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=ParentT,ref=ParentRef},Id,#wx_ref{type=BitmapT,ref=BitmapRef}, Options) when is_integer(Id),is_list(Options) -> ?CLASS(ThisT,wxBitmapButton), diff --git a/lib/wx/src/gen/wxButton.erl b/lib/wx/src/gen/wxButton.erl index ae78f53e6f..a27e5d91c2 100644 --- a/lib/wx/src/gen/wxButton.erl +++ b/lib/wx/src/gen/wxButton.erl @@ -99,7 +99,7 @@ new(Parent,Id) | {pos, {X::integer(), Y::integer()}} | {size, {W::integer(), H::integer()}} | {style, integer()} - | {validator, wx:wx()}. + | {validator, wx:wx_object()}. new(#wx_ref{type=ParentT,ref=ParentRef},Id, Options) when is_integer(Id),is_list(Options) -> ?CLASS(ParentT,wxWindow), @@ -128,7 +128,7 @@ create(This,Parent,Id) | {pos, {X::integer(), Y::integer()}} | {size, {W::integer(), H::integer()}} | {style, integer()} - | {validator, wx:wx()}. + | {validator, wx:wx_object()}. create(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=ParentT,ref=ParentRef},Id, Options) when is_integer(Id),is_list(Options) -> ?CLASS(ThisT,wxButton), diff --git a/lib/wx/src/gen/wxCheckBox.erl b/lib/wx/src/gen/wxCheckBox.erl index 37bca77cae..6e30f14207 100644 --- a/lib/wx/src/gen/wxCheckBox.erl +++ b/lib/wx/src/gen/wxCheckBox.erl @@ -99,7 +99,7 @@ new(Parent,Id,Label) Option :: {pos, {X::integer(), Y::integer()}} | {size, {W::integer(), H::integer()}} | {style, integer()} - | {validator, wx:wx()}. + | {validator, wx:wx_object()}. new(#wx_ref{type=ParentT,ref=ParentRef},Id,Label, Options) when is_integer(Id),is_list(Label),is_list(Options) -> ?CLASS(ParentT,wxWindow), @@ -127,7 +127,7 @@ create(This,Parent,Id,Label) Option :: {pos, {X::integer(), Y::integer()}} | {size, {W::integer(), H::integer()}} | {style, integer()} - | {validator, wx:wx()}. + | {validator, wx:wx_object()}. create(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=ParentT,ref=ParentRef},Id,Label, Options) when is_integer(Id),is_list(Label),is_list(Options) -> ?CLASS(ThisT,wxCheckBox), diff --git a/lib/wx/src/gen/wxCheckListBox.erl b/lib/wx/src/gen/wxCheckListBox.erl index 71199fed3b..083a9e32f4 100644 --- a/lib/wx/src/gen/wxCheckListBox.erl +++ b/lib/wx/src/gen/wxCheckListBox.erl @@ -106,7 +106,7 @@ new(Parent,Id) | {size, {W::integer(), H::integer()}} | {choices, [[unicode:chardata()]]} | {style, integer()} - | {validator, wx:wx()}. + | {validator, wx:wx_object()}. new(#wx_ref{type=ParentT,ref=ParentRef},Id, Options) when is_integer(Id),is_list(Options) -> ?CLASS(ParentT,wxWindow), diff --git a/lib/wx/src/gen/wxChoice.erl b/lib/wx/src/gen/wxChoice.erl index b9cac3926c..2a2b2688fe 100644 --- a/lib/wx/src/gen/wxChoice.erl +++ b/lib/wx/src/gen/wxChoice.erl @@ -104,7 +104,7 @@ new(Parent,Id) | {size, {W::integer(), H::integer()}} | {choices, [[unicode:chardata()]]} | {style, integer()} - | {validator, wx:wx()}. + | {validator, wx:wx_object()}. new(#wx_ref{type=ParentT,ref=ParentRef},Id, Options) when is_integer(Id),is_list(Options) -> ?CLASS(ParentT,wxWindow), @@ -130,7 +130,7 @@ create(This,Parent,Id,Pos={PosX,PosY},Size={SizeW,SizeH},Choices) -spec create(This, Parent, Id, Pos, Size, Choices, [Option]) -> boolean() when This::wxChoice(), Parent::wxWindow:wxWindow(), Id::integer(), Pos::{X::integer(), Y::integer()}, Size::{W::integer(), H::integer()}, Choices::[[unicode:chardata()]], Option :: {style, integer()} - | {validator, wx:wx()}. + | {validator, wx:wx_object()}. create(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=ParentT,ref=ParentRef},Id,{PosX,PosY},{SizeW,SizeH},Choices, Options) when is_integer(Id),is_integer(PosX),is_integer(PosY),is_integer(SizeW),is_integer(SizeH),is_list(Choices),is_list(Options) -> ?CLASS(ThisT,wxChoice), diff --git a/lib/wx/src/gen/wxColourPickerCtrl.erl b/lib/wx/src/gen/wxColourPickerCtrl.erl index 5fd51eba15..1ba771695f 100644 --- a/lib/wx/src/gen/wxColourPickerCtrl.erl +++ b/lib/wx/src/gen/wxColourPickerCtrl.erl @@ -104,7 +104,7 @@ new(Parent,Id) | {pos, {X::integer(), Y::integer()}} | {size, {W::integer(), H::integer()}} | {style, integer()} - | {validator, wx:wx()}. + | {validator, wx:wx_object()}. new(#wx_ref{type=ParentT,ref=ParentRef},Id, Options) when is_integer(Id),is_list(Options) -> ?CLASS(ParentT,wxWindow), @@ -133,7 +133,7 @@ create(This,Parent,Id) | {pos, {X::integer(), Y::integer()}} | {size, {W::integer(), H::integer()}} | {style, integer()} - | {validator, wx:wx()}. + | {validator, wx:wx_object()}. create(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=ParentT,ref=ParentRef},Id, Options) when is_integer(Id),is_list(Options) -> ?CLASS(ThisT,wxColourPickerCtrl), diff --git a/lib/wx/src/gen/wxComboBox.erl b/lib/wx/src/gen/wxComboBox.erl index b9224d18b9..c67ff82bbc 100644 --- a/lib/wx/src/gen/wxComboBox.erl +++ b/lib/wx/src/gen/wxComboBox.erl @@ -107,7 +107,7 @@ new(Parent,Id) | {size, {W::integer(), H::integer()}} | {choices, [[unicode:chardata()]]} | {style, integer()} - | {validator, wx:wx()}. + | {validator, wx:wx_object()}. new(#wx_ref{type=ParentT,ref=ParentRef},Id, Options) when is_integer(Id),is_list(Options) -> ?CLASS(ParentT,wxWindow), @@ -134,7 +134,7 @@ create(This,Parent,Id,Value,Pos={PosX,PosY},Size={SizeW,SizeH},Choices) -spec create(This, Parent, Id, Value, Pos, Size, Choices, [Option]) -> boolean() when This::wxComboBox(), Parent::wxWindow:wxWindow(), Id::integer(), Value::unicode:chardata(), Pos::{X::integer(), Y::integer()}, Size::{W::integer(), H::integer()}, Choices::[[unicode:chardata()]], Option :: {style, integer()} - | {validator, wx:wx()}. + | {validator, wx:wx_object()}. create(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=ParentT,ref=ParentRef},Id,Value,{PosX,PosY},{SizeW,SizeH},Choices, Options) when is_integer(Id),is_list(Value),is_integer(PosX),is_integer(PosY),is_integer(SizeW),is_integer(SizeH),is_list(Choices),is_list(Options) -> ?CLASS(ThisT,wxComboBox), diff --git a/lib/wx/src/gen/wxDatePickerCtrl.erl b/lib/wx/src/gen/wxDatePickerCtrl.erl index ad66d1cf03..6ffc2ca3f5 100644 --- a/lib/wx/src/gen/wxDatePickerCtrl.erl +++ b/lib/wx/src/gen/wxDatePickerCtrl.erl @@ -104,7 +104,7 @@ new(Parent,Id) | {pos, {X::integer(), Y::integer()}} | {size, {W::integer(), H::integer()}} | {style, integer()} - | {validator, wx:wx()}. + | {validator, wx:wx_object()}. new(#wx_ref{type=ParentT,ref=ParentRef},Id, Options) when is_integer(Id),is_list(Options) -> ?CLASS(ParentT,wxWindow), diff --git a/lib/wx/src/gen/wxDirPickerCtrl.erl b/lib/wx/src/gen/wxDirPickerCtrl.erl index 5bc79ca7a1..bbc169ae03 100644 --- a/lib/wx/src/gen/wxDirPickerCtrl.erl +++ b/lib/wx/src/gen/wxDirPickerCtrl.erl @@ -105,7 +105,7 @@ new(Parent,Id) | {pos, {X::integer(), Y::integer()}} | {size, {W::integer(), H::integer()}} | {style, integer()} - | {validator, wx:wx()}. + | {validator, wx:wx_object()}. new(#wx_ref{type=ParentT,ref=ParentRef},Id, Options) when is_integer(Id),is_list(Options) -> ?CLASS(ParentT,wxWindow), @@ -136,7 +136,7 @@ create(This,Parent,Id) | {pos, {X::integer(), Y::integer()}} | {size, {W::integer(), H::integer()}} | {style, integer()} - | {validator, wx:wx()}. + | {validator, wx:wx_object()}. create(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=ParentT,ref=ParentRef},Id, Options) when is_integer(Id),is_list(Options) -> ?CLASS(ThisT,wxDirPickerCtrl), diff --git a/lib/wx/src/gen/wxFilePickerCtrl.erl b/lib/wx/src/gen/wxFilePickerCtrl.erl index f13c20f6c7..d19c8c00cb 100644 --- a/lib/wx/src/gen/wxFilePickerCtrl.erl +++ b/lib/wx/src/gen/wxFilePickerCtrl.erl @@ -106,7 +106,7 @@ new(Parent,Id) | {pos, {X::integer(), Y::integer()}} | {size, {W::integer(), H::integer()}} | {style, integer()} - | {validator, wx:wx()}. + | {validator, wx:wx_object()}. new(#wx_ref{type=ParentT,ref=ParentRef},Id, Options) when is_integer(Id),is_list(Options) -> ?CLASS(ParentT,wxWindow), @@ -139,7 +139,7 @@ create(This,Parent,Id) | {pos, {X::integer(), Y::integer()}} | {size, {W::integer(), H::integer()}} | {style, integer()} - | {validator, wx:wx()}. + | {validator, wx:wx_object()}. create(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=ParentT,ref=ParentRef},Id, Options) when is_integer(Id),is_list(Options) -> ?CLASS(ThisT,wxFilePickerCtrl), diff --git a/lib/wx/src/gen/wxFontPickerCtrl.erl b/lib/wx/src/gen/wxFontPickerCtrl.erl index 2659d4e2e3..46c0dbab4d 100644 --- a/lib/wx/src/gen/wxFontPickerCtrl.erl +++ b/lib/wx/src/gen/wxFontPickerCtrl.erl @@ -105,7 +105,7 @@ new(Parent,Id) | {pos, {X::integer(), Y::integer()}} | {size, {W::integer(), H::integer()}} | {style, integer()} - | {validator, wx:wx()}. + | {validator, wx:wx_object()}. new(#wx_ref{type=ParentT,ref=ParentRef},Id, Options) when is_integer(Id),is_list(Options) -> ?CLASS(ParentT,wxWindow), @@ -134,7 +134,7 @@ create(This,Parent,Id) | {pos, {X::integer(), Y::integer()}} | {size, {W::integer(), H::integer()}} | {style, integer()} - | {validator, wx:wx()}. + | {validator, wx:wx_object()}. create(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=ParentT,ref=ParentRef},Id, Options) when is_integer(Id),is_list(Options) -> ?CLASS(ThisT,wxFontPickerCtrl), diff --git a/lib/wx/src/gen/wxGLCanvas.erl b/lib/wx/src/gen/wxGLCanvas.erl index 3a9cb39020..46168374af 100644 --- a/lib/wx/src/gen/wxGLCanvas.erl +++ b/lib/wx/src/gen/wxGLCanvas.erl @@ -96,7 +96,7 @@ new(Parent) %% | {palette, wxPalette:wxPalette()}.<br /> %% -spec new(Parent, Shared) -> wxGLCanvas() when - Parent::wxWindow:wxWindow(), Shared::wxGLContext:wxGLContext() | wxGLCanvas(); + Parent::wxWindow:wxWindow(), Shared::wx:wx_object() | wxGLCanvas(); (Parent, [Option]) -> wxGLCanvas() when Parent::wxWindow:wxWindow(), Option :: {id, integer()} @@ -128,7 +128,7 @@ new(#wx_ref{type=ParentT,ref=ParentRef}, Options) %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxglcanvas.html#wxglcanvaswxglcanvas">external documentation</a>. -spec new(Parent, Shared, [Option]) -> wxGLCanvas() when - Parent::wxWindow:wxWindow(), Shared::wxGLContext:wxGLContext() | wxGLCanvas(), + Parent::wxWindow:wxWindow(), Shared::wx:wx_object() | wxGLCanvas(), Option :: {id, integer()} | {pos, {X::integer(), Y::integer()}} | {size, {W::integer(), H::integer()}} @@ -159,7 +159,7 @@ new(#wx_ref{type=ParentT,ref=ParentRef},#wx_ref{type=SharedT,ref=SharedRef}, Opt <<ParentRef:32/?UI,SharedRef:32/?UI, BinOpt/binary>>). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxglcanvas.html#wxglcanvasgetcontext">external documentation</a>. --spec getContext(This) -> wxGLContext:wxGLContext() when +-spec getContext(This) -> wx:wx_object() when This::wxGLCanvas(). getContext(#wx_ref{type=ThisT,ref=ThisRef}) -> ?CLASS(ThisT,wxGLCanvas), diff --git a/lib/wx/src/gen/wxGauge.erl b/lib/wx/src/gen/wxGauge.erl index c35a2574f6..7f892355c7 100644 --- a/lib/wx/src/gen/wxGauge.erl +++ b/lib/wx/src/gen/wxGauge.erl @@ -99,7 +99,7 @@ new(Parent,Id,Range) Option :: {pos, {X::integer(), Y::integer()}} | {size, {W::integer(), H::integer()}} | {style, integer()} - | {validator, wx:wx()}. + | {validator, wx:wx_object()}. new(#wx_ref{type=ParentT,ref=ParentRef},Id,Range, Options) when is_integer(Id),is_integer(Range),is_list(Options) -> ?CLASS(ParentT,wxWindow), @@ -126,7 +126,7 @@ create(This,Parent,Id,Range) Option :: {pos, {X::integer(), Y::integer()}} | {size, {W::integer(), H::integer()}} | {style, integer()} - | {validator, wx:wx()}. + | {validator, wx:wx_object()}. create(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=ParentT,ref=ParentRef},Id,Range, Options) when is_integer(Id),is_integer(Range),is_list(Options) -> ?CLASS(ThisT,wxGauge), diff --git a/lib/wx/src/gen/wxGridBagSizer.erl b/lib/wx/src/gen/wxGridBagSizer.erl index 6a978efc85..e8a9ff6d76 100644 --- a/lib/wx/src/gen/wxGridBagSizer.erl +++ b/lib/wx/src/gen/wxGridBagSizer.erl @@ -98,7 +98,7 @@ add(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=ItemT,ref=ItemRef}) -> %% Option :: {proportion, integer()}<br /> %% | {flag, integer()}<br /> %% | {border, integer()}<br /> -%% | {userData, wx:wx()}.<br /> +%% | {userData, wx:wx_object()}.<br /> %% -spec add(This, Width, Height) -> wxSizerItem:wxSizerItem() when This::wxGridBagSizer(), Width::integer(), Height::integer(); @@ -109,7 +109,7 @@ add(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=ItemT,ref=ItemRef}) -> Option :: {proportion, integer()} | {flag, integer()} | {border, integer()} - | {userData, wx:wx()}. + | {userData, wx:wx_object()}. add(This,Width,Height) when is_record(This, wx_ref),is_integer(Width),is_integer(Height) -> @@ -143,13 +143,13 @@ add(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=WindowT,ref=WindowRef}, Options %% Option :: {proportion, integer()}<br /> %% | {flag, integer()}<br /> %% | {border, integer()}<br /> -%% | {userData, wx:wx()};<br /> +%% | {userData, wx:wx_object()};<br /> %% (This, Window, Pos, [Option]) -> wxSizerItem:wxSizerItem() when<br /> %% This::wxGridBagSizer(), Window::wxWindow:wxWindow() | wxSizer:wxSizer(), Pos::{R::integer(), C::integer()},<br /> %% Option :: {span, {RS::integer(), CS::integer()}}<br /> %% | {flag, integer()}<br /> %% | {border, integer()}<br /> -%% | {userData, wx:wx()}.<br /> +%% | {userData, wx:wx_object()}.<br /> %% -spec add(This, Width, Height, Pos) -> wxSizerItem:wxSizerItem() when This::wxGridBagSizer(), Width::integer(), Height::integer(), Pos::{R::integer(), C::integer()}; @@ -158,13 +158,13 @@ add(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=WindowT,ref=WindowRef}, Options Option :: {proportion, integer()} | {flag, integer()} | {border, integer()} - | {userData, wx:wx()}; + | {userData, wx:wx_object()}; (This, Window, Pos, [Option]) -> wxSizerItem:wxSizerItem() when This::wxGridBagSizer(), Window::wxWindow:wxWindow() | wxSizer:wxSizer(), Pos::{R::integer(), C::integer()}, Option :: {span, {RS::integer(), CS::integer()}} | {flag, integer()} | {border, integer()} - | {userData, wx:wx()}. + | {userData, wx:wx_object()}. add(This,Width,Height,Pos={PosR,PosC}) when is_record(This, wx_ref),is_integer(Width),is_integer(Height),is_integer(PosR),is_integer(PosC) -> @@ -204,7 +204,7 @@ add(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=WindowT,ref=WindowRef},{PosR,Po Option :: {span, {RS::integer(), CS::integer()}} | {flag, integer()} | {border, integer()} - | {userData, wx:wx()}. + | {userData, wx:wx_object()}. add(#wx_ref{type=ThisT,ref=ThisRef},Width,Height,{PosR,PosC}, Options) when is_integer(Width),is_integer(Height),is_integer(PosR),is_integer(PosC),is_list(Options) -> ?CLASS(ThisT,wxGridBagSizer), @@ -305,7 +305,7 @@ findItemAtPosition(#wx_ref{type=ThisT,ref=ThisRef},{PosR,PosC}) %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxgridbagsizer.html#wxgridbagsizerfinditemwithdata">external documentation</a>. -spec findItemWithData(This, UserData) -> wxGBSizerItem:wxGBSizerItem() when - This::wxGridBagSizer(), UserData::wx:wx(). + This::wxGridBagSizer(), UserData::wx:wx_object(). findItemWithData(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=UserDataT,ref=UserDataRef}) -> ?CLASS(ThisT,wxGridBagSizer), ?CLASS(UserDataT,wx), diff --git a/lib/wx/src/gen/wxIcon.erl b/lib/wx/src/gen/wxIcon.erl index c726f2ed4c..0f31278732 100644 --- a/lib/wx/src/gen/wxIcon.erl +++ b/lib/wx/src/gen/wxIcon.erl @@ -50,13 +50,13 @@ new() -> %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxicon.html#wxiconwxicon">external documentation</a>. %% <br /> Also:<br /> %% new(Loc) -> wxIcon() when<br /> -%% Loc::wx:wx().<br /> +%% Loc::wx:wx_object().<br /> %% %%<br /> Type = ?wxBITMAP_TYPE_INVALID | ?wxBITMAP_TYPE_BMP | ?wxBITMAP_TYPE_BMP_RESOURCE | ?wxBITMAP_TYPE_RESOURCE | ?wxBITMAP_TYPE_ICO | ?wxBITMAP_TYPE_ICO_RESOURCE | ?wxBITMAP_TYPE_CUR | ?wxBITMAP_TYPE_CUR_RESOURCE | ?wxBITMAP_TYPE_XBM | ?wxBITMAP_TYPE_XBM_DATA | ?wxBITMAP_TYPE_XPM | ?wxBITMAP_TYPE_XPM_DATA | ?wxBITMAP_TYPE_TIF | ?wxBITMAP_TYPE_TIF_RESOURCE | ?wxBITMAP_TYPE_GIF | ?wxBITMAP_TYPE_GIF_RESOURCE | ?wxBITMAP_TYPE_PNG | ?wxBITMAP_TYPE_PNG_RESOURCE | ?wxBITMAP_TYPE_JPEG | ?wxBITMAP_TYPE_JPEG_RESOURCE | ?wxBITMAP_TYPE_PNM | ?wxBITMAP_TYPE_PNM_RESOURCE | ?wxBITMAP_TYPE_PCX | ?wxBITMAP_TYPE_PCX_RESOURCE | ?wxBITMAP_TYPE_PICT | ?wxBITMAP_TYPE_PICT_RESOURCE | ?wxBITMAP_TYPE_ICON | ?wxBITMAP_TYPE_ICON_RESOURCE | ?wxBITMAP_TYPE_ANI | ?wxBITMAP_TYPE_IFF | ?wxBITMAP_TYPE_TGA | ?wxBITMAP_TYPE_MACCURSOR | ?wxBITMAP_TYPE_MACCURSOR_RESOURCE | ?wxBITMAP_TYPE_ANY -spec new(Filename) -> wxIcon() when Filename::unicode:chardata(); (Loc) -> wxIcon() when - Loc::wx:wx(). + Loc::wx:wx_object(). new(Filename) when is_list(Filename) -> diff --git a/lib/wx/src/gen/wxListBox.erl b/lib/wx/src/gen/wxListBox.erl index bcaf5fad3b..3b41de9ffc 100644 --- a/lib/wx/src/gen/wxListBox.erl +++ b/lib/wx/src/gen/wxListBox.erl @@ -104,7 +104,7 @@ new(Parent,Id) | {size, {W::integer(), H::integer()}} | {choices, [[unicode:chardata()]]} | {style, integer()} - | {validator, wx:wx()}. + | {validator, wx:wx_object()}. new(#wx_ref{type=ParentT,ref=ParentRef},Id, Options) when is_integer(Id),is_list(Options) -> ?CLASS(ParentT,wxWindow), @@ -130,7 +130,7 @@ create(This,Parent,Id,Pos={PosX,PosY},Size={SizeW,SizeH},Choices) -spec create(This, Parent, Id, Pos, Size, Choices, [Option]) -> boolean() when This::wxListBox(), Parent::wxWindow:wxWindow(), Id::integer(), Pos::{X::integer(), Y::integer()}, Size::{W::integer(), H::integer()}, Choices::[[unicode:chardata()]], Option :: {style, integer()} - | {validator, wx:wx()}. + | {validator, wx:wx_object()}. create(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=ParentT,ref=ParentRef},Id,{PosX,PosY},{SizeW,SizeH},Choices, Options) when is_integer(Id),is_integer(PosX),is_integer(PosY),is_integer(SizeW),is_integer(SizeH),is_list(Choices),is_list(Options) -> ?CLASS(ThisT,wxListBox), diff --git a/lib/wx/src/gen/wxListCtrl.erl b/lib/wx/src/gen/wxListCtrl.erl index 16e8ae4508..a6288fc02a 100644 --- a/lib/wx/src/gen/wxListCtrl.erl +++ b/lib/wx/src/gen/wxListCtrl.erl @@ -34,10 +34,10 @@ deleteItem/2,destroy/1,editLabel/2,ensureVisible/2,findItem/3,findItem/4, getColumn/3,getColumnCount/1,getColumnWidth/2,getCountPerPage/1,getEditControl/1, getImageList/2,getItem/2,getItemBackgroundColour/2,getItemCount/1, - getItemData/2,getItemFont/2,getItemPosition/3,getItemRect/3,getItemRect/4, + getItemData/2,getItemFont/2,getItemPosition/2,getItemRect/2,getItemRect/3, getItemSpacing/1,getItemState/3,getItemText/2,getItemTextColour/2, getNextItem/2,getNextItem/3,getSelectedItemCount/1,getTextColour/1, - getTopItem/1,getViewRect/1,hitTest/2,insertColumn/3,insertColumn/4, + getTopItem/1,getViewRect/1,hitTest/3,insertColumn/3,insertColumn/4, insertItem/2,insertItem/3,insertItem/4,refreshItem/2,refreshItems/3, scrollList/3,setBackgroundColour/2,setColumn/3,setColumnWidth/3,setImageList/3, setItem/2,setItem/4,setItem/5,setItemBackgroundColour/3,setItemColumnImage/4, @@ -391,34 +391,37 @@ getItemFont(#wx_ref{type=ThisT,ref=ThisRef},Item) <<ThisRef:32/?UI,Item:32/?UI>>). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxlistctrl.html#wxlistctrlgetitemposition">external documentation</a>. --spec getItemPosition(This, Item, Pos) -> boolean() when - This::wxListCtrl(), Item::integer(), Pos::{X::integer(), Y::integer()}. -getItemPosition(#wx_ref{type=ThisT,ref=ThisRef},Item,{PosX,PosY}) - when is_integer(Item),is_integer(PosX),is_integer(PosY) -> +-spec getItemPosition(This, Item) -> Result when + Result ::{Res ::boolean(), Pos::{X::integer(), Y::integer()}}, + This::wxListCtrl(), Item::integer(). +getItemPosition(#wx_ref{type=ThisT,ref=ThisRef},Item) + when is_integer(Item) -> ?CLASS(ThisT,wxListCtrl), wxe_util:call(?wxListCtrl_GetItemPosition, - <<ThisRef:32/?UI,Item:32/?UI,PosX:32/?UI,PosY:32/?UI>>). + <<ThisRef:32/?UI,Item:32/?UI>>). -%% @equiv getItemRect(This,Item,Rect, []) --spec getItemRect(This, Item, Rect) -> boolean() when - This::wxListCtrl(), Item::integer(), Rect::{X::integer(), Y::integer(), W::integer(), H::integer()}. +%% @equiv getItemRect(This,Item, []) +-spec getItemRect(This, Item) -> Result when + Result ::{Res ::boolean(), Rect::{X::integer(), Y::integer(), W::integer(), H::integer()}}, + This::wxListCtrl(), Item::integer(). -getItemRect(This,Item,Rect={RectX,RectY,RectW,RectH}) - when is_record(This, wx_ref),is_integer(Item),is_integer(RectX),is_integer(RectY),is_integer(RectW),is_integer(RectH) -> - getItemRect(This,Item,Rect, []). +getItemRect(This,Item) + when is_record(This, wx_ref),is_integer(Item) -> + getItemRect(This,Item, []). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxlistctrl.html#wxlistctrlgetitemrect">external documentation</a>. --spec getItemRect(This, Item, Rect, [Option]) -> boolean() when - This::wxListCtrl(), Item::integer(), Rect::{X::integer(), Y::integer(), W::integer(), H::integer()}, +-spec getItemRect(This, Item, [Option]) -> Result when + Result :: {Res ::boolean(), Rect::{X::integer(), Y::integer(), W::integer(), H::integer()}}, + This::wxListCtrl(), Item::integer(), Option :: {code, integer()}. -getItemRect(#wx_ref{type=ThisT,ref=ThisRef},Item,{RectX,RectY,RectW,RectH}, Options) - when is_integer(Item),is_integer(RectX),is_integer(RectY),is_integer(RectW),is_integer(RectH),is_list(Options) -> +getItemRect(#wx_ref{type=ThisT,ref=ThisRef},Item, Options) + when is_integer(Item),is_list(Options) -> ?CLASS(ThisT,wxListCtrl), MOpts = fun({code, Code}, Acc) -> [<<1:32/?UI,Code:32/?UI>>|Acc]; (BadOpt, _) -> erlang:error({badoption, BadOpt}) end, BinOpt = list_to_binary(lists:foldl(MOpts, [<<0:32>>], Options)), wxe_util:call(?wxListCtrl_GetItemRect, - <<ThisRef:32/?UI,Item:32/?UI,RectX:32/?UI,RectY:32/?UI,RectW:32/?UI,RectH:32/?UI, BinOpt/binary>>). + <<ThisRef:32/?UI,Item:32/?UI, BinOpt/binary>>). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxlistctrl.html#wxlistctrlgetitemspacing">external documentation</a>. -spec getItemSpacing(This) -> {W::integer(), H::integer()} when @@ -511,14 +514,13 @@ getViewRect(#wx_ref{type=ThisT,ref=ThisRef}) -> <<ThisRef:32/?UI>>). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxlistctrl.html#wxlistctrlhittest">external documentation</a>. --spec hitTest(This, Point) -> Result when - Result ::{Res ::integer(), Flags::integer()}, - This::wxListCtrl(), Point::{X::integer(), Y::integer()}. -hitTest(#wx_ref{type=ThisT,ref=ThisRef},{PointX,PointY}) - when is_integer(PointX),is_integer(PointY) -> +-spec hitTest(This, Point, Flags) -> integer() when + This::wxListCtrl(), Point::{X::integer(), Y::integer()}, Flags::integer(). +hitTest(#wx_ref{type=ThisT,ref=ThisRef},{PointX,PointY},Flags) + when is_integer(PointX),is_integer(PointY),is_integer(Flags) -> ?CLASS(ThisT,wxListCtrl), wxe_util:call(?wxListCtrl_HitTest, - <<ThisRef:32/?UI,PointX:32/?UI,PointY:32/?UI>>). + <<ThisRef:32/?UI,PointX:32/?UI,PointY:32/?UI,Flags:32/?UI>>). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxlistctrl.html#wxlistctrlinsertcolumn">external documentation</a>. %% <br /> Also:<br /> diff --git a/lib/wx/src/gen/wxRadioBox.erl b/lib/wx/src/gen/wxRadioBox.erl index 1b3717de23..7843fde488 100644 --- a/lib/wx/src/gen/wxRadioBox.erl +++ b/lib/wx/src/gen/wxRadioBox.erl @@ -93,7 +93,7 @@ new(Parent,Id,Title,Pos={PosX,PosY},Size={SizeW,SizeH},Choices) Parent::wxWindow:wxWindow(), Id::integer(), Title::unicode:chardata(), Pos::{X::integer(), Y::integer()}, Size::{W::integer(), H::integer()}, Choices::[[unicode:chardata()]], Option :: {majorDim, integer()} | {style, integer()} - | {val, wx:wx()}. + | {val, wx:wx_object()}. new(#wx_ref{type=ParentT,ref=ParentRef},Id,Title,{PosX,PosY},{SizeW,SizeH},Choices, Options) when is_integer(Id),is_list(Title),is_integer(PosX),is_integer(PosY),is_integer(SizeW),is_integer(SizeH),is_list(Choices),is_list(Options) -> ?CLASS(ParentT,wxWindow), @@ -121,7 +121,7 @@ create(This,Parent,Id,Title,Pos={PosX,PosY},Size={SizeW,SizeH},Choices) This::wxRadioBox(), Parent::wxWindow:wxWindow(), Id::integer(), Title::unicode:chardata(), Pos::{X::integer(), Y::integer()}, Size::{W::integer(), H::integer()}, Choices::[[unicode:chardata()]], Option :: {majorDim, integer()} | {style, integer()} - | {val, wx:wx()}. + | {val, wx:wx_object()}. create(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=ParentT,ref=ParentRef},Id,Title,{PosX,PosY},{SizeW,SizeH},Choices, Options) when is_integer(Id),is_list(Title),is_integer(PosX),is_integer(PosY),is_integer(SizeW),is_integer(SizeH),is_list(Choices),is_list(Options) -> ?CLASS(ThisT,wxRadioBox), diff --git a/lib/wx/src/gen/wxRadioButton.erl b/lib/wx/src/gen/wxRadioButton.erl index a013bd65e4..beb052b873 100644 --- a/lib/wx/src/gen/wxRadioButton.erl +++ b/lib/wx/src/gen/wxRadioButton.erl @@ -97,7 +97,7 @@ new(Parent,Id,Label) Option :: {pos, {X::integer(), Y::integer()}} | {size, {W::integer(), H::integer()}} | {style, integer()} - | {validator, wx:wx()}. + | {validator, wx:wx_object()}. new(#wx_ref{type=ParentT,ref=ParentRef},Id,Label, Options) when is_integer(Id),is_list(Label),is_list(Options) -> ?CLASS(ParentT,wxWindow), @@ -125,7 +125,7 @@ create(This,Parent,Id,Label) Option :: {pos, {X::integer(), Y::integer()}} | {size, {W::integer(), H::integer()}} | {style, integer()} - | {validator, wx:wx()}. + | {validator, wx:wx_object()}. create(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=ParentT,ref=ParentRef},Id,Label, Options) when is_integer(Id),is_list(Label),is_list(Options) -> ?CLASS(ThisT,wxRadioButton), diff --git a/lib/wx/src/gen/wxScrollBar.erl b/lib/wx/src/gen/wxScrollBar.erl index 30272312ab..4370bd1635 100644 --- a/lib/wx/src/gen/wxScrollBar.erl +++ b/lib/wx/src/gen/wxScrollBar.erl @@ -98,7 +98,7 @@ new(Parent,Id) Option :: {pos, {X::integer(), Y::integer()}} | {size, {W::integer(), H::integer()}} | {style, integer()} - | {validator, wx:wx()}. + | {validator, wx:wx_object()}. new(#wx_ref{type=ParentT,ref=ParentRef},Id, Options) when is_integer(Id),is_list(Options) -> ?CLASS(ParentT,wxWindow), @@ -125,7 +125,7 @@ create(This,Parent,Id) Option :: {pos, {X::integer(), Y::integer()}} | {size, {W::integer(), H::integer()}} | {style, integer()} - | {validator, wx:wx()}. + | {validator, wx:wx_object()}. create(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=ParentT,ref=ParentRef},Id, Options) when is_integer(Id),is_list(Options) -> ?CLASS(ThisT,wxScrollBar), diff --git a/lib/wx/src/gen/wxSizer.erl b/lib/wx/src/gen/wxSizer.erl index 104e1bcdc9..7edc01aa2a 100644 --- a/lib/wx/src/gen/wxSizer.erl +++ b/lib/wx/src/gen/wxSizer.erl @@ -56,7 +56,7 @@ add(This,Window) %% Option :: {proportion, integer()}<br /> %% | {flag, integer()}<br /> %% | {border, integer()}<br /> -%% | {userData, wx:wx()};<br /> +%% | {userData, wx:wx_object()};<br /> %% (This, Window, Flags) -> wxSizerItem:wxSizerItem() when<br /> %% This::wxSizer(), Window::wxWindow:wxWindow() | wxSizer(), Flags::wxSizerFlags:wxSizerFlags().<br /> %% @@ -67,7 +67,7 @@ add(This,Window) Option :: {proportion, integer()} | {flag, integer()} | {border, integer()} - | {userData, wx:wx()}; + | {userData, wx:wx_object()}; (This, Window, Flags) -> wxSizerItem:wxSizerItem() when This::wxSizer(), Window::wxWindow:wxWindow() | wxSizer(), Flags::wxSizerFlags:wxSizerFlags(). @@ -110,7 +110,7 @@ add(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=WindowT,ref=WindowRef},#wx_ref{ Option :: {proportion, integer()} | {flag, integer()} | {border, integer()} - | {userData, wx:wx()}. + | {userData, wx:wx_object()}. add(#wx_ref{type=ThisT,ref=ThisRef},Width,Height, Options) when is_integer(Width),is_integer(Height),is_list(Options) -> ?CLASS(ThisT,wxSizer), @@ -350,7 +350,7 @@ insert(#wx_ref{type=ThisT,ref=ThisRef},Index,#wx_ref{type=ItemT,ref=ItemRef}) %% Option :: {proportion, integer()}<br /> %% | {flag, integer()}<br /> %% | {border, integer()}<br /> -%% | {userData, wx:wx()};<br /> +%% | {userData, wx:wx_object()};<br /> %% (This, Index, Window, Flags) -> wxSizerItem:wxSizerItem() when<br /> %% This::wxSizer(), Index::integer(), Window::wxWindow:wxWindow() | wxSizer(), Flags::wxSizerFlags:wxSizerFlags().<br /> %% @@ -361,7 +361,7 @@ insert(#wx_ref{type=ThisT,ref=ThisRef},Index,#wx_ref{type=ItemT,ref=ItemRef}) Option :: {proportion, integer()} | {flag, integer()} | {border, integer()} - | {userData, wx:wx()}; + | {userData, wx:wx_object()}; (This, Index, Window, Flags) -> wxSizerItem:wxSizerItem() when This::wxSizer(), Index::integer(), Window::wxWindow:wxWindow() | wxSizer(), Flags::wxSizerFlags:wxSizerFlags(). @@ -405,7 +405,7 @@ insert(#wx_ref{type=ThisT,ref=ThisRef},Index,#wx_ref{type=WindowT,ref=WindowRef} Option :: {proportion, integer()} | {flag, integer()} | {border, integer()} - | {userData, wx:wx()}. + | {userData, wx:wx_object()}. insert(#wx_ref{type=ThisT,ref=ThisRef},Index,Width,Height, Options) when is_integer(Index),is_integer(Width),is_integer(Height),is_list(Options) -> ?CLASS(ThisT,wxSizer), @@ -497,7 +497,7 @@ prepend(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=ItemT,ref=ItemRef}) -> %% Option :: {proportion, integer()}<br /> %% | {flag, integer()}<br /> %% | {border, integer()}<br /> -%% | {userData, wx:wx()};<br /> +%% | {userData, wx:wx_object()};<br /> %% (This, Window, Flags) -> wxSizerItem:wxSizerItem() when<br /> %% This::wxSizer(), Window::wxWindow:wxWindow() | wxSizer(), Flags::wxSizerFlags:wxSizerFlags().<br /> %% @@ -508,7 +508,7 @@ prepend(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=ItemT,ref=ItemRef}) -> Option :: {proportion, integer()} | {flag, integer()} | {border, integer()} - | {userData, wx:wx()}; + | {userData, wx:wx_object()}; (This, Window, Flags) -> wxSizerItem:wxSizerItem() when This::wxSizer(), Window::wxWindow:wxWindow() | wxSizer(), Flags::wxSizerFlags:wxSizerFlags(). @@ -551,7 +551,7 @@ prepend(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=WindowT,ref=WindowRef},#wx_ Option :: {proportion, integer()} | {flag, integer()} | {border, integer()} - | {userData, wx:wx()}. + | {userData, wx:wx_object()}. prepend(#wx_ref{type=ThisT,ref=ThisRef},Width,Height, Options) when is_integer(Width),is_integer(Height),is_list(Options) -> ?CLASS(ThisT,wxSizer), diff --git a/lib/wx/src/gen/wxSizerItem.erl b/lib/wx/src/gen/wxSizerItem.erl index 22533500da..62655864d1 100644 --- a/lib/wx/src/gen/wxSizerItem.erl +++ b/lib/wx/src/gen/wxSizerItem.erl @@ -72,7 +72,7 @@ new(Width,Height,#wx_ref{type=FlagsT,ref=FlagsRef}) %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxsizeritem.html#wxsizeritemwxsizeritem">external documentation</a>. -spec new(Window, Proportion, Flag, Border, UserData) -> wxSizerItem() when - Window::wxWindow:wxWindow() | wxSizer:wxSizer(), Proportion::integer(), Flag::integer(), Border::integer(), UserData::wx:wx(). + Window::wxWindow:wxWindow() | wxSizer:wxSizer(), Proportion::integer(), Flag::integer(), Border::integer(), UserData::wx:wx_object(). new(#wx_ref{type=WindowT,ref=WindowRef},Proportion,Flag,Border,#wx_ref{type=UserDataT,ref=UserDataRef}) when is_integer(Proportion),is_integer(Flag),is_integer(Border) -> WindowOP = case ?CLASS_T(WindowT,wxWindow) of @@ -88,7 +88,7 @@ new(#wx_ref{type=WindowT,ref=WindowRef},Proportion,Flag,Border,#wx_ref{type=User %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxsizeritem.html#wxsizeritemwxsizeritem">external documentation</a>. -spec new(Width, Height, Proportion, Flag, Border, UserData) -> wxSizerItem() when - Width::integer(), Height::integer(), Proportion::integer(), Flag::integer(), Border::integer(), UserData::wx:wx(). + Width::integer(), Height::integer(), Proportion::integer(), Flag::integer(), Border::integer(), UserData::wx:wx_object(). new(Width,Height,Proportion,Flag,Border,#wx_ref{type=UserDataT,ref=UserDataRef}) when is_integer(Width),is_integer(Height),is_integer(Proportion),is_integer(Flag),is_integer(Border) -> ?CLASS(UserDataT,wx), @@ -200,7 +200,7 @@ getSpacer(#wx_ref{type=ThisT,ref=ThisRef}) -> <<ThisRef:32/?UI>>). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxsizeritem.html#wxsizeritemgetuserdata">external documentation</a>. --spec getUserData(This) -> wx:wx() when +-spec getUserData(This) -> wx:wx_object() when This::wxSizerItem(). getUserData(#wx_ref{type=ThisT,ref=ThisRef}) -> ?CLASS(ThisT,wxSizerItem), diff --git a/lib/wx/src/gen/wxSlider.erl b/lib/wx/src/gen/wxSlider.erl index e951e559ca..459e9b9c35 100644 --- a/lib/wx/src/gen/wxSlider.erl +++ b/lib/wx/src/gen/wxSlider.erl @@ -99,7 +99,7 @@ new(Parent,Id,Value,MinValue,MaxValue) Option :: {pos, {X::integer(), Y::integer()}} | {size, {W::integer(), H::integer()}} | {style, integer()} - | {validator, wx:wx()}. + | {validator, wx:wx_object()}. new(#wx_ref{type=ParentT,ref=ParentRef},Id,Value,MinValue,MaxValue, Options) when is_integer(Id),is_integer(Value),is_integer(MinValue),is_integer(MaxValue),is_list(Options) -> ?CLASS(ParentT,wxWindow), @@ -126,7 +126,7 @@ create(This,Parent,Id,Value,MinValue,MaxValue) Option :: {pos, {X::integer(), Y::integer()}} | {size, {W::integer(), H::integer()}} | {style, integer()} - | {validator, wx:wx()}. + | {validator, wx:wx_object()}. create(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=ParentT,ref=ParentRef},Id,Value,MinValue,MaxValue, Options) when is_integer(Id),is_integer(Value),is_integer(MinValue),is_integer(MaxValue),is_list(Options) -> ?CLASS(ThisT,wxSlider), diff --git a/lib/wx/src/gen/wxStyledTextCtrl.erl b/lib/wx/src/gen/wxStyledTextCtrl.erl index 057e01ddd5..f6dc2176b7 100644 --- a/lib/wx/src/gen/wxStyledTextCtrl.erl +++ b/lib/wx/src/gen/wxStyledTextCtrl.erl @@ -252,7 +252,7 @@ addText(#wx_ref{type=ThisT,ref=ThisRef},Text) %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxstyledtextctrl.html#wxstyledtextctrladdstyledtext">external documentation</a>. -spec addStyledText(This, Data) -> ok when - This::wxStyledTextCtrl(), Data::wxMemoryBuffer:wxMemoryBuffer(). + This::wxStyledTextCtrl(), Data::wx:wx_object(). addStyledText(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=DataT,ref=DataRef}) -> ?CLASS(ThisT,wxStyledTextCtrl), ?CLASS(DataT,wxMemoryBuffer), @@ -361,7 +361,7 @@ setSavePoint(#wx_ref{type=ThisT,ref=ThisRef}) -> <<ThisRef:32/?UI>>). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxstyledtextctrl.html#wxstyledtextctrlgetstyledtext">external documentation</a>. --spec getStyledText(This, StartPos, EndPos) -> wxMemoryBuffer:wxMemoryBuffer() when +-spec getStyledText(This, StartPos, EndPos) -> wx:wx_object() when This::wxStyledTextCtrl(), StartPos::integer(), EndPos::integer(). getStyledText(#wx_ref{type=ThisT,ref=ThisRef},StartPos,EndPos) when is_integer(StartPos),is_integer(EndPos) -> diff --git a/lib/wx/src/gen/wxTextCtrl.erl b/lib/wx/src/gen/wxTextCtrl.erl index 21ff062d5b..e1f82c40c3 100644 --- a/lib/wx/src/gen/wxTextCtrl.erl +++ b/lib/wx/src/gen/wxTextCtrl.erl @@ -106,7 +106,7 @@ new(Parent,Id) | {pos, {X::integer(), Y::integer()}} | {size, {W::integer(), H::integer()}} | {style, integer()} - | {validator, wx:wx()}. + | {validator, wx:wx_object()}. new(#wx_ref{type=ParentT,ref=ParentRef},Id, Options) when is_integer(Id),is_list(Options) -> ?CLASS(ParentT,wxWindow), @@ -201,7 +201,7 @@ create(This,Parent,Id) | {pos, {X::integer(), Y::integer()}} | {size, {W::integer(), H::integer()}} | {style, integer()} - | {validator, wx:wx()}. + | {validator, wx:wx_object()}. create(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=ParentT,ref=ParentRef},Id, Options) when is_integer(Id),is_list(Options) -> ?CLASS(ThisT,wxTextCtrl), diff --git a/lib/wx/src/gen/wxToggleButton.erl b/lib/wx/src/gen/wxToggleButton.erl index 1d770b5ca5..ed2f564952 100644 --- a/lib/wx/src/gen/wxToggleButton.erl +++ b/lib/wx/src/gen/wxToggleButton.erl @@ -97,7 +97,7 @@ new(Parent,Id,Label) Option :: {pos, {X::integer(), Y::integer()}} | {size, {W::integer(), H::integer()}} | {style, integer()} - | {validator, wx:wx()}. + | {validator, wx:wx_object()}. new(#wx_ref{type=ParentT,ref=ParentRef},Id,Label, Options) when is_integer(Id),is_list(Label),is_list(Options) -> ?CLASS(ParentT,wxWindow), @@ -125,7 +125,7 @@ create(This,Parent,Id,Label) Option :: {pos, {X::integer(), Y::integer()}} | {size, {W::integer(), H::integer()}} | {style, integer()} - | {validator, wx:wx()}. + | {validator, wx:wx_object()}. create(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=ParentT,ref=ParentRef},Id,Label, Options) when is_integer(Id),is_list(Label),is_list(Options) -> ?CLASS(ThisT,wxToggleButton), diff --git a/lib/wx/src/gen/wxToolBar.erl b/lib/wx/src/gen/wxToolBar.erl index e55becb748..9401e30e20 100644 --- a/lib/wx/src/gen/wxToolBar.erl +++ b/lib/wx/src/gen/wxToolBar.erl @@ -86,7 +86,7 @@ parent_class(_Class) -> erlang:error({badtype, ?MODULE}). -type wxToolBar() :: wx:wx_object(). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxtoolbar.html#wxtoolbaraddcontrol">external documentation</a>. --spec addControl(This, Control) -> wx:wx() when +-spec addControl(This, Control) -> wx:wx_object() when This::wxToolBar(), Control::wxControl:wxControl(). addControl(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=ControlT,ref=ControlRef}) -> ?CLASS(ThisT,wxToolBar), @@ -95,7 +95,7 @@ addControl(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=ControlT,ref=ControlRef} <<ThisRef:32/?UI,ControlRef:32/?UI>>). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxtoolbar.html#wxtoolbaraddseparator">external documentation</a>. --spec addSeparator(This) -> wx:wx() when +-spec addSeparator(This) -> wx:wx_object() when This::wxToolBar(). addSeparator(#wx_ref{type=ThisT,ref=ThisRef}) -> ?CLASS(ThisT,wxToolBar), @@ -103,8 +103,8 @@ addSeparator(#wx_ref{type=ThisT,ref=ThisRef}) -> <<ThisRef:32/?UI>>). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxtoolbar.html#wxtoolbaraddtool">external documentation</a>. --spec addTool(This, Tool) -> wx:wx() when - This::wxToolBar(), Tool::wx:wx(). +-spec addTool(This, Tool) -> wx:wx_object() when + This::wxToolBar(), Tool::wx:wx_object(). addTool(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=ToolT,ref=ToolRef}) -> ?CLASS(ThisT,wxToolBar), ?CLASS(ToolT,wx), @@ -112,7 +112,7 @@ addTool(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=ToolT,ref=ToolRef}) -> <<ThisRef:32/?UI,ToolRef:32/?UI>>). %% @equiv addTool(This,Toolid,Bitmap, []) --spec addTool(This, Toolid, Bitmap) -> wx:wx() when +-spec addTool(This, Toolid, Bitmap) -> wx:wx_object() when This::wxToolBar(), Toolid::integer(), Bitmap::wxBitmap:wxBitmap(). addTool(This,Toolid,Bitmap) @@ -121,19 +121,19 @@ addTool(This,Toolid,Bitmap) %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxtoolbar.html#wxtoolbaraddtool">external documentation</a>. %% <br /> Also:<br /> -%% addTool(This, Toolid, Bitmap, BmpDisabled) -> wx:wx() when<br /> +%% addTool(This, Toolid, Bitmap, BmpDisabled) -> wx:wx_object() when<br /> %% This::wxToolBar(), Toolid::integer(), Bitmap::wxBitmap:wxBitmap(), BmpDisabled::wxBitmap:wxBitmap();<br /> -%% (This, Toolid, Bitmap, [Option]) -> wx:wx() when<br /> +%% (This, Toolid, Bitmap, [Option]) -> wx:wx_object() when<br /> %% This::wxToolBar(), Toolid::integer(), Bitmap::wxBitmap:wxBitmap(),<br /> %% Option :: {shortHelpString, unicode:chardata()}<br /> %% | {longHelpString, unicode:chardata()}.<br /> %% %%<br /> Kind = ?wxITEM_SEPARATOR | ?wxITEM_NORMAL | ?wxITEM_CHECK | ?wxITEM_RADIO | ?wxITEM_MAX --spec addTool(This, Toolid, Label, Bitmap) -> wx:wx() when +-spec addTool(This, Toolid, Label, Bitmap) -> wx:wx_object() when This::wxToolBar(), Toolid::integer(), Label::unicode:chardata(), Bitmap::wxBitmap:wxBitmap(); - (This, Toolid, Bitmap, BmpDisabled) -> wx:wx() when + (This, Toolid, Bitmap, BmpDisabled) -> wx:wx_object() when This::wxToolBar(), Toolid::integer(), Bitmap::wxBitmap:wxBitmap(), BmpDisabled::wxBitmap:wxBitmap(); - (This, Toolid, Bitmap, [Option]) -> wx:wx() when + (This, Toolid, Bitmap, [Option]) -> wx:wx_object() when This::wxToolBar(), Toolid::integer(), Bitmap::wxBitmap:wxBitmap(), Option :: {shortHelpString, unicode:chardata()} | {longHelpString, unicode:chardata()}. @@ -158,28 +158,28 @@ addTool(#wx_ref{type=ThisT,ref=ThisRef},Toolid,#wx_ref{type=BitmapT,ref=BitmapRe %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxtoolbar.html#wxtoolbaraddtool">external documentation</a>. %% <br /> Also:<br /> -%% addTool(This, Toolid, Label, Bitmap, [Option]) -> wx:wx() when<br /> +%% addTool(This, Toolid, Label, Bitmap, [Option]) -> wx:wx_object() when<br /> %% This::wxToolBar(), Toolid::integer(), Label::unicode:chardata(), Bitmap::wxBitmap:wxBitmap(),<br /> %% Option :: {shortHelp, unicode:chardata()}<br /> %% | {kind, wx:wx_enum()};<br /> -%% (This, Toolid, Bitmap, BmpDisabled, [Option]) -> wx:wx() when<br /> +%% (This, Toolid, Bitmap, BmpDisabled, [Option]) -> wx:wx_object() when<br /> %% This::wxToolBar(), Toolid::integer(), Bitmap::wxBitmap:wxBitmap(), BmpDisabled::wxBitmap:wxBitmap(),<br /> %% Option :: {toggle, boolean()}<br /> -%% | {clientData, wx:wx()}<br /> +%% | {clientData, wx:wx_object()}<br /> %% | {shortHelpString, unicode:chardata()}<br /> %% | {longHelpString, unicode:chardata()}.<br /> %% %%<br /> Kind = ?wxITEM_SEPARATOR | ?wxITEM_NORMAL | ?wxITEM_CHECK | ?wxITEM_RADIO | ?wxITEM_MAX --spec addTool(This, Toolid, Label, Bitmap, BmpDisabled) -> wx:wx() when +-spec addTool(This, Toolid, Label, Bitmap, BmpDisabled) -> wx:wx_object() when This::wxToolBar(), Toolid::integer(), Label::unicode:chardata(), Bitmap::wxBitmap:wxBitmap(), BmpDisabled::wxBitmap:wxBitmap(); - (This, Toolid, Label, Bitmap, [Option]) -> wx:wx() when + (This, Toolid, Label, Bitmap, [Option]) -> wx:wx_object() when This::wxToolBar(), Toolid::integer(), Label::unicode:chardata(), Bitmap::wxBitmap:wxBitmap(), Option :: {shortHelp, unicode:chardata()} | {kind, wx:wx_enum()}; - (This, Toolid, Bitmap, BmpDisabled, [Option]) -> wx:wx() when + (This, Toolid, Bitmap, BmpDisabled, [Option]) -> wx:wx_object() when This::wxToolBar(), Toolid::integer(), Bitmap::wxBitmap:wxBitmap(), BmpDisabled::wxBitmap:wxBitmap(), Option :: {toggle, boolean()} - | {clientData, wx:wx()} + | {clientData, wx:wx_object()} | {shortHelpString, unicode:chardata()} | {longHelpString, unicode:chardata()}. @@ -213,22 +213,22 @@ addTool(#wx_ref{type=ThisT,ref=ThisRef},Toolid,#wx_ref{type=BitmapT,ref=BitmapRe %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxtoolbar.html#wxtoolbaraddtool">external documentation</a>. %% <br /> Also:<br /> -%% addTool(This, Toolid, Label, Bitmap, BmpDisabled, [Option]) -> wx:wx() when<br /> +%% addTool(This, Toolid, Label, Bitmap, BmpDisabled, [Option]) -> wx:wx_object() when<br /> %% This::wxToolBar(), Toolid::integer(), Label::unicode:chardata(), Bitmap::wxBitmap:wxBitmap(), BmpDisabled::wxBitmap:wxBitmap(),<br /> %% Option :: {kind, wx:wx_enum()}<br /> %% | {shortHelp, unicode:chardata()}<br /> %% | {longHelp, unicode:chardata()}<br /> -%% | {data, wx:wx()}.<br /> +%% | {data, wx:wx_object()}.<br /> %% %%<br /> Kind = ?wxITEM_SEPARATOR | ?wxITEM_NORMAL | ?wxITEM_CHECK | ?wxITEM_RADIO | ?wxITEM_MAX --spec addTool(This, Toolid, Bitmap, BmpDisabled, Toggle, XPos) -> wx:wx() when +-spec addTool(This, Toolid, Bitmap, BmpDisabled, Toggle, XPos) -> wx:wx_object() when This::wxToolBar(), Toolid::integer(), Bitmap::wxBitmap:wxBitmap(), BmpDisabled::wxBitmap:wxBitmap(), Toggle::boolean(), XPos::integer(); - (This, Toolid, Label, Bitmap, BmpDisabled, [Option]) -> wx:wx() when + (This, Toolid, Label, Bitmap, BmpDisabled, [Option]) -> wx:wx_object() when This::wxToolBar(), Toolid::integer(), Label::unicode:chardata(), Bitmap::wxBitmap:wxBitmap(), BmpDisabled::wxBitmap:wxBitmap(), Option :: {kind, wx:wx_enum()} | {shortHelp, unicode:chardata()} | {longHelp, unicode:chardata()} - | {data, wx:wx()}. + | {data, wx:wx_object()}. addTool(This,Toolid,Bitmap,BmpDisabled,Toggle,XPos) when is_record(This, wx_ref),is_integer(Toolid),is_record(Bitmap, wx_ref),is_record(BmpDisabled, wx_ref),is_boolean(Toggle),is_integer(XPos) -> @@ -249,10 +249,10 @@ addTool(#wx_ref{type=ThisT,ref=ThisRef},Toolid,Label,#wx_ref{type=BitmapT,ref=Bi <<ThisRef:32/?UI,Toolid:32/?UI,(byte_size(Label_UC)):32/?UI,(Label_UC)/binary, 0:(((8- ((4+byte_size(Label_UC)) band 16#7)) band 16#7))/unit:8,BitmapRef:32/?UI,BmpDisabledRef:32/?UI, BinOpt/binary>>). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxtoolbar.html#wxtoolbaraddtool">external documentation</a>. --spec addTool(This, Toolid, Bitmap, BmpDisabled, Toggle, XPos, [Option]) -> wx:wx() when +-spec addTool(This, Toolid, Bitmap, BmpDisabled, Toggle, XPos, [Option]) -> wx:wx_object() when This::wxToolBar(), Toolid::integer(), Bitmap::wxBitmap:wxBitmap(), BmpDisabled::wxBitmap:wxBitmap(), Toggle::boolean(), XPos::integer(), Option :: {yPos, integer()} - | {clientData, wx:wx()} + | {clientData, wx:wx_object()} | {shortHelp, unicode:chardata()} | {longHelp, unicode:chardata()}. addTool(#wx_ref{type=ThisT,ref=ThisRef},Toolid,#wx_ref{type=BitmapT,ref=BitmapRef},#wx_ref{type=BmpDisabledT,ref=BmpDisabledRef},Toggle,XPos, Options) @@ -270,7 +270,7 @@ addTool(#wx_ref{type=ThisT,ref=ThisRef},Toolid,#wx_ref{type=BitmapT,ref=BitmapRe <<ThisRef:32/?UI,Toolid:32/?UI,BitmapRef:32/?UI,BmpDisabledRef:32/?UI,(wxe_util:from_bool(Toggle)):32/?UI,XPos:32/?UI, BinOpt/binary>>). %% @equiv addCheckTool(This,Toolid,Label,Bitmap, []) --spec addCheckTool(This, Toolid, Label, Bitmap) -> wx:wx() when +-spec addCheckTool(This, Toolid, Label, Bitmap) -> wx:wx_object() when This::wxToolBar(), Toolid::integer(), Label::unicode:chardata(), Bitmap::wxBitmap:wxBitmap(). addCheckTool(This,Toolid,Label,Bitmap) @@ -278,12 +278,12 @@ addCheckTool(This,Toolid,Label,Bitmap) addCheckTool(This,Toolid,Label,Bitmap, []). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxtoolbar.html#wxtoolbaraddchecktool">external documentation</a>. --spec addCheckTool(This, Toolid, Label, Bitmap, [Option]) -> wx:wx() when +-spec addCheckTool(This, Toolid, Label, Bitmap, [Option]) -> wx:wx_object() when This::wxToolBar(), Toolid::integer(), Label::unicode:chardata(), Bitmap::wxBitmap:wxBitmap(), Option :: {bmpDisabled, wxBitmap:wxBitmap()} | {shortHelp, unicode:chardata()} | {longHelp, unicode:chardata()} - | {data, wx:wx()}. + | {data, wx:wx_object()}. addCheckTool(#wx_ref{type=ThisT,ref=ThisRef},Toolid,Label,#wx_ref{type=BitmapT,ref=BitmapRef}, Options) when is_integer(Toolid),is_list(Label),is_list(Options) -> ?CLASS(ThisT,wxToolBar), @@ -299,7 +299,7 @@ addCheckTool(#wx_ref{type=ThisT,ref=ThisRef},Toolid,Label,#wx_ref{type=BitmapT,r <<ThisRef:32/?UI,Toolid:32/?UI,(byte_size(Label_UC)):32/?UI,(Label_UC)/binary, 0:(((8- ((4+byte_size(Label_UC)) band 16#7)) band 16#7))/unit:8,BitmapRef:32/?UI, 0:32,BinOpt/binary>>). %% @equiv addRadioTool(This,Toolid,Label,Bitmap, []) --spec addRadioTool(This, Toolid, Label, Bitmap) -> wx:wx() when +-spec addRadioTool(This, Toolid, Label, Bitmap) -> wx:wx_object() when This::wxToolBar(), Toolid::integer(), Label::unicode:chardata(), Bitmap::wxBitmap:wxBitmap(). addRadioTool(This,Toolid,Label,Bitmap) @@ -307,12 +307,12 @@ addRadioTool(This,Toolid,Label,Bitmap) addRadioTool(This,Toolid,Label,Bitmap, []). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxtoolbar.html#wxtoolbaraddradiotool">external documentation</a>. --spec addRadioTool(This, Toolid, Label, Bitmap, [Option]) -> wx:wx() when +-spec addRadioTool(This, Toolid, Label, Bitmap, [Option]) -> wx:wx_object() when This::wxToolBar(), Toolid::integer(), Label::unicode:chardata(), Bitmap::wxBitmap:wxBitmap(), Option :: {bmpDisabled, wxBitmap:wxBitmap()} | {shortHelp, unicode:chardata()} | {longHelp, unicode:chardata()} - | {data, wx:wx()}. + | {data, wx:wx_object()}. addRadioTool(#wx_ref{type=ThisT,ref=ThisRef},Toolid,Label,#wx_ref{type=BitmapT,ref=BitmapRef}, Options) when is_integer(Toolid),is_list(Label),is_list(Options) -> ?CLASS(ThisT,wxToolBar), @@ -355,7 +355,7 @@ enableTool(#wx_ref{type=ThisT,ref=ThisRef},Toolid,Enable) <<ThisRef:32/?UI,Toolid:32/?UI,(wxe_util:from_bool(Enable)):32/?UI>>). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxtoolbar.html#wxtoolbarfindbyid">external documentation</a>. --spec findById(This, Toolid) -> wx:wx() when +-spec findById(This, Toolid) -> wx:wx_object() when This::wxToolBar(), Toolid::integer(). findById(#wx_ref{type=ThisT,ref=ThisRef},Toolid) when is_integer(Toolid) -> @@ -373,7 +373,7 @@ findControl(#wx_ref{type=ThisT,ref=ThisRef},Toolid) <<ThisRef:32/?UI,Toolid:32/?UI>>). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxtoolbar.html#wxtoolbarfindtoolforposition">external documentation</a>. --spec findToolForPosition(This, X, Y) -> wx:wx() when +-spec findToolForPosition(This, X, Y) -> wx:wx_object() when This::wxToolBar(), X::integer(), Y::integer(). findToolForPosition(#wx_ref{type=ThisT,ref=ThisRef},X,Y) when is_integer(X),is_integer(Y) -> @@ -467,7 +467,7 @@ getToolState(#wx_ref{type=ThisT,ref=ThisRef},Toolid) <<ThisRef:32/?UI,Toolid:32/?UI>>). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxtoolbar.html#wxtoolbarinsertcontrol">external documentation</a>. --spec insertControl(This, Pos, Control) -> wx:wx() when +-spec insertControl(This, Pos, Control) -> wx:wx_object() when This::wxToolBar(), Pos::integer(), Control::wxControl:wxControl(). insertControl(#wx_ref{type=ThisT,ref=ThisRef},Pos,#wx_ref{type=ControlT,ref=ControlRef}) when is_integer(Pos) -> @@ -477,7 +477,7 @@ insertControl(#wx_ref{type=ThisT,ref=ThisRef},Pos,#wx_ref{type=ControlT,ref=Cont <<ThisRef:32/?UI,Pos:32/?UI,ControlRef:32/?UI>>). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxtoolbar.html#wxtoolbarinsertseparator">external documentation</a>. --spec insertSeparator(This, Pos) -> wx:wx() when +-spec insertSeparator(This, Pos) -> wx:wx_object() when This::wxToolBar(), Pos::integer(). insertSeparator(#wx_ref{type=ThisT,ref=ThisRef},Pos) when is_integer(Pos) -> @@ -486,8 +486,8 @@ insertSeparator(#wx_ref{type=ThisT,ref=ThisRef},Pos) <<ThisRef:32/?UI,Pos:32/?UI>>). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxtoolbar.html#wxtoolbarinserttool">external documentation</a>. --spec insertTool(This, Pos, Tool) -> wx:wx() when - This::wxToolBar(), Pos::integer(), Tool::wx:wx(). +-spec insertTool(This, Pos, Tool) -> wx:wx_object() when + This::wxToolBar(), Pos::integer(), Tool::wx:wx_object(). insertTool(#wx_ref{type=ThisT,ref=ThisRef},Pos,#wx_ref{type=ToolT,ref=ToolRef}) when is_integer(Pos) -> ?CLASS(ThisT,wxToolBar), @@ -496,7 +496,7 @@ insertTool(#wx_ref{type=ThisT,ref=ThisRef},Pos,#wx_ref{type=ToolT,ref=ToolRef}) <<ThisRef:32/?UI,Pos:32/?UI,ToolRef:32/?UI>>). %% @equiv insertTool(This,Pos,Toolid,Bitmap, []) --spec insertTool(This, Pos, Toolid, Bitmap) -> wx:wx() when +-spec insertTool(This, Pos, Toolid, Bitmap) -> wx:wx_object() when This::wxToolBar(), Pos::integer(), Toolid::integer(), Bitmap::wxBitmap:wxBitmap(). insertTool(This,Pos,Toolid,Bitmap) @@ -505,22 +505,22 @@ insertTool(This,Pos,Toolid,Bitmap) %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxtoolbar.html#wxtoolbarinserttool">external documentation</a>. %% <br /> Also:<br /> -%% insertTool(This, Pos, Toolid, Bitmap, [Option]) -> wx:wx() when<br /> +%% insertTool(This, Pos, Toolid, Bitmap, [Option]) -> wx:wx_object() when<br /> %% This::wxToolBar(), Pos::integer(), Toolid::integer(), Bitmap::wxBitmap:wxBitmap(),<br /> %% Option :: {bmpDisabled, wxBitmap:wxBitmap()}<br /> %% | {toggle, boolean()}<br /> -%% | {clientData, wx:wx()}<br /> +%% | {clientData, wx:wx_object()}<br /> %% | {shortHelp, unicode:chardata()}<br /> %% | {longHelp, unicode:chardata()}.<br /> %% %%<br /> Kind = ?wxITEM_SEPARATOR | ?wxITEM_NORMAL | ?wxITEM_CHECK | ?wxITEM_RADIO | ?wxITEM_MAX --spec insertTool(This, Pos, Toolid, Label, Bitmap) -> wx:wx() when +-spec insertTool(This, Pos, Toolid, Label, Bitmap) -> wx:wx_object() when This::wxToolBar(), Pos::integer(), Toolid::integer(), Label::unicode:chardata(), Bitmap::wxBitmap:wxBitmap(); - (This, Pos, Toolid, Bitmap, [Option]) -> wx:wx() when + (This, Pos, Toolid, Bitmap, [Option]) -> wx:wx_object() when This::wxToolBar(), Pos::integer(), Toolid::integer(), Bitmap::wxBitmap:wxBitmap(), Option :: {bmpDisabled, wxBitmap:wxBitmap()} | {toggle, boolean()} - | {clientData, wx:wx()} + | {clientData, wx:wx_object()} | {shortHelp, unicode:chardata()} | {longHelp, unicode:chardata()}. @@ -543,13 +543,13 @@ insertTool(#wx_ref{type=ThisT,ref=ThisRef},Pos,Toolid,#wx_ref{type=BitmapT,ref=B %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxtoolbar.html#wxtoolbarinserttool">external documentation</a>. %%<br /> Kind = ?wxITEM_SEPARATOR | ?wxITEM_NORMAL | ?wxITEM_CHECK | ?wxITEM_RADIO | ?wxITEM_MAX --spec insertTool(This, Pos, Toolid, Label, Bitmap, [Option]) -> wx:wx() when +-spec insertTool(This, Pos, Toolid, Label, Bitmap, [Option]) -> wx:wx_object() when This::wxToolBar(), Pos::integer(), Toolid::integer(), Label::unicode:chardata(), Bitmap::wxBitmap:wxBitmap(), Option :: {bmpDisabled, wxBitmap:wxBitmap()} | {kind, wx:wx_enum()} | {shortHelp, unicode:chardata()} | {longHelp, unicode:chardata()} - | {clientData, wx:wx()}. + | {clientData, wx:wx_object()}. insertTool(#wx_ref{type=ThisT,ref=ThisRef},Pos,Toolid,Label,#wx_ref{type=BitmapT,ref=BitmapRef}, Options) when is_integer(Pos),is_integer(Toolid),is_list(Label),is_list(Options) -> ?CLASS(ThisT,wxToolBar), @@ -574,7 +574,7 @@ realize(#wx_ref{type=ThisT,ref=ThisRef}) -> <<ThisRef:32/?UI>>). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxtoolbar.html#wxtoolbarremovetool">external documentation</a>. --spec removeTool(This, Toolid) -> wx:wx() when +-spec removeTool(This, Toolid) -> wx:wx_object() when This::wxToolBar(), Toolid::integer(). removeTool(#wx_ref{type=ThisT,ref=ThisRef},Toolid) when is_integer(Toolid) -> diff --git a/lib/wx/src/gen/wxTreeCtrl.erl b/lib/wx/src/gen/wxTreeCtrl.erl index fef9916fff..dfa9e691ce 100644 --- a/lib/wx/src/gen/wxTreeCtrl.erl +++ b/lib/wx/src/gen/wxTreeCtrl.erl @@ -118,7 +118,7 @@ new(Parent) | {pos, {X::integer(), Y::integer()}} | {size, {W::integer(), H::integer()}} | {style, integer()} - | {validator, wx:wx()}. + | {validator, wx:wx_object()}. new(#wx_ref{type=ParentT,ref=ParentRef}, Options) when is_list(Options) -> ?CLASS(ParentT,wxWindow), @@ -235,7 +235,7 @@ create(This,Parent) | {pos, {X::integer(), Y::integer()}} | {size, {W::integer(), H::integer()}} | {style, integer()} - | {validator, wx:wx()}. + | {validator, wx:wx_object()}. create(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=ParentT,ref=ParentRef}, Options) when is_list(Options) -> ?CLASS(ThisT,wxTreeCtrl), diff --git a/lib/wx/src/gen/wxWindow.erl b/lib/wx/src/gen/wxWindow.erl index d31f489726..229633a106 100644 --- a/lib/wx/src/gen/wxWindow.erl +++ b/lib/wx/src/gen/wxWindow.erl @@ -526,7 +526,7 @@ getCursor(#wx_ref{type=ThisT,ref=ThisRef}) -> <<ThisRef:32/?UI>>). %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxwindow.html#wxwindowgetdroptarget">external documentation</a>. --spec getDropTarget(This) -> wxDropTarget:wxDropTarget() when +-spec getDropTarget(This) -> wx:wx_object() when This::wxWindow(). getDropTarget(#wx_ref{type=ThisT,ref=ThisRef}) -> ?CLASS(ThisT,wxWindow), @@ -1384,7 +1384,7 @@ setOwnForegroundColour(#wx_ref{type=ThisT,ref=ThisRef},Colour) %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxwindow.html#wxwindowsetdroptarget">external documentation</a>. -spec setDropTarget(This, DropTarget) -> ok when - This::wxWindow(), DropTarget::wxDropTarget:wxDropTarget(). + This::wxWindow(), DropTarget::wx:wx_object(). setDropTarget(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=DropTargetT,ref=DropTargetRef}) -> ?CLASS(ThisT,wxWindow), ?CLASS(DropTargetT,wxDropTarget), diff --git a/lib/wx/src/wx.erl b/lib/wx/src/wx.erl index 32e9f5da3f..7d62305048 100644 --- a/lib/wx/src/wx.erl +++ b/lib/wx/src/wx.erl @@ -71,13 +71,17 @@ retain_memory/1, release_memory/1]). -export([demo/0]). --export_type([wx_colour/0, wx_datetime/0, wx_enum/0, wx_mouseState/0, wx_wxHtmlLinkInfo/0]). + +-export_type([wx_object/0, wx_env/0, wx_memory/0]). +-export_type([wx_colour/0, wx_colour4/0, wx_datetime/0, + wx_enum/0, wx_wxMouseState/0, wx_wxHtmlLinkInfo/0]). + -include("wxe.hrl"). -include("../include/wx.hrl"). --opaque wx_object() :: #wx_ref{}. %% Opaque object reference --opaque wx_env() :: #wx_env{}. %% Opaque process environment --opaque wx_memory() :: binary() | #wx_mem{}. %% Opaque memory reference +-type wx_object() :: #wx_ref{}. %% Opaque object reference +-type wx_env() :: #wx_env{}. %% Opaque process environment +-type wx_memory() :: binary() | #wx_mem{}. %% Opaque memory reference -type wx_colour4() :: {R::byte(),G::byte(),B::byte(), A::byte()}. -type wx_colour() :: {R::byte(),G::byte(),B::byte()} | wx_colour4(). @@ -85,7 +89,7 @@ -type wx_datetime() :: {{Year::integer(),Month::integer(),Day::integer()}, {Hour::integer(),Minute::integer(),Second::integer()}}. %% In Local Timezone --type wx_mouseState() :: #wxMouseState{}. %% See #wxMouseState{} defined in wx.hrl +-type wx_wxMouseState() :: #wxMouseState{}. %% See #wxMouseState{} defined in wx.hrl -type wx_enum() :: integer(). %% Constant defined in wx.hrl -type wx_wxHtmlLinkInfo() :: #wxHtmlLinkInfo{}. @@ -311,14 +315,15 @@ debug(Level) when is_integer(Level) -> end. %% @doc Starts a wxErlang demo if examples directory exists and is compiled --spec demo() -> ok. +-spec demo() -> ok | {error, atom()}. demo() -> Priv = code:priv_dir(wx), Demo = filename:join([filename:dirname(Priv),examples,demo]), Mod = list_to_atom("demo"), %% Fool xref tests case file:set_cwd(Demo) of ok -> - apply(Mod, start, []); + apply(Mod, start, []), + ok; _ -> {error, no_demo_dir} end. diff --git a/lib/xmerl/include/xmerl_xlink.hrl b/lib/xmerl/include/xmerl_xlink.hrl deleted file mode 100644 index 375e244c23..0000000000 --- a/lib/xmerl/include/xmerl_xlink.hrl +++ /dev/null @@ -1,26 +0,0 @@ - - - -%% The following is a brief summary of the element types (columns) on -%% which the global attributes are allowed: -%% -%% simple extended locator arc resource title -%% type X X X X X X -%% href X X -%% role X X X X -%% title X X X X -%% show X X X -%% actuate X X X -%% from X -%% to X -%% --record(xlink, { - type, % simple | extended | locator | arc | resource | title - href, - role - title, - show, - actuate, - from, - to - }). diff --git a/lib/xmerl/src/Makefile b/lib/xmerl/src/Makefile index 7009b50f6c..5b77c9478b 100644 --- a/lib/xmerl/src/Makefile +++ b/lib/xmerl/src/Makefile @@ -94,7 +94,6 @@ MODULES = $(EDOC_MODULES) \ HRL_FILES = \ ../include/xmerl.hrl \ - ../include/xmerl_xlink.hrl \ ../include/xmerl_xpath.hrl \ ../include/xmerl_xsd.hrl diff --git a/lib/xmerl/src/xmerl_sax_parser.erl b/lib/xmerl/src/xmerl_sax_parser.erl index 45e2a928ac..1d795799ce 100644 --- a/lib/xmerl/src/xmerl_sax_parser.erl +++ b/lib/xmerl/src/xmerl_sax_parser.erl @@ -217,7 +217,7 @@ check_encoding_option(E) when E==utf8; E=={utf16,little}; E=={utf16,big}; check_encoding_option(utf16) -> {utf16,big}; check_encoding_option(E) -> - {error, io_lib:format("Charcter set ~p not supported", [E])}. + {error, io_lib:format("Character set ~p not supported", [E])}. %%---------------------------------------------------------------------- %% Function: detect_charset(Xml, State) @@ -279,6 +279,7 @@ convert_encoding(Enc) -> %% Just for 7,8 bit + utf8 case string:to_lower(Enc) of "utf-8" -> utf8; "us-ascii" -> utf8; + "latin1" -> latin1; "iso-8859-1" -> latin1; % Handle all iso-8859 as latin1 "iso-8859-2" -> latin1; "iso-8859-3" -> latin1; diff --git a/lib/xmerl/src/xmerl_sax_parser_base.erlsrc b/lib/xmerl/src/xmerl_sax_parser_base.erlsrc index c25cde0472..e988c49292 100644 --- a/lib/xmerl/src/xmerl_sax_parser_base.erlsrc +++ b/lib/xmerl/src/xmerl_sax_parser_base.erlsrc @@ -39,6 +39,9 @@ %% Internal exports %%---------------------------------------------------------------------- -export([ + cf/3, + cf/4, + cf/5 ]). %%---------------------------------------------------------------------- |