1: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
2: <HTML>
3: <HEAD>
4: <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
5: <TITLE>Hints for developers</TITLE>
6: </HEAD>
7: <BODY text="#000000" bgcolor="#ffffff">
8:
9: <A HREF="mpd.html"><EM>Mpd 5.9 User Manual</EM></A>
10: <b>:</b> <A HREF="mpd64.html"><EM>Internals</EM></A>
11: <b>:</b> <EM>Hints for developers</EM><BR>
12: <b>Previous:</b> <A HREF="mpd66.html"><EM>Authentication</EM></A><BR>
13: <b>Next:</b> <A HREF="mpd68.html"><EM>References</EM></A>
14:
15:
16: <HR NOSHADE>
17: <H2><A NAME="67"></A>8.3. Hints for developers<A NAME="developer"></A></H2>
18: <p>This chapter describes describes some hints for developers.</p>
19: <p>
20: <dl>
21:
22: <dt><b>Source-Code-Style</b><dd><p>There is not so much to say about that, just take a look at the existing
23: source files. <br>
24: The Tab-Width is eight with an indent of fore. Please make a space between
25: operators and operands.</p>
26:
27: <dt><b>NgFuncGetStats</b><dd><p>NEVER call NgFuncGetStats() with the <em>clear</em> parameter set to true, because
28: there are other functions (echo requests/replies, bandwidth management)
29: wich relies on increasing link-stats. Mpd carries a copy of the netgraph
30: link-stats at link-level, just use these instead. You can call
31: LinkUpdateStats() for updating the internal stats-struct.</p>
32:
33: <dt><b>New Authentication-Backends</b><dd><p>Authentication backends must run independently from the rest of Mpd, i.e.
34: you must not access any Mpd resource, because
35: the authentication process is started in its own thread (you have to
36: take care about thread-safety). An <code>AuthData</code> object is passed
37: to your authenticating function which carries a copy of all required
38: information. If your backend provides other parameters, like MTU, IP, etc.
39: then put these at the appropriate place into <code>AuthData</code> or
40: <code>Auth</code>.</p>
41: <p>If you can not avoid reading from Mpd's internal data, then acquire the
42: Giant Mutex:
43: <hr>
44: <pre>
45: [...]
46: pthread_mutex_lock(&gGiantMutex);
47: [do whatever]
48: pthread_mutex_unlock(&gGiantMutex);
49: [...]
50: </pre>
51: <hr>
52: </p>
53:
54: </dl>
55: </p>
56:
57:
58: <HR NOSHADE>
59: <A HREF="mpd.html"><EM>Mpd 5.9 User Manual</EM></A>
60: <b>:</b> <A HREF="mpd64.html"><EM>Internals</EM></A>
61: <b>:</b> <EM>Hints for developers</EM><BR>
62: <b>Previous:</b> <A HREF="mpd66.html"><EM>Authentication</EM></A><BR>
63: <b>Next:</b> <A HREF="mpd68.html"><EM>References</EM></A>
64:
65:
66:
67: </BODY>
68: </HTML>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>