author | korovkin <korovkin> | 2006-03-19 14:42:34 (UTC) |
---|---|---|
committer | korovkin <korovkin> | 2006-03-19 14:42:34 (UTC) |
commit | adbd8bde1b0b24e5ea7047dea7228451964ac23a (patch) (unidiff) | |
tree | 761e7695e2c88ae2ac40d9b4e4adeff7d931cddc | |
parent | 3b671ecea335b81c65ec03ad70fa3f25e9bb0a3e (diff) | |
download | opie-adbd8bde1b0b24e5ea7047dea7228451964ac23a.zip opie-adbd8bde1b0b24e5ea7047dea7228451964ac23a.tar.gz opie-adbd8bde1b0b24e5ea7047dea7228451964ac23a.tar.bz2 |
We scan ports prior to scanning names.
-rw-r--r-- | noncore/net/opietooth/lib/parser.cc | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/noncore/net/opietooth/lib/parser.cc b/noncore/net/opietooth/lib/parser.cc index 7e95907..d20b9f3 100644 --- a/noncore/net/opietooth/lib/parser.cc +++ b/noncore/net/opietooth/lib/parser.cc | |||
@@ -110,96 +110,94 @@ bool Parser::parseRecHandle( const QString& str) { | |||
110 | if (str.startsWith("Service RecHandle:" ) ) { | 110 | if (str.startsWith("Service RecHandle:" ) ) { |
111 | QString out = str.mid(18 ).stripWhiteSpace(); | 111 | QString out = str.mid(18 ).stripWhiteSpace(); |
112 | owarn << "out " << out.latin1() << oendl; | 112 | owarn << "out " << out.latin1() << oendl; |
113 | int value = out.mid(2).toInt(&m_ok, 16 ); | 113 | int value = out.mid(2).toInt(&m_ok, 16 ); |
114 | if (m_ok && (value != -1) ) | 114 | if (m_ok && (value != -1) ) |
115 | m_complete = true; | 115 | m_complete = true; |
116 | else | 116 | else |
117 | m_complete = false; | 117 | m_complete = false; |
118 | owarn << "rec handle " << value << oendl; | 118 | owarn << "rec handle " << value << oendl; |
119 | m_item.setRecHandle( value ); | 119 | m_item.setRecHandle( value ); |
120 | return true; | 120 | return true; |
121 | 121 | ||
122 | } | 122 | } |
123 | return false; | 123 | return false; |
124 | } | 124 | } |
125 | bool Parser::parseClassId( const QString& str) { | 125 | bool Parser::parseClassId( const QString& str) { |
126 | if (str.startsWith("Service Class ID List:") ) { | 126 | if (str.startsWith("Service Class ID List:") ) { |
127 | owarn << "found class id" << oendl; | 127 | owarn << "found class id" << oendl; |
128 | owarn << "line: " << str.latin1() << oendl; | 128 | owarn << "line: " << str.latin1() << oendl; |
129 | m_classOver = true; | 129 | m_classOver = true; |
130 | return true; | 130 | return true; |
131 | }else if ( m_classOver && str.startsWith(" " ) ){ // ok now are the informations in place | 131 | }else if ( m_classOver && str.startsWith(" " ) ){ // ok now are the informations in place |
132 | owarn << "line with class id" << oendl; | 132 | owarn << "line with class id" << oendl; |
133 | owarn << str.latin1() << oendl; | 133 | owarn << str.latin1() << oendl; |
134 | 134 | ||
135 | // "Obex Object Push" (0x1105) | 135 | // "Obex Object Push" (0x1105) |
136 | // find backwards the " and the from 0 to pos and the mid pos+1 | 136 | // find backwards the " and the from 0 to pos and the mid pos+1 |
137 | // then stripWhiteSpace add name replace '"' with "" | 137 | // then stripWhiteSpace add name replace '"' with "" |
138 | // and then convert 0x1105 toInt() | 138 | // and then convert 0x1105 toInt() |
139 | QString classes; | 139 | QString classes; |
140 | int ids; | 140 | int ids; |
141 | ids = convert( str, classes ); | 141 | ids = convert( str, classes ); |
142 | owarn << "ids " << ids << oendl; | 142 | owarn << "ids " << ids << oendl; |
143 | m_item.insertClassId( ids, classes ); | 143 | m_item.insertClassId( ids, classes ); |
144 | 144 | ||
145 | return true; | 145 | return true; |
146 | }else{ | 146 | }else{ |
147 | owarn << "Else " << m_classOver << oendl; | 147 | owarn << "Else " << m_classOver << oendl; |
148 | m_classOver = false; | 148 | m_classOver = false; |
149 | } | 149 | } |
150 | return false; | 150 | return false; |
151 | } | 151 | } |
152 | bool Parser::parseProtocol( const QString& str) { | 152 | bool Parser::parseProtocol( const QString& str) { |
153 | if (str.startsWith("Protocol Descriptor List:") ) { | 153 | if (str.startsWith("Protocol Descriptor List:") ) { |
154 | m_protocolOver = true; | 154 | m_protocolOver = true; |
155 | m_protocolAdded = false; | 155 | m_protocolAdded = false; |
156 | return true; | 156 | return true; |
157 | 157 | ||
158 | }else if (m_protocolOver && str.startsWith(" ") ) { | ||
159 | m_protocolAdded = true; | ||
160 | QString dummy = str.stripWhiteSpace(); | ||
161 | int pos = dummy.findRev(':'); | ||
162 | if ( pos > -1 ) { | ||
163 | int port = dummy.mid(pos+1 ).stripWhiteSpace().toInt(); | ||
164 | Services::ProtocolDescriptor desc( m_protName, m_protId, port ); | ||
165 | m_item.insertProtocolDescriptor( desc ); | ||
166 | } | ||
167 | return true; | ||
158 | }else if (m_protocolOver && str.startsWith(" ") ) { // "L2CAP" (0x0100) | 168 | }else if (m_protocolOver && str.startsWith(" ") ) { // "L2CAP" (0x0100) |
159 | owarn << "double protocol filter" << oendl; | ||
160 | 169 | ||
161 | if (!m_protocolAdded ) { // the protocol does neither supply a channel nor port so add it now | 170 | if (!m_protocolAdded ) { // the protocol does neither supply a channel nor port so add it now |
162 | Services::ProtocolDescriptor desc( m_protName, m_protId ); | 171 | Services::ProtocolDescriptor desc( m_protName, m_protId ); |
163 | m_item.insertProtocolDescriptor( desc ); | 172 | m_item.insertProtocolDescriptor( desc ); |
164 | } | 173 | } |
165 | m_protocolAdded = false; | 174 | m_protocolAdded = false; |
166 | { // the find function | 175 | { // the find function |
167 | m_protId = convert(str, m_protName ); | 176 | m_protId = convert(str, m_protName ); |
168 | } | 177 | } |
169 | return true; | 178 | return true; |
170 | }else if (m_protocolOver && str.startsWith(" ") ) { | ||
171 | owarn << "tripple protocol filter" << oendl; | ||
172 | m_protocolAdded = true; | ||
173 | QString dummy = str.stripWhiteSpace(); | ||
174 | int pos = dummy.findRev(':'); | ||
175 | if ( pos > -1 ) { | ||
176 | int port = dummy.mid(pos+1 ).stripWhiteSpace().toInt(); | ||
177 | Services::ProtocolDescriptor desc( m_protName, m_protId, port ); | ||
178 | m_item.insertProtocolDescriptor( desc ); | ||
179 | } | ||
180 | return true; | ||
181 | }else if (m_protocolOver ) { | 179 | }else if (m_protocolOver ) { |
182 | m_protocolOver = false; | 180 | m_protocolOver = false; |
183 | } | 181 | } |
184 | return false; | 182 | return false; |
185 | } | 183 | } |
186 | bool Parser::parseProfile( const QString& str) { | 184 | bool Parser::parseProfile( const QString& str) { |
187 | if (str.startsWith("Profile Descriptor List:") ) { | 185 | if (str.startsWith("Profile Descriptor List:") ) { |
188 | m_profOver = true; | 186 | m_profOver = true; |
189 | }else if ( m_profOver && str.startsWith(" ") ) { | 187 | }else if ( m_profOver && str.startsWith(" ") ) { |
190 | m_profId = convert( str, m_profName ); | 188 | m_profId = convert( str, m_profName ); |
191 | }else if ( m_profOver && str.startsWith(" ") ) { | 189 | }else if ( m_profOver && str.startsWith(" ") ) { |
192 | // now find | 190 | // now find |
193 | int pos = str.findRev(':'); | 191 | int pos = str.findRev(':'); |
194 | if ( pos > 0 ) { | 192 | if ( pos > 0 ) { |
195 | int dummy = str.mid(pos+1 ).stripWhiteSpace().toInt(); | 193 | int dummy = str.mid(pos+1 ).stripWhiteSpace().toInt(); |
196 | owarn << "dummyInt: " << dummy << oendl; | 194 | owarn << "dummyInt: " << dummy << oendl; |
197 | Services::ProfileDescriptor desc( m_profName, m_profId, dummy ); | 195 | Services::ProfileDescriptor desc( m_profName, m_profId, dummy ); |
198 | m_item.insertProfileDescriptor(desc); | 196 | m_item.insertProfileDescriptor(desc); |
199 | } | 197 | } |
200 | }else | 198 | }else |
201 | m_profOver = false; | 199 | m_profOver = false; |
202 | 200 | ||
203 | 201 | ||
204 | return false; | 202 | return false; |
205 | } | 203 | } |