1. Dynamic Host Configuration Protocol; RFC 2131
1.1 从client的角度来看,DHCP协议是BOOTP(RFC 951)的扩展
1.2 DHCP的第一个作用是给client提供非易失的存储能力,以key-value的方式存储参数;
1.3 DHCP的第二个作用是为client分配IP地址(临时的或永久的);
1.4 基本消息流程
Wednesday, July 7, 2010
EAP
1. Extensible Authentication Protocol (EAP), rfc3748
1.1 EAP 定义了一个身份验证的框架,支持多种验证算法。
1.2 EAP 对下层的传输协议没有依赖,自己提供可靠传输。具体来说,采用一一应答的方式,每一时刻处于传输过程中的消息只有一个。这种方式效率比较低,不适合用作大量数据传输。
1.3 EAP 复用模型
1.3.1 Lower layer. The lower layer is responsible for transmitting and receiving EAP frames between the peer and authenticator.
1.3.2 EAP layer. The EAP layer receives and transmits EAP packets via the lower layer, implements duplicate detection and retransmission, and delivers and receives EAP messages to and from the EAP peer and authenticator layers.
1.3.3 EAP peer and authenticator layers. Based on the Code field, the EAP layer demultiplexes incoming EAP packets to the EAP peer and authenticator layers.
1.3.4 EAP method layers. EAP methods implement the authentication algorithms and receive and transmit EAP messages via the EAP peer and authenticator layers.
1.4 EAP一共支持4种消息:Request/Response/Success/Failure
2. RADIUS Support For Extensible Authentication Protocol (EAP); rfc3579
2.1 In RADIUS/EAP, RADIUS is used to shuttle RADIUS-encapsulated EAP Packets between the NAS and an authentication server. EAP-Message and Message-Authenticator attributes are introduced to support EAP.
2.2 Example
3. The EAP-TLS Authentication Protocol; rfc5216
3.1 EAP-TLS (Transport Layer Security) 在EAP协议的基础上,提供了一种 "certificate-based" 双向的身份验证和密钥生成机制
4. Basic case
1.1 EAP 定义了一个身份验证的框架,支持多种验证算法。
1.2 EAP 对下层的传输协议没有依赖,自己提供可靠传输。具体来说,采用一一应答的方式,每一时刻处于传输过程中的消息只有一个。这种方式效率比较低,不适合用作大量数据传输。
1.3 EAP 复用模型
1.3.1 Lower layer. The lower layer is responsible for transmitting and receiving EAP frames between the peer and authenticator.
1.3.2 EAP layer. The EAP layer receives and transmits EAP packets via the lower layer, implements duplicate detection and retransmission, and delivers and receives EAP messages to and from the EAP peer and authenticator layers.
1.3.3 EAP peer and authenticator layers. Based on the Code field, the EAP layer demultiplexes incoming EAP packets to the EAP peer and authenticator layers.
1.3.4 EAP method layers. EAP methods implement the authentication algorithms and receive and transmit EAP messages via the EAP peer and authenticator layers.
1.4 EAP一共支持4种消息:Request/Response/Success/Failure
2. RADIUS Support For Extensible Authentication Protocol (EAP); rfc3579
2.1 In RADIUS/EAP, RADIUS is used to shuttle RADIUS-encapsulated EAP Packets between the NAS and an authentication server. EAP-Message and Message-Authenticator attributes are introduced to support EAP.
2.2 Example
3. The EAP-TLS Authentication Protocol; rfc5216
3.1 EAP-TLS (Transport Layer Security) 在EAP协议的基础上,提供了一种 "certificate-based" 双向的身份验证和密钥生成机制
4. Basic case
Monday, July 5, 2010
RADIUS
1. Remote Authentication Dial In User Service (RADIUS), rfc2865
RADIUS本身是个比较简单的协议,支持远程身份验证和Proxy. 通过下面几个消息,配合user-name, user-password等Attributes完成身份验证和用户配置功能。典型的应用有PPP验证等。
Access-Request
Access-Accept
Access-Reject
Access-Challenge
RADIUS使用UDP协议来传递数据,IANA端口为 1812
2. RADIUS Accounting, rfc2866
RADIUS协议的扩展,支持从Network Access Server (NAS) 到 RADIUS accounting server传递计费信息。IANA端口 1813
在服务开始和结束的时候,RADIUS Accounting Client发送Accounting-Request消息到RADIUS Accounting server,服务状态在Attribute中说明。 Server接受这条消息时,返回Accounting-Response消息,否则,什么也不返回。Client超时后,可能重发这条Request消息,也可能重建一条消息发送给备用服务器。
3. Dynamic Authorization Extensions to RADIUS, rfc3576
RADIUS协议扩展,允许RADIUS server主动发起会话,动态地修改用户的session。比如改变用户的授权,或者断开该用户的连接。
Disconnect-Request
Disconnect-ACK
Disconnect-NAK
CoA(Change-of-Authorization)-Request
CoA(Change-of-Authorization)-ACK
CoA(Change-of-Authorization)-NAK
RADIUS本身是个比较简单的协议,支持远程身份验证和Proxy. 通过下面几个消息,配合user-name, user-password等Attributes完成身份验证和用户配置功能。典型的应用有PPP验证等。
Access-Request
Access-Accept
Access-Reject
Access-Challenge
RADIUS使用UDP协议来传递数据,IANA端口为 1812
2. RADIUS Accounting, rfc2866
RADIUS协议的扩展,支持从Network Access Server (NAS) 到 RADIUS accounting server传递计费信息。IANA端口 1813
在服务开始和结束的时候,RADIUS Accounting Client发送Accounting-Request消息到RADIUS Accounting server,服务状态在Attribute中说明。 Server接受这条消息时,返回Accounting-Response消息,否则,什么也不返回。Client超时后,可能重发这条Request消息,也可能重建一条消息发送给备用服务器。
3. Dynamic Authorization Extensions to RADIUS, rfc3576
RADIUS协议扩展,允许RADIUS server主动发起会话,动态地修改用户的session。比如改变用户的授权,或者断开该用户的连接。
Disconnect-Request
Disconnect-ACK
Disconnect-NAK
CoA(Change-of-Authorization)-Request
CoA(Change-of-Authorization)-ACK
CoA(Change-of-Authorization)-NAK
Monday, June 28, 2010
MinGW and DLL
http://wyw.dcweb.cn/dllfaq.htm
A. Assume we have a testdll.h, testdll.c, and testmain.c. In the first case, we will compile testdll.c with MinGW, and let the MSVC-compiled testmain call it. You should use
gcc -shared -o testdll.dll testdll.c \
-Wl,--output-def,testdll.def,--out-implib,libtestdll.a
to produce the DLL and DEF files. MSVC cannot use the MinGW library, but since you have already the DEF file you may easily produce one by the Microsoft LIB tool:
lib /machine:i386 /def:testdll.def
Once you have testdll.lib, it is trivial to produce the executable with MSVC:
cl testmain.c testdll.lib
Now for MinGW programs calling an MSVC DLL. We have two methods. One way is to specify the LIB files directly on the command line after the main program (in newer MinGW versions; MinGW GCC 2.95.2 is reported not to work). For example, after
cl /LD testdll.c
use
gcc -o testmain testmain.c testdll.lib
The other way is to produce the .a files for GCC. For __cdecl functions (in most cases), it is simple: you only need to apply the reimp tool (the original site is unavailable now, but you may download here a version enhanced by José Fonseca):
reimp testdll.lib
gcc -o testmain testmain.c -L. -ltestdll
However, the above method does not work with __stdcall functions. For MSVC will prefix an underscore to __stdcall functions while MinGW will not. The right way is to produce the DEF file using the pexports tool (downloadable here if not found elsewhere) and filter off the first underscore by sed:
pexports testdll.dll | sed "s/^_//" > testdll.def
Then, when using dlltool to produce the import library, add `-U' to the command line:
dlltool -U -d testdll.def -l libtestdll.a
And now, you can proceed in the usual way:
gcc -o testmain testmain.c -L. -ltestdll
A. Assume we have a testdll.h, testdll.c, and testmain.c. In the first case, we will compile testdll.c with MinGW, and let the MSVC-compiled testmain call it. You should use
gcc -shared -o testdll.dll testdll.c \
-Wl,--output-def,testdll.def,--out-implib,libtestdll.a
to produce the DLL and DEF files. MSVC cannot use the MinGW library, but since you have already the DEF file you may easily produce one by the Microsoft LIB tool:
lib /machine:i386 /def:testdll.def
Once you have testdll.lib, it is trivial to produce the executable with MSVC:
cl testmain.c testdll.lib
Now for MinGW programs calling an MSVC DLL. We have two methods. One way is to specify the LIB files directly on the command line after the main program (in newer MinGW versions; MinGW GCC 2.95.2 is reported not to work). For example, after
cl /LD testdll.c
use
gcc -o testmain testmain.c testdll.lib
The other way is to produce the .a files for GCC. For __cdecl functions (in most cases), it is simple: you only need to apply the reimp tool (the original site is unavailable now, but you may download here a version enhanced by José Fonseca):
reimp testdll.lib
gcc -o testmain testmain.c -L. -ltestdll
However, the above method does not work with __stdcall functions. For MSVC will prefix an underscore to __stdcall functions while MinGW will not. The right way is to produce the DEF file using the pexports tool (downloadable here if not found elsewhere) and filter off the first underscore by sed:
pexports testdll.dll | sed "s/^_//" > testdll.def
Then, when using dlltool to produce the import library, add `-U' to the command line:
dlltool -U -d testdll.def -l libtestdll.a
And now, you can proceed in the usual way:
gcc -o testmain testmain.c -L. -ltestdll
Thursday, June 17, 2010
GSM A-interface (BSS - MSC)
1. 基本描述: ts 48.001
2. BSS - MSC 功能划分原则:ts 48.002
2.1 一般来说,用 MSC( Mobile Core Network) 代表核心网的用户面和控制面。有些情况下,MSC被分为两部分MSC-Server(MSC-S)和Media Gateway(MGW).
2.2 Mobility management
All transactions concerning mobility management (as specified in 3GPP TS 44.018) shall take place transparently between the MS and MSC/VLR/HLR, using the protocols described in Technical Specifications 3GPP TS 48.008 and 3GPP TS 48.006. The only exception to this rule is that of paging which is scheduled by the BSS on the appropriate cell.
2.3 Call control 由 MSC/HLR/VLR 负责
3. 信令传输: ts 48.006
3.1 The MTP and the SCCP are used to support signalling messages between the MSC and the BSS
3.2 One user function of the SCCP, called BSS Application Part (BSSAP) is defined. In the case of point-to-point calls the BSSAP uses one signalling connection per active Mobile Station having one or more active transactions for the transfer of layer 3 messages. The BSSAP user function is further subdivided into two separate functions:
3.2.1 he Direct Transfer Application sub-Part (DTAP) is used to transfer messages between the MSC and the MS; the layer-3 information in these messages is not interpreted by the BSS.
3.2.2 he BSS Management Application sub-Part (BSSMAP) supports other procedures between the MSC and the BSS related to the MS (resource management, handover control), or to a cell within the BSS, or to the whole BSS.
4. L3 specifications: ts 48.008
4.1 BSC负责管理本地的无线资源
4.2 CC(call control) 和MM(Mobility Management)消息,BSS使用DTAP协议传递给MSC,不做处理
4.3 从Radio收到的initial L3 message,BSS初步分析后使用BSSMAP的COMPLETE LAYER 3 INFORMATION消息传递给MSC.(eg. CM SERVICE REQUEST, PAGING RESPONSE, CM REESTABLISHMENT REQUEST, LOCATION UPDATING REQUEST, IMSI DETACH, IMMEDIATE SETUP)
2. BSS - MSC 功能划分原则:ts 48.002
2.1 一般来说,用 MSC( Mobile Core Network) 代表核心网的用户面和控制面。有些情况下,MSC被分为两部分MSC-Server(MSC-S)和Media Gateway(MGW).
2.2 Mobility management
All transactions concerning mobility management (as specified in 3GPP TS 44.018) shall take place transparently between the MS and MSC/VLR/HLR, using the protocols described in Technical Specifications 3GPP TS 48.008 and 3GPP TS 48.006. The only exception to this rule is that of paging which is scheduled by the BSS on the appropriate cell.
2.3 Call control 由 MSC/HLR/VLR 负责
3. 信令传输: ts 48.006
3.1 The MTP and the SCCP are used to support signalling messages between the MSC and the BSS
3.2 One user function of the SCCP, called BSS Application Part (BSSAP) is defined. In the case of point-to-point calls the BSSAP uses one signalling connection per active Mobile Station having one or more active transactions for the transfer of layer 3 messages. The BSSAP user function is further subdivided into two separate functions:
3.2.1 he Direct Transfer Application sub-Part (DTAP) is used to transfer messages between the MSC and the MS; the layer-3 information in these messages is not interpreted by the BSS.
3.2.2 he BSS Management Application sub-Part (BSSMAP) supports other procedures between the MSC and the BSS related to the MS (resource management, handover control), or to a cell within the BSS, or to the whole BSS.
4. L3 specifications: ts 48.008
4.1 BSC负责管理本地的无线资源
4.2 CC(call control) 和MM(Mobility Management)消息,BSS使用DTAP协议传递给MSC,不做处理
4.3 从Radio收到的initial L3 message,BSS初步分析后使用BSSMAP的COMPLETE LAYER 3 INFORMATION消息传递给MSC.(eg. CM SERVICE REQUEST, PAGING RESPONSE, CM REESTABLISHMENT REQUEST, LOCATION UPDATING REQUEST, IMSI DETACH, IMMEDIATE SETUP)
Wednesday, February 24, 2010
XML
"The skew.org XML Tutorial"
http://skew.org/xml/tutorial/
"C/C++ developers: Fill your XML toolbox"
http://www.ibm.com/developerworks/xml/library/x-ctlbx.html
Simple C++ XML tools (DOM)
RapidXML
http://rapidxml.sourceforge.net/
TinyXML
http://www.grinninglizard.com/tinyxml/
pugixml
http://code.google.com/p/pugixml/
http://skew.org/xml/tutorial/
"C/C++ developers: Fill your XML toolbox"
http://www.ibm.com/developerworks/xml/library/x-ctlbx.html
Simple C++ XML tools (DOM)
RapidXML
http://rapidxml.sourceforge.net/
TinyXML
http://www.grinninglizard.com/tinyxml/
pugixml
http://code.google.com/p/pugixml/
Monday, January 18, 2010
多核、多CPU环境下的程序开发
要点:
1. 任务划分,这点最关键。
1.1 对任务做充分理解,分清是数据密集型应用还是计算密集型计算。如果是数据密集型应用,则应该尽量提高总线的使用率(FSB, QPI等);而计算密集型应用,则应该提高CPU的使用率。
1.2 找出尽可能多的并行部分(任务分解,数据分解);
1.3 分析这些并行部分的特点,组成合适的并行任务

