ReactOS 0.4.16-dev-297-gc569aee
snmp_threadsync.h
Go to the documentation of this file.
1
6/*
7 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
8 * All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without modification,
11 * are permitted provided that the following conditions are met:
12 *
13 * 1. Redistributions of source code must retain the above copyright notice,
14 * this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright notice,
16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
18 * 3. The name of the author may not be used to endorse or promote products
19 * derived from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
22 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
23 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
24 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
26 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
29 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
30 * OF SUCH DAMAGE.
31 *
32 * This file is part of the lwIP TCP/IP stack.
33 *
34 * Author: Dirk Ziegelmeier <dziegel@gmx.de>
35 *
36 */
37
38#ifndef LWIP_HDR_APPS_SNMP_THREADSYNC_H
39#define LWIP_HDR_APPS_SNMP_THREADSYNC_H
40
41#include "lwip/apps/snmp_opts.h"
42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
47#if LWIP_SNMP /* don't build if not configured for use in lwipopts.h */
48
49#include "lwip/apps/snmp_core.h"
50#include "lwip/sys.h"
51
52typedef void (*snmp_threadsync_called_fn)(void* arg);
53typedef void (*snmp_threadsync_synchronizer_fn)(snmp_threadsync_called_fn fn, void* arg);
54
55
57struct threadsync_data
58{
59 union {
60 snmp_err_t err;
61 s16_t s16;
62 } retval;
63 union {
64 const u32_t *root_oid;
65 void *value;
66 } arg1;
67 union {
68 u8_t root_oid_len;
69 u16_t len;
70 } arg2;
71 const struct snmp_threadsync_node *threadsync_node;
72 struct snmp_node_instance proxy_instance;
73};
74
76struct snmp_threadsync_instance
77{
79 sys_mutex_t sem_usage_mutex;
80 snmp_threadsync_synchronizer_fn sync_fn;
81 struct threadsync_data data;
82};
83
85struct snmp_threadsync_node
86{
87 /* inherited "base class" members */
88 struct snmp_leaf_node node;
89
90 const struct snmp_leaf_node *target;
91 struct snmp_threadsync_instance *instance;
92};
93
94snmp_err_t snmp_threadsync_get_instance(const u32_t *root_oid, u8_t root_oid_len, struct snmp_node_instance* instance);
95snmp_err_t snmp_threadsync_get_next_instance(const u32_t *root_oid, u8_t root_oid_len, struct snmp_node_instance* instance);
96
98#define SNMP_CREATE_THREAD_SYNC_NODE(oid, target_leaf_node, threadsync_instance) \
99 {{{ SNMP_NODE_THREADSYNC, (oid) }, \
100 snmp_threadsync_get_instance, \
101 snmp_threadsync_get_next_instance }, \
102 (target_leaf_node), \
103 (threadsync_instance) }
104
106void snmp_threadsync_init(struct snmp_threadsync_instance *instance, snmp_threadsync_synchronizer_fn sync_fn);
107
108#endif /* LWIP_SNMP */
109
110#ifdef __cplusplus
111}
112#endif
113
114#endif /* LWIP_HDR_APPS_SNMP_THREADSYNC_H */
static HINSTANCE instance
Definition: main.c:40
signed short s16
Definition: linux.h:54
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLuint GLuint GLuint GLuint arg1
Definition: glext.h:9513
GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg2
Definition: glext.h:9514
GLenum GLsizei len
Definition: glext.h:6722
GLenum target
Definition: glext.h:7315
uint32_t u32_t
Definition: arch.h:129
uint8_t u8_t
Definition: arch.h:125
uint16_t u16_t
Definition: arch.h:127
int16_t s16_t
Definition: arch.h:128
int sys_mutex_t
Definition: sys_arch.h:38
static HANDLE sem
Definition: sync.c:674
#define err(...)
Definition: dlist.c:348
Definition: pdh_main.c:94
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159
void * arg
Definition: msvc.h:10