• Home
Name Date Size #Lines LOC

..--

BUILD.gnD07-Sep-202413 KiB494445

LICENSED07-Sep-202411.1 KiB203169

OAT.xmlD07-Sep-20247.7 KiB11257

README.OpenSourceD07-Sep-2024612 1211

README.mdD07-Sep-20242.6 KiB7766

README_zh.mdD07-Sep-20244 KiB10492

backport-Also-fix-cupsfilter.patchD07-Sep-20241.2 KiB3228

backport-CVE-2022-26691.patchD07-Sep-20241.1 KiB3529

backport-CVE-2023-32324.patchD07-Sep-2024944 3831

backport-CVE-2023-34241.patchD07-Sep-20242.1 KiB6657

backport-CVE-2023-4504.patchD07-Sep-2024593 2623

backport-Remove-legacy-code-for-RIP_MAX_CACHE-environment-variable.patchD07-Sep-20241.6 KiB4740

bundle.jsonD07-Sep-20241 KiB3939

config.hD07-Sep-20243 KiB10581

cups-2.4.0-source.tar.gzD07-Sep-20247.7 MiB

cups-banners.patchD07-Sep-2024532 1311

cups-direct-usb.patchD07-Sep-2024912 2826

cups-driverd-timeout.patchD07-Sep-2024741 2217

cups-freebind.patchD07-Sep-2024704 1614

cups-ipp-multifile.patchD07-Sep-2024700 1613

cups-multilib.patchD07-Sep-2024580 1514

cups-system-auth.patchD07-Sep-20241.7 KiB3937

cups-uri-compat.patchD07-Sep-20241.5 KiB5246

cups-usb-paperout.patchD07-Sep-20241.3 KiB5348

cups-web-devices-timeout.patchD07-Sep-2024758 2016

cups.gniD07-Sep-20241.3 KiB3630

cups.specD07-Sep-202418.4 KiB562452

cups.yamlD07-Sep-2024663 184

cupsprinter.pngD07-Sep-20242.1 KiB

fix-httpAddrGetList-test-case-fail.patchD07-Sep-20241.4 KiB4537

generate_mime_convs.pyD07-Sep-20241 KiB3517

install.pyD07-Sep-20243.1 KiB10273

ohos-add-openssl.patchD07-Sep-202444.6 KiB1,6781,677

ohos-modify-pthread.patchD07-Sep-2024332 1311

ohos-multi-file-print.patchD07-Sep-2024432 1513

ohos_ip_conflict.patchD07-Sep-202413.5 KiB390356

README.OpenSource

1[
2    {
3        "Name"                  : "cups",
4        "License"               : "Apache 2.0 License",
5        "License File"          : "LICENSE",
6        "Version Number"        : "2.4.0-4.oe2203sp1",
7        "Owner"                 : "dongzhengkuan@huawei.com",
8        "Upstream URL"          : "https://repo.openeuler.org/openEuler-22.03-LTS-SP1/source/Packages/cups-2.4.0-4.oe2203sp1.src.rpm",
9        "Description"           : "OpenPrinting CUPS is the most current version of CUPS, a standards-based, open source printing system for Linux® and other Unix®-like operating systems"
10    }
11]
12

README.md

