jetstream-api 0.5.5__tar.gz → 0.5.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {jetstream_api-0.5.5 → jetstream_api-0.5.6}/PKG-INFO +1 -1
- {jetstream_api-0.5.5 → jetstream_api-0.5.6}/ilink/__init__.py +1 -1
- {jetstream_api-0.5.5 → jetstream_api-0.5.6}/ilink/msg.py +43 -7
- {jetstream_api-0.5.5 → jetstream_api-0.5.6}/jetstream_api.egg-info/PKG-INFO +1 -1
- {jetstream_api-0.5.5 → jetstream_api-0.5.6}/pyproject.toml +1 -1
- {jetstream_api-0.5.5 → jetstream_api-0.5.6}/LICENSE.txt +0 -0
- {jetstream_api-0.5.5 → jetstream_api-0.5.6}/README.md +0 -0
- {jetstream_api-0.5.5 → jetstream_api-0.5.6}/ilink/admin.py +0 -0
- {jetstream_api-0.5.5 → jetstream_api-0.5.6}/ilink/admintopic.py +0 -0
- {jetstream_api-0.5.5 → jetstream_api-0.5.6}/ilink/common.py +0 -0
- {jetstream_api-0.5.5 → jetstream_api-0.5.6}/ilink/connectivity.py +0 -0
- {jetstream_api-0.5.5 → jetstream_api-0.5.6}/ilink/exception.py +0 -0
- {jetstream_api-0.5.5 → jetstream_api-0.5.6}/ilink/pattern.py +0 -0
- {jetstream_api-0.5.5 → jetstream_api-0.5.6}/ilink/producer.py +0 -0
- {jetstream_api-0.5.5 → jetstream_api-0.5.6}/ilink/properties.py +0 -0
- {jetstream_api-0.5.5 → jetstream_api-0.5.6}/ilink/py.typed +0 -0
- {jetstream_api-0.5.5 → jetstream_api-0.5.6}/ilink/qmgr.py +0 -0
- {jetstream_api-0.5.5 → jetstream_api-0.5.6}/ilink/topic.py +0 -0
- {jetstream_api-0.5.5 → jetstream_api-0.5.6}/ilink/util.py +0 -0
- {jetstream_api-0.5.5 → jetstream_api-0.5.6}/jetstream_api.egg-info/SOURCES.txt +0 -0
- {jetstream_api-0.5.5 → jetstream_api-0.5.6}/jetstream_api.egg-info/dependency_links.txt +0 -0
- {jetstream_api-0.5.5 → jetstream_api-0.5.6}/jetstream_api.egg-info/requires.txt +0 -0
- {jetstream_api-0.5.5 → jetstream_api-0.5.6}/jetstream_api.egg-info/top_level.txt +0 -0
- {jetstream_api-0.5.5 → jetstream_api-0.5.6}/setup.cfg +0 -0
- {jetstream_api-0.5.5 → jetstream_api-0.5.6}/tests/test_example.py +0 -0
|
@@ -1269,6 +1269,27 @@ class JMSHeader:
|
|
|
1269
1269
|
self.dataTypeString = dataTypeString
|
|
1270
1270
|
|
|
1271
1271
|
|
|
1272
|
+
def _is_rfh_bytes(data: bytes | bytearray | None) -> bool:
|
|
1273
|
+
"""바이트가 **RFH2 블롭으로 시작하는지** 본다.
|
|
1274
|
+
|
|
1275
|
+
Args:
|
|
1276
|
+
data (bytes | bytearray | None): 검사할 바이트.
|
|
1277
|
+
|
|
1278
|
+
Returns:
|
|
1279
|
+
bool: 앞 4바이트가 ``"RFH "`` 이고 길이가 고정부를 채우면 True.
|
|
1280
|
+
|
|
1281
|
+
Note:
|
|
1282
|
+
:meth:`RFHStruct.parse` 가 쓰는 기준과 같다. 둘이 갈라지면
|
|
1283
|
+
``setData`` 가 잘못 분기하므로 함께 고쳐야 한다.
|
|
1284
|
+
"""
|
|
1285
|
+
if data is None or len(data) < 40:
|
|
1286
|
+
return False
|
|
1287
|
+
try:
|
|
1288
|
+
return bytes(data[:4]).decode("ascii", "replace") == ILC.RFH_STRUCID
|
|
1289
|
+
except Exception:
|
|
1290
|
+
return False
|
|
1291
|
+
|
|
1292
|
+
|
|
1272
1293
|
class RFHStruct:
|
|
1273
1294
|
"""MQ **RFH2 헤더** 구조체. 타 MQ 제품과 연동할 때 본문 앞에 붙는다.
|
|
1274
1295
|
|
|
@@ -1323,7 +1344,10 @@ class RFHStruct:
|
|
|
1323
1344
|
Raises:
|
|
1324
1345
|
ILDeserializeException: 형식이 RFH2 가 아니거나 길이가 모자랄 때.
|
|
1325
1346
|
"""
|
|
1347
|
+
# 파싱은 상태를 **교체**하는 연산이다. 비우지 않으면 같은 객체로 두 번
|
|
1348
|
+
# 파싱했을 때 이름-값 폴더가 누적된다(setData 를 두 번 부르면 재현).
|
|
1326
1349
|
self.strucId = ""
|
|
1350
|
+
self.nameValueList = []
|
|
1327
1351
|
self.data = data
|
|
1328
1352
|
if data is None or len(data) < 40:
|
|
1329
1353
|
return
|
|
@@ -2022,10 +2046,15 @@ class ILDataMsg(ILInnerMsg):
|
|
|
2022
2046
|
RFHStruct: RFH2 헤더 구조체. RFH 가 아닌 메시지면 **빈 구조체**가
|
|
2023
2047
|
돌아온다(``None`` 이 아니다) - :meth:`RFHStruct.isRFH` 로 판정한다.
|
|
2024
2048
|
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2049
|
+
Note:
|
|
2050
|
+
**호출 순서는 상관없다.** :meth:`setData` 에 평문 본문을 주면 이미
|
|
2051
|
+
채워 둔 RFH 를 그대로 두고 본문만 갈아 끼운다 - RFH 를 채운 뒤에
|
|
2052
|
+
``setData`` 를 불러도 RFH 가 살아남는다. 넘긴 바이트가 **RFH2 블롭
|
|
2053
|
+
자체**일 때만 헤더까지 다시 읽는다(수신 경로가 그렇다).
|
|
2054
|
+
|
|
2055
|
+
0.5.5 까지는 순서를 바꾸면 RFH 가 조용히 사라졌다. 0.5.6 부터
|
|
2056
|
+
고쳐졌으므로, 그 이전 버전과 함께 쓰는 코드라면 **본문을 생성자로
|
|
2057
|
+
먼저 넣는** 순서를 유지하는 편이 안전하다.
|
|
2029
2058
|
|
|
2030
2059
|
Note:
|
|
2031
2060
|
:meth:`getData` 는 **RFH 를 뺀 사용자 데이터**이고
|
|
@@ -2042,8 +2071,8 @@ class ILDataMsg(ILInnerMsg):
|
|
|
2042
2071
|
|
|
2043
2072
|
from ilink.msg import ILDataMsg, JMSHeader
|
|
2044
2073
|
|
|
2045
|
-
msg = ILDataMsg(JMSHeader(), None, b"<data>...</data>")
|
|
2046
|
-
msg.getRFH().setNameValueList([
|
|
2074
|
+
msg = ILDataMsg(JMSHeader(), None, b"<data>...</data>")
|
|
2075
|
+
msg.getRFH().setNameValueList([
|
|
2047
2076
|
b"<mcd><Msd/><Set/><Type/><Fmt/></mcd>",
|
|
2048
2077
|
b"<usr><intf_id>MS_BIZPL</intf_id></usr>",
|
|
2049
2078
|
])
|
|
@@ -2110,7 +2139,14 @@ class ILDataMsg(ILInnerMsg):
|
|
|
2110
2139
|
Args:
|
|
2111
2140
|
data (bytes | bytearray | None): 넣을 값.
|
|
2112
2141
|
"""
|
|
2113
|
-
|
|
2142
|
+
raw = bytes(data) if data is not None else None
|
|
2143
|
+
if self.rfh.isRFH() and not _is_rfh_bytes(raw):
|
|
2144
|
+
# 이미 RFH 를 채워 둔 메시지에 **평문 본문**을 넣는 경우다.
|
|
2145
|
+
# parse 를 태우면 strucId 가 지워져 RFH 가 조용히 사라지므로
|
|
2146
|
+
# 본문만 갈아 끼운다. 호출 순서에 상관없이 RFH 가 살아남는다.
|
|
2147
|
+
self.rfh.setData(raw)
|
|
2148
|
+
else:
|
|
2149
|
+
self.rfh.parse(raw)
|
|
2114
2150
|
self.data = self.rfh.getData()
|
|
2115
2151
|
self.dataLength = self.rfh.getDataLength()
|
|
2116
2152
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|