2. 资源本地化。尽量使所有的线程可以无条件地并发。
2.1 对于Non-Uniform Memory Access(NUMA) 结构的系统(多CPU的server,带QPI技术的intel多核处理器,带HyperTransport技术的AMD多核处理器),注意内存的分配位置。
3.充分利用Intel/AMD CPU的硬件特征。
3.1 充分利用CPU的本地cache
3.2 防止cache伪共享
3.3 系统内核同步?
3.4 数据密集型计算,注意NUMA特性.
可用技术:
Boost::thread
OpenMP
Intel Thread building block
MPI
语言内建的并行支持 (C#,Java等)
1. 任务划分,这点最关键。
1.1 对任务做充分理解,分清是数据密集型应用还是计算密集型计算。如果是数据密集型应用,则应该尽量提高总线的使用率(FSB, QPI等);而计算密集型应用,则应该提高CPU的使用率。
1.2 找出尽可能多的并行部分(任务分解,数据分解);
1.3 分析这些并行部分的特点,组成合适的并行任务

2. 资源本地化。尽量使所有的线程可以无条件地并发。
2.1 对于Non-Uniform Memory Access(NUMA) 结构的系统(多CPU的server,带QPI技术的intel多核处理器,带HyperTransport技术的AMD多核处理器),注意内存的分配位置。
3.充分利用Intel/AMD CPU的硬件特征。
3.1 充分利用CPU的本地cache
3.2 防止cache伪共享
3.3 系统内核同步?
3.4 数据密集型计算,注意NUMA特性.
可用技术:
Boost::thread
OpenMP
Intel Thread building block
MPI
语言内建的并行支持 (C#,Java等)
Subscribe to:
Posts (Atom)