<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>lizongbo at 618119.com &#187; 短信</title>
	<atom:link href="http://618119.com/tag/%e7%9f%ad%e4%bf%a1/feed" rel="self" type="application/rss+xml" />
	<link>http://618119.com</link>
	<description>工作,生活,Android,前端,Linode,Ubuntu,nginx,java,apache,tomcat,Resin,mina,Hessian,XMPP,RPC</description>
	<lastBuildDate>Tue, 31 Jan 2012 14:25:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>几种短信协议</title>
		<link>http://618119.com/archives/2008/02/25/70.html</link>
		<comments>http://618119.com/archives/2008/02/25/70.html#comments</comments>
		<pubDate>Mon, 25 Feb 2008 01:32:22 +0000</pubDate>
		<dc:creator>lizongbo</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[CMPP]]></category>
		<category><![CDATA[smpp]]></category>
		<category><![CDATA[短信]]></category>

		<guid isPermaLink="false">http://618119.com/archives/2008/02/25/70.html</guid>
		<description><![CDATA[几种短信协议: 1.SMPP 国际标准 3.3, 3.4, 5.0 以下是中国特色的协议标准： 2.CMPP 中国移动 2.0, 3.0 3.SMGP 中国电信 1.3, 2.0, 3.0 4.SGIP 中国联通 1.2 5.CNGP 中国网通 2.0 6.PTOP 点对点短消息网间互通协议  3.0 Tags: CMPP, smpp, 短信]]></description>
		<wfw:commentRss>http://618119.com/archives/2008/02/25/70.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>基于格式规范的文档的代码生成器&#8211;根据cmpp3.0协议规范文档生成cmppapi数据包定义的java代码。</title>
		<link>http://618119.com/archives/2007/12/25/53.html</link>
		<comments>http://618119.com/archives/2007/12/25/53.html#comments</comments>
		<pubDate>Tue, 25 Dec 2007 04:12:14 +0000</pubDate>
		<dc:creator>lizongbo</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[apache mina]]></category>
		<category><![CDATA[CMPP]]></category>
		<category><![CDATA[cmppapi]]></category>
		<category><![CDATA[smpp]]></category>
		<category><![CDATA[smppapi]]></category>
		<category><![CDATA[smsc]]></category>
		<category><![CDATA[spring]]></category>
		<category><![CDATA[代码生成器]]></category>
		<category><![CDATA[短信]]></category>

		<guid isPermaLink="false">http://618119.com/archives/2007/12/25/53.html</guid>
		<description><![CDATA[代码生成器方式产生的代码，有不少好处，主要是代码可反复生成， 代码风格一致且灵活可控，减少出错率概率，减轻人工负担。 前提是数据来源有一定规律，可解析。 网上有一些开源cmppapi的java代码或者某些厂商提供的api开发包，都只实现了各自需要的部分功能，因此并没有定义出所有的cmpp数据包结构体。 由于CMPP一共定义了32个数据包。数据包的字段不少，如果全靠手工对照规范来编写代码，纯打字的体力活会让人辛苦好久。 由于CMPP协议也是 PDU协议，所以数据包和字段属性定义都很规范，对应的数据包定义和解析代码也可以写的很规范。 smppapi的代码就是非常优秀的典范。 于是，想到个办法来根据规范内容，自动生成数据包定义的代码。 1.先找到cmpp的规范，最好的是cmpp的word格式文档，因为里面的数据包属性定义是表格装起来的，非常方便解析。 pdf格式的转成html得不到标准的表格,解析很麻烦. 2.将word文档存成html。 3.写代码，将html里的style等用不着的html属性去掉。 在Editplus里用了3个正则表达式。先将冒号结尾的行合并为一行(:\n &#8211;&#62; :)，再将分号结尾的行合并为一行(;\n  &#8211;&#62; ;)， 再将style属性去掉 ((style=&#8217;(.*)?&#8217;) 进行匹配),再去掉width等属性。 重点只保留tabel，tr，td，为解析做准备。 (事后证明，这些对html的手工操作根本不需要，白浪费我时间) 4.复制出32个comand的定义，写代码将其生成为32个常量及初始的类文件。 5.复制表格，针对每个表格，生成对应数据包包体的解析与组装代码。 这里比较辛苦，需要复制30个表格。 (事后证明，不需要一个一个的操作表格) 主要做变量名的去空格，首字母小写，下划线后的字母大写，去掉下划线 变量类型转换成对应的java类型， 需要生成的代码有：每个属性的变量定义及说明，get，Set方法，encodeBody代码，readFromBody的代码， 所生成的代码，与smppapi里的SMPPPacket代码风格一致。 生成好的代码加点手工调整，基本上所有的数据包定义就弄好了。省下的的时间，是重点实现业务逻辑。 再结合Apache mina ，联手Spring，很快就可以实现一个支持CMPP协议的基础服务端和基本客户端。 开发步骤可参考 用Spring,smppapi,apache mina, commons ssl快速实现安全的smpp smsc序列：http://618119.com/archives/2007/12/14/46.html 总结出点经验：写出格式比较规范的文档，是利己利人的好事情。尤其是docbook等xml格式，解析非常方便。 比如SMGP协议规范的文档排版就比较烂，生成代码就没CMPP这么方便。没兴趣去折腾它了。 生成代码的代码很简单，就不贴了，下面是我生成好的CMPP常量定义与各消息包的变量定义， get,Set及其它方法的生成代码还没写，不过也很方便生成了。 [code] --------常量定义------------ /** Command Id:请求连接  */ public static final int [...]]]></description>
		<wfw:commentRss>http://618119.com/archives/2007/12/25/53.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>用Spring,smppapi,apache mina, commons ssl快速实现安全的smpp smsc (六)</title>
		<link>http://618119.com/archives/2007/12/14/46.html</link>
		<comments>http://618119.com/archives/2007/12/14/46.html#comments</comments>
		<pubDate>Fri, 14 Dec 2007 06:37:02 +0000</pubDate>
		<dc:creator>lizongbo</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[apache mina]]></category>
		<category><![CDATA[commons ssl]]></category>
		<category><![CDATA[smpp]]></category>
		<category><![CDATA[smppapi]]></category>
		<category><![CDATA[smsc]]></category>
		<category><![CDATA[spring]]></category>
		<category><![CDATA[短信]]></category>

		<guid isPermaLink="false">http://618119.com/archives/2007/12/14/46.html</guid>
		<description><![CDATA[接上一篇： http://618119.com/archives/2007/12/13/45.html 使用 commons ssl生成 SSLContext ： [code] package com.lizongbo.smpp.ssl; import javax.net.ssl.SSLContext; import java.security.GeneralSecurityException; import java.io.IOException; import javax.net.ssl.KeyManager; import org.apache.commons.ssl.KeyMaterial; public class SMPPSSLContextFactory { private static final String PROTOCOL = "TLS"; private static final String CA_FILE = "ca.crt.properties"; private static final String CERT_FILE = "server.crt.properties"; private static final String KEY_FILE = "server.key.properties"; private static final [...]]]></description>
		<wfw:commentRss>http://618119.com/archives/2007/12/14/46.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>用Spring,smppapi,apache mina, commons ssl快速实现安全的smpp smsc (五)</title>
		<link>http://618119.com/archives/2007/12/13/45.html</link>
		<comments>http://618119.com/archives/2007/12/13/45.html#comments</comments>
		<pubDate>Thu, 13 Dec 2007 00:43:32 +0000</pubDate>
		<dc:creator>lizongbo</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[apache mina]]></category>
		<category><![CDATA[commons ssl]]></category>
		<category><![CDATA[JMX]]></category>
		<category><![CDATA[smpp]]></category>
		<category><![CDATA[smppapi]]></category>
		<category><![CDATA[smsc]]></category>
		<category><![CDATA[spring]]></category>
		<category><![CDATA[短信]]></category>

		<guid isPermaLink="false">http://618119.com/archives/2007/12/13/45.html</guid>
		<description><![CDATA[接上一篇: http://618119.com/archives/2007/12/06/39.html 为 DefaultIoFilterChainBuilder 增加filter: [code] import org.apache.mina.filter.LoggingFilter; import javax.net.ssl.SSLContext; import org.apache.mina.filter.SSLFilter; import org.apache.mina.common.DefaultIoFilterChainBuilder; import org.apache.mina.filter.codec.ProtocolCodecFilter; import org.apache.commons.ssl.*; import java.io.*; import java.security.*; import com.lizongbo.smpp.ssl.SMPPSSLContextFactory; import com.lizongbo.smpp.server.codec.SMPPProtocolCodecFactory; public static final int PORT = 5432; public static final int CONNECT_TIMEOUT = 3; // seconds private static final boolean USE_SSL = true; private static final boolean USE_LOG = [...]]]></description>
		<wfw:commentRss>http://618119.com/archives/2007/12/13/45.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>用Spring,smppapi,apache mina, commons ssl快速实现安全的smpp smsc (四)</title>
		<link>http://618119.com/archives/2007/12/06/39.html</link>
		<comments>http://618119.com/archives/2007/12/06/39.html#comments</comments>
		<pubDate>Thu, 06 Dec 2007 01:18:01 +0000</pubDate>
		<dc:creator>lizongbo</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[apache mina]]></category>
		<category><![CDATA[commons ssl]]></category>
		<category><![CDATA[smpp]]></category>
		<category><![CDATA[smppapi]]></category>
		<category><![CDATA[smsc]]></category>
		<category><![CDATA[spring]]></category>
		<category><![CDATA[短信]]></category>

		<guid isPermaLink="false">http://618119.com/archives/2007/12/06/39.html</guid>
		<description><![CDATA[接上一篇: http://618119.com/archives/2007/12/03/35.html 对 SMPPPacket的业务处理代码: 1.处理 BIND_RECEIVER消息 [code] package com.lizongbo.smpp.server.handlers; import org.apache.mina.common.*; import com.lizongbo.smpp.server.*; import ie.omk.smpp.*; import ie.omk.smpp.message.*; import ie.omk.smpp.message.tlv.*; import ie.omk.smpp.util.*; import ie.omk.smpp.version.*; /** * * &#60;p&#62;Title: BindReceiver Handler&#60;/p&#62; * * &#60;p&#62;Description: smpp BIND_RECEIVER&#60;/p&#62; * * &#60;p&#62;Copyright: Copyright (c) 2007&#60;/p&#62; * * &#60;p&#62;Company: http://618119.com &#60;/p&#62; * * @author lizongbo * @version 1.0 */ public class [...]]]></description>
		<wfw:commentRss>http://618119.com/archives/2007/12/06/39.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>用Spring,smppapi,apache mina, commons ssl快速实现安全的smpp smsc (三)</title>
		<link>http://618119.com/archives/2007/12/03/35.html</link>
		<comments>http://618119.com/archives/2007/12/03/35.html#comments</comments>
		<pubDate>Mon, 03 Dec 2007 03:30:25 +0000</pubDate>
		<dc:creator>lizongbo</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[apache mina]]></category>
		<category><![CDATA[commons ssl]]></category>
		<category><![CDATA[smpp]]></category>
		<category><![CDATA[smppapi]]></category>
		<category><![CDATA[smsc]]></category>
		<category><![CDATA[spring]]></category>
		<category><![CDATA[短信]]></category>

		<guid isPermaLink="false">http://618119.com/archives/2007/12/03/35.html</guid>
		<description><![CDATA[接上一篇: http://618119.com/archives/2007/11/29/34.html 针对每个SMPPPacket的处理,将其以接口方式进行处理,接口定义如下: [code] package com.lizongbo.smpp.server; import org.apache.mina.common.IoSession; import ie.omk.smpp.message.SMPPPacket; import ie.omk.smpp.BadCommandIDException; public interface SMPPPacketHandler { void process(IoSession session, SMPPPacket packet) throws BadCommandIDException; } [/code] SMPPServerSessionHandler中通过commandid来找到相应的handler,然后进行处理. [code] package com.lizongbo.smpp.server; import java.util.*; import org.apache.mina.common.*; import ie.omk.smpp.*; import ie.omk.smpp.message.*; import ie.omk.smpp.version.*; public class SMPPServerSessionHandler extends IoHandlerAdapter { private Map&#60;Long, SMPPPacketHandler&#62; handles = null; private int readerIdleTimeout = [...]]]></description>
		<wfw:commentRss>http://618119.com/archives/2007/12/03/35.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>用Spring,smppapi,apache mina, commons ssl快速实现安全的smpp smsc (二)</title>
		<link>http://618119.com/archives/2007/11/29/34.html</link>
		<comments>http://618119.com/archives/2007/11/29/34.html#comments</comments>
		<pubDate>Thu, 29 Nov 2007 06:39:00 +0000</pubDate>
		<dc:creator>lizongbo</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[apache mina]]></category>
		<category><![CDATA[commons ssl]]></category>
		<category><![CDATA[smpp]]></category>
		<category><![CDATA[smppapi]]></category>
		<category><![CDATA[smsc]]></category>
		<category><![CDATA[spring]]></category>
		<category><![CDATA[短信]]></category>

		<guid isPermaLink="false">http://618119.com/archives/2007/11/29/34.html</guid>
		<description><![CDATA[接上一篇: http://618119.com/archives/2007/11/27/31.html 对smpp 数据包进行编码和解码的相关代码如下: ProtocolCodecFactory的代码为: [code] package com.lizongbo.smpp.server.codec; import org.apache.mina.filter.codec.ProtocolCodecFactory; import org.apache.mina.filter.codec.ProtocolEncoder; import org.apache.mina.filter.codec.ProtocolDecoder; public class SMPPProtocolCodecFactory implements ProtocolCodecFactory { ProtocolDecoder decoder = new SMPPProtocolDecoder(); ProtocolEncoder encoder = new SMPPProtocolEncoder(); public ProtocolEncoder getEncoder() throws Exception { return encoder; } public ProtocolDecoder getDecoder() throws Exception { return decoder; } } [/code] 数据包解码的ProtocolDecoder为 [code] package com.lizongbo.smpp.server.codec; import [...]]]></description>
		<wfw:commentRss>http://618119.com/archives/2007/11/29/34.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>用Spring,smppapi,apache mina, commons ssl快速实现安全的smpp smsc (一)</title>
		<link>http://618119.com/archives/2007/11/27/31.html</link>
		<comments>http://618119.com/archives/2007/11/27/31.html#comments</comments>
		<pubDate>Tue, 27 Nov 2007 05:19:51 +0000</pubDate>
		<dc:creator>lizongbo</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[apache mina]]></category>
		<category><![CDATA[commons ssl]]></category>
		<category><![CDATA[smpp]]></category>
		<category><![CDATA[smppapi]]></category>
		<category><![CDATA[smsc]]></category>
		<category><![CDATA[spring]]></category>
		<category><![CDATA[短信]]></category>

		<guid isPermaLink="false">http://618119.com/archives/2007/11/27/31.html</guid>
		<description><![CDATA[需要用到的java库有: Apache mina : http://mina.apache.org Spring: http://www.springframework.org/ smppapi http://smppapi.sourceforge.net/ commons ssl: http://juliusdavies.ca/commons-ssl/ smpp smsc Server的服务端启动代码: [code] package com.lizongbo.smpp.server; import org.apache.mina.filter.LoggingFilter; import com.lizongbo.smpp.server.codec.SMPPProtocolCodecFactory; import org.apache.mina.filter.codec.ProtocolCodecFilter; import org.apache.mina.common.DefaultIoFilterChainBuilder; import java.net.InetSocketAddress; import org.apache.mina.common.IoAcceptorConfig; import org.apache.mina.transport.socket.nio.SocketAcceptor; import org.apache.mina.common.IoAcceptor; import org.apache.mina.transport.socket.nio.SocketAcceptorConfig; import java.io.IOException; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import java.util.Set; import org.apache.mina.common.IoSession; import ie.omk.smpp.*; import ie.omk.smpp.message.*; import ie.omk.smpp.util.PacketFactory; import java.util.*; import [...]]]></description>
		<wfw:commentRss>http://618119.com/archives/2007/11/27/31.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