1# CUPS
2## Introduction
3OpenPrinting CUPS is the most current version of CUPS, a standards-based, open source printing system for Linux® and other Unix®-like operating systems. CUPS supports printing to:
4- AirPrint™ and IPP Everywhere™ printers,
5- Network and local (USB) printers with Printer Applications, and
6- Network and local (USB) printers with (legacy) PPD-based printer drivers.
7
8You can also learn more about the CUPS project through [the official website](https://github.com/OpenPrinting/cups)
9
10## Background Brief
11In the process of OpenHarmony's southward ecological development, it is necessary to be compatible with printers in the stock market. The use of CUPS printing system can directly connect with most printers in the market, which also reduces the difficulty for printer manufacturers to adapt to OpenHarmony.
12
13## How to use
14### 1、Header file import
15```c
16#include <cups/cups-private.h>
17```
18### 2、Add Compilation Dependency
19Add in the bundle. json file
20```json
21"deps": {
22  "third_part": [
23    "cups"
24  ]
25}
26```
27Add dependencies where needed in BUILD.gn
28
29```json
30deps += [ "//third_party/cups:cups" ]
31```
32### 3、Example of interface usage
33```c
34// Example of using CUPS interface to query printer capabilities
35ipp_t *request; /* IPP Request */
36ipp_t *response; /* IPP response */
37http_t *http = NULL;
38char scheme[HTTP_MAX_URI]; // Protocol
39char username[HTTP_MAX_URI];
40char host[HTTP_MAX_URI];
41int port;
42// Declare which printer capabilities need to be queried, here are all
43static const char * const pattrs[] = {
44    "all"
45};
46
47// Connect to printer
48http = httpConnect2(host, port, NULL, AF_UNSPEC, HTTP_ENCRYPTION_IF_REQUESTED, 1, TIME_OUT, NULL);
49if (http == nullptr) {
50    return;
51}
52request = ippNewRequest(IPP_OP_GET_PRINTER_ATTRIBUTES);
53ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, printerUri.c_str());
54ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsUser());
55ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes",
56(int)(sizeof(pattrs) / sizeof(pattrs[0])), NULL, pattrs);
57response = cupsDoRequest(http, request, "/");
58// parse response
59if (cupsLastError() > IPP_STATUS_OK_CONFLICTING) {
60    ippDelete(response);
61    return;
62}
63// close http
64httpClose(http);
65```
66
67#### Repositories Involved
68[third_party_cups-filters](https://gitee.com/openharmony/third_party_cups-filters)
69
70[print_print_fwk](https://gitee.com/openharmony/print_print_fwk)
71
72#### Contribution
73[How to involve](https://gitee.com/openharmony/docs/blob/HEAD/zh-cn/contribute/参与贡献.md)
74
75[Commit message spec](https://gitee.com/openharmony/device_qemu/wikis/Commit%20message%E8%A7%84%E8%8C%83)
76
77

README_zh.md

1# 三方开源软件CUPS
2## CUPS简介
3CUPS(Common Unix Printing System)是一种开源打印系统,现在由OpenPrinting组织维护。CUPS主要功能包括打印队列管理、打印驱动程序管理、网络打印支持等。CUPS支持多种打印协议,包括IPP(Internet Printing Protocol)、LPD(Line Printer Daemon Protocol)、AppSocket等。
4
5CUPS支持以下类型的打印机:
6- AirPrint和IPP Everywhere认证的打印机;
7- 带打印机应用程序的网络和USB打印机;
8- 基于PPD(PostScript Printer Definition)打印驱动程序的网络和本地(USB)打印机。
9
10您也可以通过[CUPS官网主页](https://github.com/OpenPrinting/cups)了解更多关于CUPS项目的信息。
11
12## 引入背景简述
13OpenHarmony南向生态发展过程中,需要对存量市场的打印机进行兼容。使用CUPS打印系统能直接对接市场上大部分的打印机,也减少了打印机驱动适配OpenHarmony系统的难度。
14
15## 目录结构
16```
17- LICENSE                           版权文件
18- OAT.xml                           OAT.xml过滤配置文件
19- README.OpenSource                 项目README.OpenSource文件
20- README.md                         英文说明
21- README_zh.md                      中文说明
22- backport-CVE-2022-26691.patch     CVE修复补丁
23- backport-CVE-2023-32324.patch     CVE修复补丁
24- backport-CVE-2023-34241.patch     CVE修复补丁
25- cups-2.4.0-source.tar.gz          cups2.4.0源码压缩tar包
26- backport-xxx.patch                上游更新补丁列表
27- cups-xxx.patch                    上游更新补丁列表
28- cups.spec                         上游更新记录说明
29- cups.yaml                         上游yaml文件
30- cups_single_file.patch            适配OpenHarmony编译补丁文件
31- pthread_cancel.patch              适配OpenHarmony编译补丁文件
32- install.sh                        适配OpenHarmony编译sh脚本文件
33- generate_mime_convs.py            适配OpenHarmony编译python脚本文件
34```
35
36## 如何使用
37### 1、头文件引入
38```c
39#include <cups/cups-private.h>
40```
41### 2、添加编译依赖
42在您的 bundle.json 文件 添加
43```json
44"deps": {
45  "third_part": [
46    "cups"
47  ]
48}
49```
50在您的BUILD.gn需要的地方添加依赖
51```json
52deps += [ "//third_party/cups:cups" ]
53```
54### 3、接口使用示例
55```c
56// 使用CUPS接口查询打印机能力示例
57ipp_t *request; /* IPP Request */
58ipp_t *response; /* IPP response */
59http_t *http = NULL;
60char scheme[HTTP_MAX_URI]; // 协议类型
61char username[HTTP_MAX_URI]; // 请求用户名
62char host[HTTP_MAX_URI]; // 打印机ip
63int port; // 打印机端口
64// 声明需要查询哪些打印机能力,此处为所有
65static const char * const pattrs[] = {
66    "all"
67};
68
69// 使用打印机ip和端口连接打印机
70http = httpConnect2(host, port, NULL, AF_UNSPEC, HTTP_ENCRYPTION_IF_REQUESTED, 1, TIME_OUT, NULL);
71if (http == nullptr) {
72    return;
73}
74// 构造获取打印机能力的request
75request = ippNewRequest(IPP_OP_GET_PRINTER_ATTRIBUTES);
76// 指定请求uri
77ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, printerUri.c_str());
78// 指定请求的用户
79ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsUser());
80// 指定请求哪些打印机属性
81ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes",
82(int)(sizeof(pattrs) / sizeof(pattrs[0])), NULL, pattrs);
83// 调用CUPS接口发送ipp请求
84response = cupsDoRequest(http, request, "/");
85// 处理请求结果
86if (cupsLastError() > IPP_STATUS_OK_CONFLICTING) {
87    ippDelete(response);
88    return;
89}
90// 关闭http
91httpClose(http);
92```
93
94### 相关仓
95[third_party_cups-filters](https://gitee.com/openharmony/third_party_cups-filters)
96
97[print_print_fwk](https://gitee.com/openharmony/print_print_fwk)
98
99### 参与贡献
100[如何贡献](https://gitee.com/openharmony/docs/blob/HEAD/zh-cn/contribute/参与贡献.md)
101
102[Commit message规范](https://gitee.com/openharmony/device_qemu/wikis/Commit%20message%E8%A7%84%E8%8C%83)
103
104