Symbian3/SDK/Source/GUID-B380482B-CF42-50BF-B09C-F4B3BDAA1679.dita
changeset 0 89d6a7a84779
equal deleted inserted replaced
-1:000000000000 0:89d6a7a84779
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE concept
       
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
       
    12 <concept xml:lang="en" id="GUID-B380482B-CF42-50BF-B09C-F4B3BDAA1679"><title>What are the Daemon Message Types?</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>This topic describes the daemon message types that the configuration daemon server's <codeph>ServiceL()</codeph> function handles. </p> <p>The server must handle 5 message types in its session <codeph>ServiceL()</codeph> function. These message types are as follows: </p> <ul><li id="GUID-6E5C7BFB-4600-5317-8ED6-0B2751FA0260"><p>The Configuration message type allows the daemon to configure the interface as it starts up. For more information see <xref href="GUID-B380482B-CF42-50BF-B09C-F4B3BDAA1679.dita#GUID-B380482B-CF42-50BF-B09C-F4B3BDAA1679/GUID-5E6928F9-9ACD-598A-A08B-DF779E15B2E1">Configuration</xref>. </p> </li> <li id="GUID-13BA483C-B4E8-5F5C-9813-6BF17531ACC5"><p>The deregistration message type allows the daemon to take action when the interface is shutting down. For more information see <xref href="GUID-B380482B-CF42-50BF-B09C-F4B3BDAA1679.dita#GUID-B380482B-CF42-50BF-B09C-F4B3BDAA1679/GUID-7AA93E7F-3285-54E0-8EFD-DD45600C5F8E">Deregistration</xref>. </p> </li> <li id="GUID-9C9A556C-7808-59DC-9F33-B2EA54C05F78"><p>Progress notifications allow the daemon to notify clients of events. For more information see <xref href="GUID-B380482B-CF42-50BF-B09C-F4B3BDAA1679.dita#GUID-B380482B-CF42-50BF-B09C-F4B3BDAA1679/GUID-8E23F63F-B5C8-57E3-A870-D5D2EC201A02">Progress notifications</xref>. </p> </li> <li id="GUID-8489091B-2DEF-5BF2-A151-DDDD2EE13003"><p>Ioctl commands allow the daemon to handle daemon-specific requests from clients. For more information see <xref href="GUID-B380482B-CF42-50BF-B09C-F4B3BDAA1679.dita#GUID-B380482B-CF42-50BF-B09C-F4B3BDAA1679/GUID-043DA160-844E-5406-8A73-99A26152647A">Ioctl commands</xref>. </p> </li> <li id="GUID-B19C54C9-2E60-541C-AC0A-FEE746A23EC2"><p>Cancellation and Cancellation mask messages allow asynchronous requests to the daemon to be cancelled. For more information see <xref href="GUID-B380482B-CF42-50BF-B09C-F4B3BDAA1679.dita#GUID-B380482B-CF42-50BF-B09C-F4B3BDAA1679/GUID-7E4F8183-F5A8-5E83-BB36-FD769A53A7EB">Cancellation</xref>  </p> </li> </ul> <section id="GUID-5E6928F9-9ACD-598A-A08B-DF779E15B2E1"><title>Configuration</title> <p>When a new connection is requested, the server receives an <codeph>EConfigDaemonConfigure</codeph> message. It occurs when a NIF calls <xref href="GUID-B0FB98F0-4327-3186-81F5-82653A854167.dita#GUID-B0FB98F0-4327-3186-81F5-82653A854167/GUID-7C4DABD0-D8DA-32CB-9CCD-1EBA7C8BFF87"><apiname>MNifIfNotify::LinkLayerUp()</apiname></xref> to indicate to NIFMAN that the link layer is up. </p> <p> <xref href="GUID-E104DE5D-FF3F-3E07-ACC3-E24A96DF3629.dita"><apiname>TConnectionInfoBuf</apiname></xref> packages a <xref href="GUID-BC490B7D-F1A8-399A-9D61-6D3CAC7F44AA.dita"><apiname>TConnectionInfo</apiname></xref> object that specifies the IDs of CommDb IAP and Network records used for the connection. </p> <p>The message has a data buffer parameter that provides a <xref href="GUID-E104DE5D-FF3F-3E07-ACC3-E24A96DF3629.dita"><apiname>TConnectionInfoBuf</apiname></xref> object. </p> <p>The following code reads the CommDb IAP ID from a received message: </p> <codeblock id="GUID-1F07E6F2-092E-52CE-8DB4-410D91FC07AE" xml:space="preserve">TConnectionInfoBuf conInfoBuf;
       
    13 aMessage.Read(0, conInfoBuf);
       
    14 TConnectionInfo conInfo = conInfoBuf();
       
    15 TInt iap = conInfo.iIapId;</codeblock> <p>This information allows the daemon to access the relevant CommDb records, and to update the fields. A Mobile IP daemon obtains a care-of-address for the phone and set the IP address for the interface using <codeph>RSocket::SetOpt(KSoInetConfigInterface, KSolInetIfCtrl,
       
    16           interfaceInfoBuf)</codeph>. </p> <p>The message request is asynchronous, and can be cancelled with a <xref href="GUID-43933310-47FA-399D-9362-BD48D375B316.dita"><apiname>EConfigDaemonCancel</apiname></xref> or <xref href="GUID-86450E9D-1DED-3A4B-A6CD-0D0E5F8B8930.dita"><apiname>EConfigDaemonCancelMask</apiname></xref> request. </p> <p>If the configuration is slow or if the idle timeouts are short, the daemon configuration may be interrupted by the expiry of the NIFMAN idle timer. To overcome this, the configuration daemon can disable and then enable idle timers at appropriate times using <codeph>RConnection::SetOpt(KCOLProvider,
       
    17           KConnDisableTimers, ETrue)</codeph>. </p> <p> <b>Note:</b> NIFMAN waits indefinitely for a configuration daemon to finish configuration of the interface if the idle timers have been disabled. The configuration daemon must be implemented robustly to ensure that the request is always terminated. </p> </section> <section id="GUID-7AA93E7F-3285-54E0-8EFD-DD45600C5F8E"><title>Deregistration</title> <p>The server receives a <codeph>EConfigDaemonDeregister</codeph> message when an interface is shuts down for one of the following reasons: </p> <ul><li id="GUID-7112394B-5621-5AA9-B9F8-BFD8F4B53341"><p>The NIFMAN idle timer is expired. This timer shuts down the interface if there has not been activity for a specified time. For more information about the time out values, see <xref href="GUID-9F96807F-25DC-5DE1-B327-3E339665FF64.dita">Reference</xref>  </p> </li> <li id="GUID-DE4DC647-144D-5B47-B0EC-5BA022E1BCDD"><p> <xref href="GUID-BED8A733-2ED7-31AD-A911-C1F4707C67FD.dita#GUID-BED8A733-2ED7-31AD-A911-C1F4707C67FD/GUID-52878713-A4E8-327E-901B-449EF3D39E0A"><apiname>RConnection::Stop()</apiname></xref> is called on the interface. </p> </li> </ul> <p>When it receives a deregistration message, the configuration daemon instructs NIFMAN to go into fast dormant mode. NIFMAN then keeps the NIF and the agent loaded, and stops the idle timer. </p> <p>When the daemon instructs NIFMAN to go into fast dormant mode, the daemon tells NIFMAN when the link is up again. It does this by issuing a <xref href="GUID-EFEF01EA-9EF6-35FC-812E-47E95E9D4183.dita"><apiname>KConfigDaemonFinishedDormantMode</apiname></xref> progress notification. For more information about progress notifications, see <xref href="GUID-B380482B-CF42-50BF-B09C-F4B3BDAA1679.dita#GUID-B380482B-CF42-50BF-B09C-F4B3BDAA1679/GUID-8E23F63F-B5C8-57E3-A870-D5D2EC201A02">progress notifications</xref>. NIFMAN sets the link state to indicate that it is up, and restarts the idle timer. </p> <p>The deregistration message has two parameters: </p> <ul><li id="GUID-29B497D7-F068-5AFA-A89B-198C0F39EDA5"><p>0: an integer <i>in</i> parameter that identifies the cause of the deregistration request. </p> <p>This is an enum <xref href="GUID-39B98E76-15C6-3294-A188-DA4C5296F83E.dita"><apiname>EConfigDaemonDeregisterCause</apiname></xref> value, being either <xref href="GUID-C1B80703-45CF-32C1-AE40-087D0F97087E.dita"><apiname>EConfigDaemonDeregisterCauseTimer</apiname></xref>, meaning the deregistration was caused by the NIFMAN idle timer, or <xref href="GUID-5E2B1486-994D-338C-B1F8-2986070A6447.dita"><apiname>EConfigDaemonDeregisterCauseStop</apiname></xref> which means the deregistration was caused by <xref href="GUID-BED8A733-2ED7-31AD-A911-C1F4707C67FD.dita#GUID-BED8A733-2ED7-31AD-A911-C1F4707C67FD/GUID-52878713-A4E8-327E-901B-449EF3D39E0A"><apiname>RConnection::Stop()</apiname></xref>. </p> </li> <li id="GUID-4686A6F8-7F5A-52F2-AE55-06E3889F7A01"><p>1: a <codeph>TDes8*</codeph>  <i>out</i> parameter that identifies the action NIFMAN must take. </p> <p>The daemon should package into this output buffer an enum <xref href="GUID-8DF05BAE-3D02-3C16-B941-D9F6EAC8D9B4.dita"><apiname>EConfigDaemonDeregisterAction</apiname></xref> value. The defined values are <xref href="GUID-04AD3BC8-5581-3305-B3CC-F59829E3FF42.dita"><apiname>EConfigDaemonDeregisterActionStop</apiname></xref>, meaning to stop the interface, or <xref href="GUID-B8FAD27D-432A-395C-852C-FC5E8A1D8813.dita"><apiname>EConfigDaemonDeregisterActionPreserve</apiname></xref>, meaning to preserve the interface state. </p> </li> </ul> <p>The message request is asynchronous, and can be cancelled with an <xref href="GUID-43933310-47FA-399D-9362-BD48D375B316.dita"><apiname>EConfigDaemonCancel</apiname></xref> or <xref href="GUID-86450E9D-1DED-3A4B-A6CD-0D0E5F8B8930.dita"><apiname>EConfigDaemonCancelMask</apiname></xref> request. For more information see <xref href="GUID-B380482B-CF42-50BF-B09C-F4B3BDAA1679.dita#GUID-B380482B-CF42-50BF-B09C-F4B3BDAA1679/GUID-7E4F8183-F5A8-5E83-BB36-FD769A53A7EB">Cancellation</xref>. </p> <p>Deregistration can be interrupted when the NIFMAN idle timer expires. For more information see <xref href="GUID-B380482B-CF42-50BF-B09C-F4B3BDAA1679.dita#GUID-B380482B-CF42-50BF-B09C-F4B3BDAA1679/GUID-5E6928F9-9ACD-598A-A08B-DF779E15B2E1">Configuration</xref>. </p> </section> <section id="GUID-8E23F63F-B5C8-57E3-A870-D5D2EC201A02"><title>Progress notifications</title> <p>When running, a daemon can generate progress notifications at any time. The NifMan receives these notifications and pass them to ESock and all ESock clients that subscribe to <xref href="GUID-BED8A733-2ED7-31AD-A911-C1F4707C67FD.dita#GUID-BED8A733-2ED7-31AD-A911-C1F4707C67FD/GUID-96DC395D-B5EE-3F26-8EFC-52E7AF64ED93"><apiname>RConnection::ProgressNotification()</apiname></xref> for the current interface. </p> <p>When the daemon is loaded it receives an <xref href="GUID-94D54DB4-1418-3938-940A-C79F79BFBCFC.dita"><apiname>EConfigDaemonProgress</apiname></xref> message that requests progress notifications. The message has a single <i>out</i> parameter, a <xref href="GUID-8E5DEEC4-5715-34B7-9A43-E17774A0D418.dita"><apiname>TDaemonProgressBuf</apiname></xref>, which packages a <xref href="GUID-67C2F692-09FB-3AAF-A96F-447788913F17.dita"><apiname>TDaemonProgress</apiname></xref> object. This has integer fields to hold the progress stage and error code. The integer fields correspond to those in the <xref href="GUID-883CEFF1-146E-30FF-9AD7-E13D0E9C6183.dita"><apiname>TNifProgress</apiname></xref> object. The client receives the <xref href="GUID-883CEFF1-146E-30FF-9AD7-E13D0E9C6183.dita"><apiname>TNifProgress</apiname></xref> object from <xref href="GUID-BED8A733-2ED7-31AD-A911-C1F4707C67FD.dita#GUID-BED8A733-2ED7-31AD-A911-C1F4707C67FD/GUID-96DC395D-B5EE-3F26-8EFC-52E7AF64ED93"><apiname>RConnection::ProgressNotification()</apiname></xref>. To send a notification from the client, the daemon writes its progress information into this parameter and complete this message. NifMan handles the notification and issues a progress request to the daemon. </p> <p>The daemon can define the appropriate stages for the function. <xref href="GUID-EFEF01EA-9EF6-35FC-812E-47E95E9D4183.dita"><apiname>KConfigDaemonFinishedDormantMode</apiname></xref> is used when resuming the link from dormant mode. </p> </section> <section id="GUID-043DA160-844E-5406-8A73-99A26152647A"><title>Ioctl commands</title> <p>When a client issues a <xref href="GUID-BED8A733-2ED7-31AD-A911-C1F4707C67FD.dita#GUID-BED8A733-2ED7-31AD-A911-C1F4707C67FD/GUID-9F820CF9-1D4F-3452-983B-E0C694D6783A"><apiname>RConnection::Ioctl()</apiname></xref> call the server receives an <codeph>EConfigDaemonIoctl</codeph> message. The configuration daemon can define its own set of ioctl commands, appropriate to its function. </p> <p>The following 4 parameters can be used: </p> <ul><li id="GUID-F8DAFE60-7CEA-5C8F-BE5B-D37A4B10B242"><p>0: an integer specifying the ioctl option level </p> </li> <li id="GUID-E1F331D3-A0CE-5942-90FE-429097D06927"><p>1: an integer specifying the ioctl option name </p> </li> <li id="GUID-D9BBECC6-EA44-57E7-B636-BF4F0986A29D"><p>2: a pointer to a caller supplied data buffer (<codeph>TDes8*</codeph>). This is optional. If set, the message handler reads data from the buffer, and writes back to it to return data to the caller. </p> </li> <li id="GUID-2C0021AA-C6EF-5A11-9FC1-341AFFEA8E18"><p>3: an integer specifying the maximum length of the caller supplied data buffer. If a buffer is not supplied this has a value of 0. </p> </li> </ul> <p>The following code gets the option level and name from the message. For messages that supply a data buffer (length&gt;0) the code calls a handler function <codeph>HandleClientRequestL()</codeph>. <codeph>HandleClientRequestL()</codeph> includes the returned buffer in the message. </p> <codeblock id="GUID-1480D18A-764C-5E38-B6E4-6292AAD75920" xml:space="preserve">  TUint optionLevel = aMessage.Int0();
       
    18   TUint optionName = aMessage.Int1();
       
    19   TInt length = aMessage.Int3();
       
    20 
       
    21   if (length&gt;0)
       
    22     {
       
    23     HBufC8* buffer = HBufC8::NewMaxLC(length);
       
    24     TPtr8 ptr = buffer-&gt;Des();
       
    25     aMessage.ReadL(2, ptr);
       
    26     HandleClientRequestL(optionLevel, optionName, &amp;ptr);
       
    27     aMessage.Write(2, ptr);
       
    28     CleanupStack::PopAndDestroy(buffer);
       
    29     aMessage.Complete(KErrNone);
       
    30     }</codeblock> <p>The message request is asynchronous, and can be cancelled with an <xref href="GUID-43933310-47FA-399D-9362-BD48D375B316.dita"><apiname>EConfigDaemonCancel</apiname></xref> or <xref href="GUID-86450E9D-1DED-3A4B-A6CD-0D0E5F8B8930.dita"><apiname>EConfigDaemonCancelMask</apiname></xref> request. </p> </section> <section id="GUID-7E4F8183-F5A8-5E83-BB36-FD769A53A7EB"><title>Cancellation</title> <p>An <xref href="GUID-43933310-47FA-399D-9362-BD48D375B316.dita"><apiname>EConfigDaemonCancel</apiname></xref> message cancels all outstanding requests except progress notifications. It does not have parameters. The service function completes the message and cancels any current asynchronous operations. </p> <p>An <xref href="GUID-86450E9D-1DED-3A4B-A6CD-0D0E5F8B8930.dita"><apiname>EConfigDaemonCancelMask</apiname></xref> message has a single integer parameter. If the parameter is <xref href="GUID-97EB0475-4421-3884-A56B-402A86CF1D94.dita"><apiname>KConfigDaemonOpMaskProgress</apiname></xref> the progress notifications are cancelled. If the parameter is <xref href="GUID-E0148481-84D9-3F78-81AC-7FBBA6CCE89D.dita"><apiname>KConfigDaemonOpMaskGeneral</apiname></xref>, all other outstanding operations are cancelled. <xref href="GUID-E0148481-84D9-3F78-81AC-7FBBA6CCE89D.dita"><apiname>KConfigDaemonOpMaskGeneral</apiname></xref> provides the same functionality as <xref href="GUID-43933310-47FA-399D-9362-BD48D375B316.dita"><apiname>EConfigDaemonCancel</apiname></xref>. </p> </section> </conbody><related-links><link href="GUID-F8482AFB-BD49-5EF2-8092-EAA11862F9C4.dita"><linktext>What is Network Interface Management
       
    31                 (NifMan)?</linktext> </link> <link href="GUID-82499F0B-2791-59B6-9BAE-F9F87234FBF1.dita"><linktext>Implementing a NifMan Daemon
       
    32                 Tutorial</linktext> </link> <link href="GUID-9F96807F-25DC-5DE1-B327-3E339665FF64.dita"><linktext>Reference</linktext> </link> </related-links></concept>