1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<HTML>
3<HEAD>
4<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
5<META http-equiv="Content-Style-Type" content="text/css">
6<TITLE>SOLibraryConfig</TITLE>
7<LINK rel="stylesheet" type="text/css" href="../CSS/rex.css">
8</HEAD>
9<BODY>
10<H1>SOLibraryConfig</H1>
11
12<H2>C Specification</H2>
13<DL>
14	<DD><PRE><CODE>#include &lt;revolution/so.h&gt;</CODE></PRE>
15	<DD><PRE><CODE>typedef  void*  ( *SOAlloc )( u32 name, s32 size );
16typedef  void   ( *SOFree ) ( u32 name, void* ptr, s32 size );
17typedef  struct SOLibraryConfig  SOLibraryConfig;</CODE></PRE>
18	<DD><PRE><CODE>struct SOLibraryConfig
19{
20    SOAlloc   alloc;
21    SOFree    free;
22};
23</CODE></PRE>
24</CODE></PRE>
25</DL>
26
27<H2>Description</H2>
28<P>
29	The structure that defines the function to be called by the SO Library when actively allocating and deallocating work buffers. Specified when the <code><a href="SOInit.html">SOInit</a></CODE> function is called.
30</P>
31<P style="background-color:ffe8ff;padding-top:4px;padding-bottom:4px;padding-left:4px;padding-right:4px;">
32	<strong>Note: </strong>See to it that a buffer aligned with a leading 32-byte border is allocated from MEM2 in the function specified in <CODE><strong><em>alloc</em></strong></CODE>. Furthermore, if the SO Library is operated from multiple threads, it is possible that <CODE><strong><em>alloc</em></strong></CODE> can be called multiple times at once. Perform exclusion control among threads among functions specifying <CODE><strong><em>alloc</em></strong></CODE> as needed for a multi-threaded application.
33</P>
34<TABLE border="1" cellpadding="3" cellspacing="0.1">
35	<TR>
36		<TH style="width:60px;"><em>alloc</em></TH>
37		<TD>
38			Specifies the function called by the SO Library when actively allocating a work buffer.<br>Return the leading pointer to the allocated buffer as a return value. Return a <CODE>null</CODE> pointer when the buffer cannot be allocated.<br>The arguments called from the SO Library are as follows:
39			<TABLE border="1" cellpadding="3" cellspacing="0.1">
40				<TR>
41					<TH style="width:60px;">name</TH>
42					<TD>
43						Specifies the use of the buffer to be allocated.
44						<TABLE border="1" cellpadding="3" cellspacing="0.1">
45							<TR>
46								<TH>SO_MEM_RESOLVER</TH>
47								<TD>
48									Used as the shared work area for the host information search function. Allocated when <CODE><a href="SOInit.html">SOInit</a></CODE> is called; deallocated when <CODE><a href="SOFinish.html">SOFinish</a></CODE> is called.
49								</TD>
50							</TR>
51							<TR>
52								<TH>SO_MEM_IPC</TH>
53								<TD>
54									Used as the work area for communication with the firmware. Allocation will be done appropriately each time communication with the firmware occurs.
55								</TD>
56							</TR>
57							<TR>
58								<TH>SO_MEM_ADDRINFO</TH>
59								<TD>
60									Used as the area to store search results during host information search.
61								</TD>
62							</TR>
63							<TR>
64								<TH>SO_MEM_RECVFROM</TH>
65								<TD>
66									Used as the temporary work area for loading data when data is being received. Allocation will be done as necessary for each data reception.
67								</TD>
68							</TR>
69							<TR>
70								<TH>SO_MEM_SENDTO</TH>
71								<TD>
72									Used as the temporary work area for writing data when data is being sent. Allocation will be done as necessary for each data send.
73								</TD>
74							</TR>
75						</TABLE>
76					</TD>
77				</TR>
78				<TR>
79					<TH style="width:60px;">size</TH>
80					<TD>
81						Specifies the size of the buffer to be allocated in bytes.
82					</TD>
83				</TR>
84			</TABLE>
85		</TD>
86	</TR>
87	<TR>
88		<TH style="width:60px;"><em>free</em></TH>
89		<TD>
90			Specifies the function called by the SO Library when deallocating a work buffer that was actively allocated.<br>The arguments called from the SO Library are as follows:
91			<TABLE border="1" cellpadding="3" cellspacing="0.1">
92				<TR>
93					<TH style="width:60px;">name</TH>
94					<TD>
95						The buffer to be deallocated is specified by the <CODE><strong><em>name</em></strong></CODE> specified at allocation.
96					</TD>
97				</TR>
98				<TR>
99					<TH style="width:60px;">ptr</TH>
100					<TD>
101						Specifies the leading pointer of the buffer to be deallocated.
102					</TD>
103				</TR>
104				<TR>
105					<TH style="width:60px;">size</TH>
106					<TD>
107						Specifies the size of the buffer to be deallocated in bytes.
108					</TD>
109				</TR>
110			</TABLE>
111		</TD>
112	</TR>
113</TABLE>
114
115<H2>See Also</H2>
116<P>
117	<CODE><a href="SOInit.html">SOInit</a><br> <a href="SOFinish.html">SOFinish</a><br></CODE>
118</P>
119
120<H2>Revision History</H2>
121<P>
122	2007/01/31 Initial version.<br>
123</P>
124
125<hr><p>CONFIDENTIAL</p></body>
126</HTML>
127